MCPcopy Create free account
hub / github.com/DFHack/dfhack / isContainedInItem

Function isContainedInItem

plugins/autobutcher.cpp:615–622  ·  view source on GitHub ↗

check if contained in item (e.g. animals in cages)

Source from the content-addressed store, hash-verified

613
614// check if contained in item (e.g. animals in cages)
615static bool isContainedInItem(df::unit *unit) {
616 for (auto gref : unit->general_refs) {
617 if (gref->getType() == df::general_ref_type::CONTAINED_IN_ITEM) {
618 return true;
619 }
620 }
621 return false;
622}
623
624// found a unit with weird position values on one of my maps (negative and in the thousands)
625// it didn't appear in the animal stocks screen, but looked completely fine otherwise (alive, tame, own, etc)

Callers 2

isInappropriateUnitFunction · 0.70
isProtectedUnitFunction · 0.70

Calls 1

getTypeMethod · 0.80

Tested by

no test coverage detected