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/stockpiles.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/stockpiles.cpp')
| -rw-r--r-- | plugins/stockpiles.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/stockpiles.cpp b/plugins/stockpiles.cpp index 06b72c0c..4f3192f3 100644 --- a/plugins/stockpiles.cpp +++ b/plugins/stockpiles.cpp @@ -22,12 +22,12 @@ using df::global::selection_rect; using df::building_stockpilest; -static command_result copystock(Core *c, vector <string> & parameters); -static bool copystock_guard(Core *c, df::viewscreen *top); +static command_result copystock(color_ostream &out, vector <string> & parameters); +static bool copystock_guard(df::viewscreen *top); DFHACK_PLUGIN("stockpiles"); -DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &commands) +DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) { commands.clear(); if (world && ui) { @@ -47,16 +47,16 @@ 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; } -static bool copystock_guard(Core *c, df::viewscreen *top) +static bool copystock_guard(df::viewscreen *top) { using namespace ui_sidebar_mode; - if (!Gui::dwarfmode_hotkey(c,top)) + if (!Gui::dwarfmode_hotkey(top)) return false; switch (ui->main.mode) { @@ -70,7 +70,7 @@ static bool copystock_guard(Core *c, df::viewscreen *top) } } -static command_result copystock(Core * c, vector <string> & parameters) +static command_result copystock(color_ostream &out, vector <string> & parameters) { // HOTKEY COMMAND: CORE ALREADY SUSPENDED @@ -80,14 +80,14 @@ static command_result copystock(Core * c, vector <string> & parameters) ui->main.mode = ui_sidebar_mode::QueryBuilding; selection_rect->start_x = -30000; - c->con << "Switched back to query building." << endl; + out << "Switched back to query building." << endl; return CR_OK; } building_stockpilest *sp = virtual_cast<building_stockpilest>(world->selected_building); if (!sp) { - c->con.printerr("Selected building isn't a stockpile.\n"); + out.printerr("Selected building isn't a stockpile.\n"); return CR_WRONG_USAGE; } @@ -95,6 +95,6 @@ static command_result copystock(Core * c, vector <string> & parameters) ui->main.mode = ui_sidebar_mode::Stockpiles; world->selected_stockpile_type = stockpile_category::Custom; - c->con << "Stockpile options copied." << endl; + out << "Stockpile options copied." << endl; return CR_OK; } |
