tailor: do not process non-clothing

also added a safety check
develop
Kelly Kinkade 2023-11-16 07:48:42 -06:00
parent bf128bda54
commit 6f64ee833e
1 changed files with 12 additions and 1 deletions

@ -277,6 +277,9 @@ public:
{ {
if (inv->mode != df::unit_inventory_item::Worn) if (inv->mode != df::unit_inventory_item::Worn)
continue; continue;
// skip non-clothing
if (!inv->item->isClothing())
continue;
if (inv->item->getWear() > 0) if (inv->item->getWear() > 0)
worn.push_back(inv->item); worn.push_back(inv->item);
else else
@ -288,9 +291,17 @@ public:
for (auto w : worn) for (auto w : worn)
{ {
// skip armor
if (w->getEffectiveArmorLevel() > 0)
continue;
auto ty = w->getType(); auto ty = w->getType();
int isize = world->raws.creatures.all[w->getMakerRace()]->adultsize; auto makerRace = w->getMakerRace();
if (makerRace < 0 || makerRace >= world->raws.creatures.all.size())
continue;
int isize = world->raws.creatures.all[makerRace]->adultsize;
std::string description; std::string description;
w->getItemDescription(&description, 0); w->getItemDescription(&description, 0);