From 6f64ee833efd4d0a9c2e41b3b4c18442cca0b51e Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Thu, 16 Nov 2023 07:48:42 -0600 Subject: [PATCH 1/3] tailor: do not process non-clothing also added a safety check --- plugins/tailor.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/tailor.cpp b/plugins/tailor.cpp index ac71749ee..920f253c0 100644 --- a/plugins/tailor.cpp +++ b/plugins/tailor.cpp @@ -277,6 +277,9 @@ public: { if (inv->mode != df::unit_inventory_item::Worn) continue; + // skip non-clothing + if (!inv->item->isClothing()) + continue; if (inv->item->getWear() > 0) worn.push_back(inv->item); else @@ -288,9 +291,17 @@ public: for (auto w : worn) { + // skip armor + if (w->getEffectiveArmorLevel() > 0) + continue; + 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; w->getItemDescription(&description, 0); From 35cd415095e3822b3b303f0968bb7a21d94dd389 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Thu, 16 Nov 2023 07:52:48 -0600 Subject: [PATCH 2/3] add cast to make gcc happy --- plugins/tailor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tailor.cpp b/plugins/tailor.cpp index 920f253c0..8dbe952b1 100644 --- a/plugins/tailor.cpp +++ b/plugins/tailor.cpp @@ -298,7 +298,7 @@ public: auto ty = w->getType(); auto makerRace = w->getMakerRace(); - if (makerRace < 0 || makerRace >= world->raws.creatures.all.size()) + if (makerRace < 0 || makerRace >= (int16_t) world->raws.creatures.all.size()) continue; int isize = world->raws.creatures.all[makerRace]->adultsize; From de19efa89b7c5d9f996d763e93fea3989686662a Mon Sep 17 00:00:00 2001 From: Myk Date: Thu, 16 Nov 2023 08:13:22 -0800 Subject: [PATCH 3/3] Update changelog.txt --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 2e7a81412..0ab406af4 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -84,6 +84,7 @@ Template for new versions: - `sort`: when filtering out already-established temples in the location assignment screen, also filter out the "No specific deity" option if a non-denominational temple has already been established - RemoteServer: continue to accept connections as long as the listening socket is valid instead of closing the socket after the first disconnect - `buildingplan`: overlay and filter editor gui now uses ctrl-d to delete the filter to avoid conflict with increasing the filter's minimum quality (shift-x) +- `tailor`: fix crash on Linux where scanned unit is wearing damaged non-clothing (e.g. a crown) ## Misc Improvements - `buildingplan`: display how many items are available on the planner panel