summaryrefslogtreecommitdiff
path: root/plugins/flows.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-03-10 15:55:42 +0400
committerAlexander Gavrilov2012-03-10 15:55:42 +0400
commit8cc82d5876c902cbb4f0b3fa6cf15cf268dd942b (patch)
tree4be7625f1bbe15b81d00373316047137d3422464 /plugins/flows.cpp
parentb2737e2bed5f013a4dfbf6e19650ca60498a9afd (diff)
downloaddfhack-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/flows.cpp')
-rw-r--r--plugins/flows.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/flows.cpp b/plugins/flows.cpp
index 287dbc2c..26188f51 100644
--- a/plugins/flows.cpp
+++ b/plugins/flows.cpp
@@ -17,12 +17,12 @@ using namespace df::enums;
using df::global::world;
-command_result df_flows (Core * c, vector <string> & parameters)
+command_result df_flows (color_ostream &out, vector <string> & parameters)
{
- CoreSuspender suspend(c);
+ CoreSuspender suspend;
int flow1 = 0, flow2 = 0, flowboth = 0, water = 0, magma = 0;
- c->con.print("Counting flows and liquids ...\n");
+ out.print("Counting flows and liquids ...\n");
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
@@ -48,17 +48,17 @@ command_result df_flows (Core * c, vector <string> & parameters)
}
}
- c->con.print("Blocks with liquid_1=true: %d\n", flow1);
- c->con.print("Blocks with liquid_2=true: %d\n", flow2);
- c->con.print("Blocks with both: %d\n", flowboth);
- c->con.print("Water tiles: %d\n", water);
- c->con.print("Magma tiles: %d\n", magma);
+ out.print("Blocks with liquid_1=true: %d\n", flow1);
+ out.print("Blocks with liquid_2=true: %d\n", flow2);
+ out.print("Blocks with both: %d\n", flowboth);
+ out.print("Water tiles: %d\n", water);
+ out.print("Magma tiles: %d\n", magma);
return CR_OK;
}
DFHACK_PLUGIN("flows");
-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("flows",
"Counts map blocks with flowing liquids.",
@@ -66,7 +66,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;
}