| 169 | } |
| 170 | |
| 171 | static 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) |