Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlacePanel: Limit max based on unit requirements. #11887

Merged
merged 4 commits into from
Aug 21, 2023

Conversation

asvitkine
Copy link
Contributor

@asvitkine asvitkine commented Aug 18, 2023

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.

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 that surpass the max.
@asvitkine asvitkine marked this pull request as draft August 18, 2023 01:30
@Cernelius
Copy link
Contributor

Cernelius commented Aug 18, 2023

This can also be tested using my 270BC Wars game.

For testing it, buy 1 metropolis and 2 (or any number greater than 1 of) irregulars with Carthage and select a value 1 (or any number lower than the number of irregulars except 0) territory.

For example, if you buy 1 metropolis and 2 irregulars and then try to place on Melita, clicking "Max" prompts you to place 2 irregulars (and you cannot). For faster testing, de-use (untick) the barbarians.

@asvitkine asvitkine marked this pull request as ready for review August 21, 2023 01:03
@asvitkine asvitkine merged commit 26d7866 into triplea-game:master Aug 21, 2023
1 check passed
@Cernelius
Copy link
Contributor

I tested, and my "270BC Wars" presents the same issue as I described (nothing of it changed). I thought this would fix that issue but maybe this is not related to what at that game?

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