summaryrefslogtreecommitdiff
path: root/plugins/tubefill.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/tubefill.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/tubefill.cpp')
-rw-r--r--plugins/tubefill.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/tubefill.cpp b/plugins/tubefill.cpp
index 71216c87..93b7abff 100644
--- a/plugins/tubefill.cpp
+++ b/plugins/tubefill.cpp
@@ -17,23 +17,23 @@ using namespace DFHack;
using namespace df::enums;
using df::global::world;
-command_result tubefill(DFHack::Core * c, std::vector<std::string> & params);
+command_result tubefill(color_ostream &out, std::vector<std::string> & params);
DFHACK_PLUGIN("tubefill");
-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("tubefill","Fill in all the adamantine tubes again.",tubefill));
return CR_OK;
}
-DFhackCExport command_result plugin_shutdown ( Core * c )
+DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
return CR_OK;
}
-command_result tubefill(DFHack::Core * c, std::vector<std::string> & params)
+command_result tubefill(color_ostream &out, std::vector<std::string> & params)
{
uint64_t count = 0;
@@ -41,16 +41,18 @@ command_result tubefill(DFHack::Core * c, std::vector<std::string> & params)
{
if(params[i] == "help" || params[i] == "?")
{
- c->con.print("Replenishes mined out adamantine and hollow adamantine tubes.\n"
+ out.print("Replenishes mined out adamantine and hollow adamantine tubes.\n"
"May cause !!FUN!!\n"
);
return CR_OK;
}
}
- CoreSuspender suspend(c);
+
+ CoreSuspender suspend;
+
if (!Maps::IsValid())
{
- c->con.printerr("Map is not available!\n");
+ out.printerr("Map is not available!\n");
return CR_FAILURE;
}
@@ -102,6 +104,6 @@ command_result tubefill(DFHack::Core * c, std::vector<std::string> & params)
}
}
}
- c->con.print("Found and changed %d tiles.\n", count);
+ out.print("Found and changed %d tiles.\n", count);
return CR_OK;
}