diff options
| author | Alexander Gavrilov | 2012-01-15 20:45:02 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-01-15 20:45:02 +0400 |
| commit | f0f354f3c73af85090db609af4b14389591a615a (patch) | |
| tree | 868a3ea8d8f1cf4873393c3192600d9653738b01 /plugins/workflow.cpp | |
| parent | 81587337452dfbc56decf44cdc038ef10ef8bcdc (diff) | |
| download | dfhack-f0f354f3c73af85090db609af4b14389591a615a.tar.gz dfhack-f0f354f3c73af85090db609af4b14389591a615a.tar.bz2 dfhack-f0f354f3c73af85090db609af4b14389591a615a.tar.xz | |
Don't count stuff in flasks and backpacks as available in workflow.
Diffstat (limited to 'plugins/workflow.cpp')
| -rw-r--r-- | plugins/workflow.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index e2fe03fc..38e2313c 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -27,6 +27,7 @@ #include <df/general_ref_unit_holderst.h> #include <df/general_ref_building_holderst.h> #include <df/general_ref_contains_itemst.h> +#include <df/general_ref_contained_in_itemst.h> #include <df/general_ref_contains_unitst.h> #include <df/itemdef_foodst.h> #include <df/reaction.h> @@ -993,6 +994,7 @@ static void dryBucket(df::item *item) static bool itemBusy(df::item *item) { + using namespace df::enums::item_type; for (unsigned i = 0; i < item->itemrefs.size(); i++) { @@ -1010,6 +1012,17 @@ static bool itemBusy(df::item *item) if (!item->flags.bits.in_job) return true; } + else if (strict_virtual_cast<df::general_ref_contained_in_itemst>(ref)) + { + df::item *obj = ref->getItem(); + if (!obj) + continue; + + // Stuff in flasks and backpacks is busy + df::item_type type = obj->getType(); + if ((type == FLASK && item->getType() == DRINK) || type == BACKPACK) + return true; + } } return false; |
