don't butcher animals who have some kind of training

also use new units functions in logistics
develop
Myk Taylor 2023-08-20 10:08:42 -07:00
parent 1763a16831
commit 8e9c6c708a
No known key found for this signature in database
2 changed files with 3 additions and 7 deletions

@ -746,6 +746,7 @@ static bool isInappropriateUnit(df::unit *unit) {
static bool isProtectedUnit(df::unit *unit) {
return Units::isWar(unit) // ignore war dogs etc
|| Units::isHunter(unit) // ignore hunting dogs etc
|| Units::isMarkedForTraining(unit) // ignore units marked for any kind of training
// ignore creatures in built cages which are defined as rooms to leave zoos alone
// (TODO: better solution would be to allow some kind of slaughter cages which you can place near the butcher)
|| (isContainedInItem(unit) && isInBuiltCageRoom(unit)) // !!! see comments in isBuiltCageRoom()

@ -392,14 +392,14 @@ public:
bool is_designated(color_ostream& out, df::item* item) override {
auto unit = get_caged_unit(item);
return unit && has_training_assignment(unit);
return unit && Units::isMarkedForTraining(unit);
}
bool can_designate(color_ostream& out, df::item* item) override {
auto unit = get_caged_unit(item);
return unit && !Units::isInvader(unit) &&
Units::isTamable(unit) && !Units::isTame(unit) &&
!has_training_assignment(unit);
!Units::isMarkedForTraining(unit);
}
bool designate(color_ostream& out, df::item* item) override {
@ -424,11 +424,6 @@ private:
return NULL;
return gref->getUnit();
}
static bool has_training_assignment(df::unit* unit) {
return binsearch_index(df::global::plotinfo->equipment.training_assignments,
&df::training_assignment::animal_id, unit->id) > -1;
}
};
static const struct BadFlags {