PlacePanel: Limit max based on unit requirements. #11887
Merged
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.
Change Summary & Additional Notes
This change caps the max for each unit type in the place panel to the max that can be placed for that type when considering "units which require units" logic (i.e. factory types).
This partially prevents the error "Cannot place more units which require units, than production capacity of territories with the required units" after making the selection in the place panel.
Note: That error can still happen when selecting multiple units of different types where their total surpasses the max.
Tested on 1941 Global Command Decision by purchasing a bunker and some infantry and confirming that the place panel limits number of infantry to be placed to the amount that won't give the error (as opposed to that amount + 1, due to the bunker).
Release Note
CHANGE|Place dialog will now show the correct limit for a unit type to be placed on maps using canProduceXUnits and requiresUnits properties.