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/weather.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/weather.cpp')
| -rw-r--r-- | plugins/weather.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/weather.cpp b/plugins/weather.cpp index d6d83cfa..8bf17174 100644 --- a/plugins/weather.cpp +++ b/plugins/weather.cpp @@ -13,11 +13,11 @@ using namespace DFHack; bool locked = false; unsigned char locked_data[25]; -command_result weather (Core * c, vector <string> & parameters); +command_result weather (color_ostream &out, vector <string> & parameters); DFHACK_PLUGIN("weather"); -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(); commands.push_back(PluginCommand( @@ -32,14 +32,13 @@ 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; } -command_result weather (Core * c, vector <string> & parameters) +command_result weather (color_ostream &con, vector <string> & parameters) { - Console & con = c->con; int val_override = -1; bool lock = false; bool unlock = false; @@ -81,8 +80,9 @@ command_result weather (Core * c, vector <string> & parameters) } bool something = lock || unlock || rain || snow || clear || val_override != -1; - CoreSuspender suspend(c); - DFHack::World * w = c->getWorld(); + CoreSuspender suspend; + + DFHack::World * w = Core::getInstance().getWorld(); if(!w->wmap) { con << "Weather support seems broken :(" << std::endl; |
