buildingplan: fix roller chain estimate - #5919
Open
Alistair-Afton wants to merge 1 commit into
Open
Alistair-Afton wants to merge 1 commit into
Alistair-Afton wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5778
The planner's
get_quantitymultiplied 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 = -1sentinel (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 finalquantity * volumefallback 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
buildreqand calling the module's internals:3 Mechanisms, 1 Chain— was9 Chainsbefore the fix.3boulders, unchanged.