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

Function isInBuiltCage

plugins/autonestbox.cpp:171–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171static bool isInBuiltCage(df::unit *unit) {
172 for (auto building : world->buildings.all) {
173 if (building->getType() == df::building_type::Cage) {
174 df::building_cagest* cage = (df::building_cagest *)building;
175 for (auto unitid : cage->assigned_units) {
176 if (unitid == unit->id)
177 return true;
178 }
179 }
180 }
181 return false;
182}
183
184// check if assigned to pen, pit, (built) cage or chain
185// note: BUILDING_CAGED is not set for animals (maybe it's used for dwarves who get caged as sentence)

Callers 1

isAssignedFunction · 0.85

Calls 1

getTypeMethod · 0.80

Tested by

no test coverage detected