Don't count stuff in flasks and backpacks as available in workflow.

develop
Alexander Gavrilov 2012-01-15 20:45:02 +04:00
parent 8158733745
commit f0f354f3c7
1 changed files with 13 additions and 0 deletions

@ -27,6 +27,7 @@
#include <df/general_ref_unit_holderst.h> #include <df/general_ref_unit_holderst.h>
#include <df/general_ref_building_holderst.h> #include <df/general_ref_building_holderst.h>
#include <df/general_ref_contains_itemst.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/general_ref_contains_unitst.h>
#include <df/itemdef_foodst.h> #include <df/itemdef_foodst.h>
#include <df/reaction.h> #include <df/reaction.h>
@ -993,6 +994,7 @@ static void dryBucket(df::item *item)
static bool itemBusy(df::item *item) static bool itemBusy(df::item *item)
{ {
using namespace df::enums::item_type;
for (unsigned i = 0; i < item->itemrefs.size(); i++) 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) if (!item->flags.bits.in_job)
return true; 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; return false;