diff options
| author | Quietust | 2012-01-21 18:31:15 -0600 |
|---|---|---|
| committer | Quietust | 2012-01-21 18:31:15 -0600 |
| commit | 2cc6bcf0e97dbdf60492067cd71dc79432a35687 (patch) | |
| tree | e893504d15ef59e8803573f6f4483d2e3ec9ca34 /plugins/drybuckets.cpp | |
| parent | ccf22bed10a78504701bbdb1f8177a16cf9ffdde (diff) | |
| download | dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.gz dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.bz2 dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.xz | |
Use CoreSuspender and namespace df::enums
Diffstat (limited to 'plugins/drybuckets.cpp')
| -rw-r--r-- | plugins/drybuckets.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/plugins/drybuckets.cpp b/plugins/drybuckets.cpp index abe692c0..582c7133 100644 --- a/plugins/drybuckets.cpp +++ b/plugins/drybuckets.cpp @@ -13,44 +13,45 @@ using std::string; using std::vector; using namespace DFHack; +using namespace df::enums; using df::global::world; DFhackCExport command_result df_drybuckets (Core * c, vector <string> & parameters) { - if (!parameters.empty()) - return CR_WRONG_USAGE; - - CoreSuspender suspend(c); - - int dried_total = 0; - for (int i = 0; i < world->items.all.size(); i++) - { - df::item *item = world->items.all[i]; - if ((item->getType() == df::item_type::LIQUID_MISC) && (item->getMaterial() == df::builtin_mats::WATER)) - { - item->flags.bits.garbage_colect = 1; - dried_total++; - } - } - if (dried_total) - c->con.print("Done. %d buckets of water marked for emptying.\n", dried_total); - return CR_OK; + if (!parameters.empty()) + return CR_WRONG_USAGE; + + CoreSuspender suspend(c); + + int dried_total = 0; + for (int i = 0; i < world->items.all.size(); i++) + { + df::item *item = world->items.all[i]; + if ((item->getType() == item_type::LIQUID_MISC) && (item->getMaterial() == builtin_mats::WATER)) + { + item->flags.bits.garbage_colect = 1; + dried_total++; + } + } + if (dried_total) + c->con.print("Done. %d buckets of water marked for emptying.\n", dried_total); + return CR_OK; } DFhackCExport const char * plugin_name ( void ) { - return "drybuckets"; + return "drybuckets"; } DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands) { - commands.clear(); - commands.push_back(PluginCommand("drybuckets", "Removes water from buckets.", df_drybuckets)); - return CR_OK; + commands.clear(); + commands.push_back(PluginCommand("drybuckets", "Removes water from buckets.", df_drybuckets)); + return CR_OK; } DFhackCExport command_result plugin_shutdown ( Core * c ) { - return CR_OK; + return CR_OK; } |
