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/changevein.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/changevein.cpp')
| -rw-r--r-- | plugins/changevein.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/changevein.cpp b/plugins/changevein.cpp index efb045f7..5b8d2e98 100644 --- a/plugins/changevein.cpp +++ b/plugins/changevein.cpp @@ -18,42 +18,42 @@ using namespace df::enums; using df::global::world; using df::global::cursor; -command_result df_changevein (Core * c, vector <string> & parameters) +command_result df_changevein (color_ostream &out, vector <string> & parameters) { if (parameters.size() != 1) return CR_WRONG_USAGE; - 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; } if (!cursor || cursor->x == -30000) { - c->con.printerr("No cursor detected - please place the cursor over a mineral vein.\n"); + out.printerr("No cursor detected - please place the cursor over a mineral vein.\n"); return CR_FAILURE; } MaterialInfo mi; if (!mi.findInorganic(parameters[0])) { - c->con.printerr("No such material!\n"); + out.printerr("No such material!\n"); return CR_FAILURE; } if (mi.inorganic->material.flags.is_set(material_flags::IS_METAL) || mi.inorganic->material.flags.is_set(material_flags::NO_STONE_STOCKPILE) || mi.inorganic->flags.is_set(inorganic_flags::SOIL_ANY)) { - c->con.printerr("Invalid material - you must select a type of stone or gem\n"); + out.printerr("Invalid material - you must select a type of stone or gem\n"); return CR_FAILURE; } df::map_block *block = Maps::getBlockAbs(cursor->x, cursor->y, cursor->z); if (!block) { - c->con.printerr("Invalid tile selected.\n"); + out.printerr("Invalid tile selected.\n"); return CR_FAILURE; } df::block_square_event_mineralst *mineral = NULL; @@ -70,7 +70,7 @@ command_result df_changevein (Core * c, vector <string> & parameters) } if (!mineral) { - c->con.printerr("Selected tile does not contain a mineral vein.\n"); + out.printerr("Selected tile does not contain a mineral vein.\n"); return CR_FAILURE; } mineral->inorganic_mat = mi.index; @@ -80,7 +80,7 @@ command_result df_changevein (Core * c, vector <string> & parameters) DFHACK_PLUGIN("changevein"); -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("changevein", "Changes the material of a mineral inclusion.", @@ -89,7 +89,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; } |
