Skip to content

Commit

Permalink
Merge pull request #4031 from ab9rf/tailor-4023
Browse files Browse the repository at this point in the history
exclude nonclothing from tailor's scan
  • Loading branch information
myk002 authored Nov 16, 2023
2 parents bf128bd + de19efa commit ed9e6c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion plugins/tailor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ class Tailor {
{
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
Expand All @@ -288,9 +291,17 @@ class Tailor {

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 >= (int16_t) world->raws.creatures.all.size())
continue;

int isize = world->raws.creatures.all[makerRace]->adultsize;
std::string description;
w->getItemDescription(&description, 0);

Expand Down

0 comments on commit ed9e6c8

Please sign in to comment.