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

Function isInBuiltCageRoom

plugins/autobutcher.cpp:635–648  ·  view source on GitHub ↗

built cage in a zone (supposed to detect zoo cages)

Source from the content-addressed store, hash-verified

633
634// built cage in a zone (supposed to detect zoo cages)
635static bool isInBuiltCageRoom(df::unit *unit) {
636 for (auto building : world->buildings.all) {
637 if (building->getType() != df::building_type::Cage)
638 continue;
639
640 if (!building->relations.size())
641 continue;
642
643 df::building_cagest* cage = (df::building_cagest*)building;
644 for (auto cu : cage->assigned_units)
645 if (cu == unit->id) return true;
646 }
647 return false;
648}
649
650// This can be used to identify completely inappropriate units (dead, undead, not belonging to the fort, ...)
651// that autobutcher should be ignoring.

Callers 1

isProtectedUnitFunction · 0.85

Calls 2

getTypeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected