summaryrefslogtreecommitdiff
path: root/plugins/autodump.cpp
diff options
context:
space:
mode:
authorplayfordh2012-05-15 06:32:09 -0400
committerplayfordh2012-05-15 06:32:09 -0400
commit0d2849ca5aef2bb96cc786d9f63661a010f6e766 (patch)
treec2c1acb794c8c71d05e78ace113ff05fd63db886 /plugins/autodump.cpp
parent689cf3ee51cffb97c21a915fc4eac6c1957a271f (diff)
downloaddfhack-0d2849ca5aef2bb96cc786d9f63661a010f6e766.tar.gz
dfhack-0d2849ca5aef2bb96cc786d9f63661a010f6e766.tar.bz2
dfhack-0d2849ca5aef2bb96cc786d9f63661a010f6e766.tar.xz
Modified autodump to enable extraction of equipped items from unit inventory
Signed-off-by: playfordh <harlanplayford@gmail.com>
Diffstat (limited to 'plugins/autodump.cpp')
-rw-r--r--plugins/autodump.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp
index 2620d9de..753a8fb9 100644
--- a/plugins/autodump.cpp
+++ b/plugins/autodump.cpp
@@ -148,6 +148,8 @@ 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++)
{
@@ -156,11 +158,11 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
// only dump the stuff marked for dumping and laying on the ground
if ( !itm->flags.bits.dump
- || !itm->flags.bits.on_ground
+// || !itm->flags.bits.on_ground
|| itm->flags.bits.construction
|| itm->flags.bits.in_building
|| itm->flags.bits.in_chest
- || itm->flags.bits.in_inventory
+// || itm->flags.bits.in_inventory
|| itm->flags.bits.artifact1
)
continue;
@@ -173,6 +175,14 @@ 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
{
@@ -203,6 +213,7 @@ 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;
}