Skip to content

tailor: universal coverage, bug fixes - #6043

Open
ab9rf wants to merge 1 commit into
DFHack:developfrom
ab9rf:tailor-improvements
Open

ab9rf wants to merge 1 commit into
DFHack:developfrom
ab9rf:tailor-improvements

Conversation

@ab9rf

@ab9rf ab9rf commented Nov 11, 2026

Copy link
Copy Markdown
Member

tailor will now select the "best" coverage item instead of just using the first one, and will handle different body plans for oddly shaped fort members correctly

also, a bug that sometimes caused over-ordering has been fixed

tailor will now select the "best" coverage item instead of just using the first one, and will handle different body plans for oddly shaped fort members correctly

also, a bug that sometimes caused over-ordering has been fixed
Comment thread plugins/tailor.cpp
// torso part, and the worn part must be an ancestor of the target, otherwise
// no distance is reported.
static void body_step_distance(df::caste_body_info *body, int16_t worn, int16_t target,
bool *main, int16_t *ub_steps, int16_t *lb_steps)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: main/ub_steps/lb_steps should probably be references (just like in DF) so that nothing can pass NULL to them and cause a crash

Comment thread plugins/tailor.cpp
switch (ty) {
case df::item_type::ARMOR: {
auto def = world->raws.itemdefs.armor[sub];
if (!def)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If sub is out of range, def is going to be garbage rather than NULL (and could crash). Same for the others below.

Comment thread plugins/tailor.cpp
{
switch (ty) {
case df::item_type::ARMOR:
return world->raws.itemdefs.armor[sub] &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsafe subtype fetching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants