Skip to content

buildingplan: fix roller chain estimate - #5919

Open
Alistair-Afton wants to merge 1 commit into
DFHack:developfrom
Alistair-Afton:fix-roller-chain-estimate
Open

Alistair-Afton wants to merge 1 commit into
DFHack:developfrom
Alistair-Afton:fix-roller-chain-estimate

Conversation

@Alistair-Afton

Copy link
Copy Markdown
Contributor

Summary

Fixes #5778

The planner's get_quantity multiplied any positive filter quantity by the selected area's volume. For a roller that made the chain estimate scale with length (e.g. 9 chains for a 9-tile roller) when the job always needs exactly 1 chain.

Job item quantities are totals for the whole building job. Per-area scaling is only expressed by the quantity = -1 sentinel (tiles/4 + 1, used by the roller mechanism, bridge, paved road, and horizontal axle filters) and by constructions, which count placeable tiles on their own code path. The final quantity * volume fallback therefore only ever fired for the roller's chain filter; it now returns the quantity as-is.

Testing

Verified in a live fort by driving buildreq and calling the module's internals:

  • 9-tile horizontal roller (direction=1): 3 Mechanisms, 1 Chain — was 9 Chains before the fix.
  • 5x5 trade depot: 3 boulders, unchanged.
  • 3x2 wall selection on the surface: still counts only placeable tiles.

The planner multiplied positive job item quantities by the selected
area's volume, so a 9-tile roller asked for 9 chains. Job item
quantities are totals for the whole building job: rollers always need
exactly 1 chain (plus tiles/4+1 mechanisms via the quantity=-1
sentinel). Only constructions keep the per-tile count, which already
has its own path.

Fixes DFHack#5778
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.

Bug: buildingplanner roller material estimate incorrect

1 participant