Merge pull request #3081 from ab9rf/5007-tailor

tailor: fix material overrun issue
develop
Myk 2023-03-23 15:48:31 -07:00 committed by GitHub
commit db934a403f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 9 deletions

@ -37,8 +37,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `prospector`: prospector tool in fort mode is now available. embark prospect is not yet available and is disabled at this time.
## Fixes
- `tailor`: now properly discriminates between dyed and undyed cloth and no longer defaults to using adamantine
- `buildingplan`: upright spike traps are now placed extended rather than retracted
- `tailor`: now properly discriminates between dyed and undyed cloth, no longer defaults to using adamantine, and properly tracks material requirements for already queued orders
## Misc Improvements
- `stockpiles`: support applying stockpile configurations with fully enabled categories to stockpiles in worlds other than the one where the configuration was exported from

@ -1 +1 @@
Subproject commit 8b8ac2de03ab5f8e5506864a751933059abfd03e
Subproject commit 0dc8ae87746e287538be01f01dc628662e756794

@ -383,6 +383,17 @@ public:
auto sub = o->item_subtype;
int race = o->hist_figure_id;
for (auto& m : all_materials)
{
if (o->material_category.whole == m.job_material.whole)
{
supply[m] -= o->amount_left;
TRACE(cycle).print("tailor: supply of %s reduced by %d due to being required for an existing order\n",
m.name.c_str(), o->amount_left);
}
}
if (race == -1)
continue; // -1 means that the race of the worker will determine the size made; we must ignore these jobs
@ -525,6 +536,18 @@ public:
}
return ordered;
}
int do_cycle()
{
reset();
scan_clothing();
scan_materials();
scan_replacements();
create_orders();
scan_existing_orders();
return place_orders();
}
};
static std::unique_ptr<Tailor> tailor_instance;
@ -684,13 +707,7 @@ static int do_cycle(color_ostream &out) {
DEBUG(cycle,out).print("running %s cycle\n", plugin_name);
tailor_instance->reset();
tailor_instance->scan_clothing();
tailor_instance->scan_materials();
tailor_instance->scan_replacements();
tailor_instance->create_orders();
tailor_instance->scan_existing_orders();
return tailor_instance->place_orders();
return tailor_instance->do_cycle();
}
/////////////////////////////////////////////////////