diff options
| author | Alexander Gavrilov | 2012-03-10 15:55:42 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-03-10 15:55:42 +0400 |
| commit | 8cc82d5876c902cbb4f0b3fa6cf15cf268dd942b (patch) | |
| tree | 4be7625f1bbe15b81d00373316047137d3422464 /plugins/fixpositions.cpp | |
| parent | b2737e2bed5f013a4dfbf6e19650ca60498a9afd (diff) | |
| download | dfhack-8cc82d5876c902cbb4f0b3fa6cf15cf268dd942b.tar.gz dfhack-8cc82d5876c902cbb4f0b3fa6cf15cf268dd942b.tar.bz2 dfhack-8cc82d5876c902cbb4f0b3fa6cf15cf268dd942b.tar.xz | |
Make plugins accept explicit output stream references.
This is an incompatible change to the plugin ABI.
The Console is not thread-safe unless used indirectly
via color_ostream_proxy, so everything should use their
per-thread stream.
Diffstat (limited to 'plugins/fixpositions.cpp')
| -rw-r--r-- | plugins/fixpositions.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/fixpositions.cpp b/plugins/fixpositions.cpp index 76f3e06e..086848fe 100644 --- a/plugins/fixpositions.cpp +++ b/plugins/fixpositions.cpp @@ -20,12 +20,13 @@ using namespace df::enums; using df::global::world; -command_result df_fixdiplomats (Core *c, vector<string> ¶meters) +command_result df_fixdiplomats (color_ostream &out, vector<string> ¶meters) { if (!parameters.empty()) return CR_WRONG_USAGE; - CoreSuspender suspend(c); + CoreSuspender suspend; + int checked = 0, fixed = 0; for (int i = 0; i < world->entities.all.size(); i++) { @@ -120,16 +121,17 @@ command_result df_fixdiplomats (Core *c, vector<string> ¶meters) if (update || assign) fixed++; } - c->con.print("Fixed %d of %d civilizations to enable tree cap diplomacy.\n", fixed, checked); + out.print("Fixed %d of %d civilizations to enable tree cap diplomacy.\n", fixed, checked); return CR_OK; } -command_result df_fixmerchants (Core *c, vector<string> ¶meters) +command_result df_fixmerchants (color_ostream &out, vector<string> ¶meters) { if (!parameters.empty()) return CR_WRONG_USAGE; - CoreSuspender suspend(c); + CoreSuspender suspend; + int checked = 0, fixed = 0; for (int i = 0; i < world->entities.all.size(); i++) { @@ -220,13 +222,13 @@ command_result df_fixmerchants (Core *c, vector<string> ¶meters) if (update || assign) fixed++; } - c->con.print("Fixed %d of %d civilizations to enable merchant nobility.\n", fixed, checked); + out.print("Fixed %d of %d civilizations to enable merchant nobility.\n", fixed, checked); return CR_OK; } DFHACK_PLUGIN("fixpositions"); -DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands) +DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands) { commands.push_back(PluginCommand( "fixdiplomats", "Add Diplomat position to Elven civilizations for tree cap diplomacy.", @@ -237,7 +239,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> return CR_OK; } -DFhackCExport command_result plugin_shutdown ( Core * c ) +DFhackCExport command_result plugin_shutdown ( color_ostream &out ) { return CR_OK; } |
