This can be used to identify protected units that should be counted towards fort totals, but not scheduled for butchering. This way they count towards target quota, so if you order that you want 1 female adult cat and have 2 cats, one of them being a pet, the other gets butchered
| 662 | // for butchering. This way they count towards target quota, so if you order that you want 1 female adult cat |
| 663 | // and have 2 cats, one of them being a pet, the other gets butchered |
| 664 | static bool isProtectedUnit(df::unit *unit) { |
| 665 | return Units::isWar(unit) // ignore war dogs etc |
| 666 | || Units::isHunter(unit) // ignore hunting dogs etc |
| 667 | || Units::isMarkedForWarTraining(unit) // ignore units marked for any kind of training |
| 668 | || Units::isMarkedForHuntTraining(unit) |
| 669 | || unit->flags1.bits.chained // ignore chained animals |
| 670 | // ignore creatures in built cages which are members of zones to leave zoos alone |
| 671 | // (TODO: better solution would be to allow some kind of slaughter cages which you can place near the butcher) |
| 672 | || (isContainedInItem(unit) && isInBuiltCageRoom(unit)) |
| 673 | || (unit->pregnancy_timer != 0) // do not butcher pregnant animals (which includes brooding female egglayers) |
| 674 | || Units::isAvailableForAdoption(unit) |
| 675 | || unit->name.has_name |
| 676 | || !unit->name.nickname.empty(); |
| 677 | } |
| 678 | |
| 679 | static void autobutcher_cycle(color_ostream &out) { |
| 680 | // mark that we have recently run |
no test coverage detected