diff options
| author | Alexander Gavrilov | 2012-05-20 21:57:45 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-20 21:57:45 +0400 |
| commit | b992b04f0bb7ffef8e7fb152967d438f398543d7 (patch) | |
| tree | 0b6dd0e193642d95df53ffb05f7fe9c3a63d0595 /plugins/autodump.cpp | |
| parent | d28d240dbdce9ef38081826c76dad4268259a380 (diff) | |
| download | dfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.gz dfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.bz2 dfhack-b992b04f0bb7ffef8e7fb152967d438f398543d7.tar.xz | |
Remove stuff that shouldn't be in the core, and expose to lua what's left.
Specifically, any "if (verbose) { Core::printerr("blah") }" kind
of stuff definitely doesn't belong in the common API functions.
Also, ref->getUnit() is very expensive.
On the other hand, checks for crash-inducing conflicts with the
ui should be in the core api, and not in client plugins.
Diffstat (limited to 'plugins/autodump.cpp')
| -rw-r--r-- | plugins/autodump.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 753a8fb9..536b2501 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -148,8 +148,6 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame } } - bool inventoryDumpingSkipped = false; - // proceed with the dumpification operation for(size_t i=0; i< numItems; i++) { @@ -175,14 +173,6 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame continue; if (!need_forbidden && itm->flags.bits.forbid) continue; - if (itm->flags.bits.in_inventory && Gui::getSelectedUnit(out, true)) - { - // Due to GUI caching/redraw rules, Dwarf Fortress tends to crash if we make any changes to a unit's inventory - // while the player is looking at the inventory menu. Therefore, we'll simply skip such items until they - // change something (e.g. switch from "v" to "k" mode). - inventoryDumpingSkipped = true; - continue; - } if(!destroy) // move to cursor { @@ -192,7 +182,11 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame // Don't move items if they're already at the cursor if (pos_cursor != pos_item) - Items::moveToGround(MC, itm, pos_cursor); + { + if (!Items::moveToGround(MC, itm, pos_cursor)) + out.print("Could not move item: %s\n", + Items::getDescription(itm, 0, true).c_str()); + } } else // destroy { @@ -213,7 +207,6 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame if(!destroy) MC.WriteAll(); - if (inventoryDumpingSkipped) { out.printerr("Some inventory items could not be autodumped because the unit/inventory screen is currently active. Please close the unit screen and repeat the operation.\n"); } out.print("Done. %d items %s.\n", dumped_total, destroy ? "marked for destruction" : "quickdumped"); return CR_OK; } |
