From f0f354f3c73af85090db609af4b14389591a615a Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 15 Jan 2012 20:45:02 +0400 Subject: [PATCH] Don't count stuff in flasks and backpacks as available in workflow. --- plugins/workflow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index e2fe03fc9..38e2313cd 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -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(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;