| 987 | } |
| 988 | |
| 989 | static bool itemBusy(df::item *item) |
| 990 | { |
| 991 | using namespace df::enums::item_type; |
| 992 | |
| 993 | for (size_t i = 0; i < item->general_refs.size(); i++) |
| 994 | { |
| 995 | df::general_ref *ref = item->general_refs[i]; |
| 996 | if (ref->getType() == general_ref_type::CONTAINS_ITEM) |
| 997 | { |
| 998 | df::item *obj = ref->getItem(); |
| 999 | if (obj && !obj->flags.bits.garbage_collect) |
| 1000 | return true; |
| 1001 | } |
| 1002 | else if (ref->getType() == general_ref_type::CONTAINS_UNIT) |
| 1003 | return true; |
| 1004 | else if (ref->getType() == general_ref_type::UNIT_HOLDER) |
| 1005 | { |
| 1006 | if (!item->flags.bits.in_job) |
| 1007 | return true; |
| 1008 | } |
| 1009 | else if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM) |
| 1010 | { |
| 1011 | df::item *obj = ref->getItem(); |
| 1012 | if (!obj) |
| 1013 | continue; |
| 1014 | |
| 1015 | // Stuff in flasks and backpacks is busy |
| 1016 | df::item_type type = obj->getType(); |
| 1017 | if ((type == FLASK && item->getType() == DRINK) || type == BACKPACK) |
| 1018 | return true; |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | return false; |
| 1023 | } |
| 1024 | |
| 1025 | static bool itemInRealJob(df::item *item) |
| 1026 | { |
no test coverage detected