check if assigned to pen, pit, (built) cage or chain note: BUILDING_CAGED is not set for animals (maybe it's used for dwarves who get caged as sentence) animals in cages (no matter if built or on stockpile) get the ref CONTAINED_IN_ITEM instead removing them from cages on stockpiles is no problem even without clearing the ref and usually it will be desired behavior to do so.
| 187 | // removing them from cages on stockpiles is no problem even without clearing the ref |
| 188 | // and usually it will be desired behavior to do so. |
| 189 | static bool isAssigned(df::unit *unit) { |
| 190 | for (auto ref : unit->general_refs) { |
| 191 | auto rtype = ref->getType(); |
| 192 | if(rtype == df::general_ref_type::BUILDING_CIVZONE_ASSIGNED |
| 193 | || rtype == df::general_ref_type::BUILDING_CAGED |
| 194 | || rtype == df::general_ref_type::BUILDING_CHAIN |
| 195 | || (rtype == df::general_ref_type::CONTAINED_IN_ITEM && isInBuiltCage(unit))) { |
| 196 | return true; |
| 197 | } |
| 198 | } |
| 199 | return false; |
| 200 | } |
| 201 | |
| 202 | static bool unlikely_to_revert_to_wild(df::unit *unit) { |
| 203 | if (Units::isDomesticated(unit)) |
no test coverage detected