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

Sort battles cleanup #12814

Merged
merged 6 commits into from
Aug 4, 2024
Merged

Sort battles cleanup #12814

merged 6 commits into from
Aug 4, 2024

Conversation

frigoref
Copy link
Member

@frigoref frigoref commented Aug 4, 2024

Panel "Actions" has no sorting order for battles. @DanVanAtta mentioned also that the order might change after saving and reloading a game.
This PR is cleaning up the files in order to allow a sorting. The strategy is that BattleListing is used and passed around instead of the contained map.
Also the map is now an EnumMap build in BattleListing.

  • tested save & reload game files

TripleAFrame.java
- rename variable territoryDetails to territoryDetailsPanel
- rename variable actionButtons to actionButtonsPanel
- rename variable datacopy to gameDataCopy
- fix typos e.g. savegame or gamedata

Rename class ActionButtons to ActionButtonsPanel:
- ForumPosterComponent.java
- ActionPanel.java

BattleCalculatorDialog.java
- renamed Getter TripleAFrame.java.TerritoryPanel

TripleAPlayer.java
- fix typos savegame and gamedata
- rename variable battlesite to battleTerritory

Replace typos 'savegame' with 'save game'
- ActionButtonsPanel.java
- GameSequence.java
- HeadlessGameServer.java
- IEmailSender.java
- NodeBbForumPoster.java
- ServerLauncher.java
- TripleAFrame.java
- TripleAPlayer.java
- UpdateChecks.java
BattleTracker.java
- rename variables (e.g. territory collections) with same name as member attribute
- replace Map loop over keys with over entrySet
- rework methods getPendingBattles to consistently use CollectionUtils.getMatches instead of stream()
- rework methods getPendingBattle to consistently use stream() instead of loops
- make method getPendingBattleSites(bombing) private and usages more clear with new methods getPendingBattleSitesWithBombing() and getPendingBattleSitesWithoutBombing()
- replace lambdas with method
- typo 's instead of s

replace with new method BattleTracker.getPendingBattleSitesWithoutBombing()
- BattleDelegate.java
- MoveDelegateTest.java
- MustFightBattleTest.java
- RevisedTest.java
- WW2V3Year41Test.java
- WW2V3Year42Test.java
Keep BattleListing for passing to other methods and let method/variable names indicate BattleListing

ActionButtonsPanel.java
- let method changeToBattle use BattleListing instead of battles map

BattleTracker.java
- rename method getPendingBattleSites to getBattleListingFromPendingBattles

BattlePanel.java
- rename attribute battles to battleListing
- remove isBomb variable in method addBattleActions and subsequent methods as value can be determined by other parameter (BattleType)

IBattleDelegate.java
- rename method getBattles to getBattleListing

TripleAFrame.java
- let method getBattle use BattleListing instead of battles map

Affected by renaming method (getBattles to getBattleListing; getPendingBattleSites to getBattleListingFromPendingBattles)
- AbstractAi.java
- AirThatCantLandUtilTest.java
- BattleDelegate.java
- ProSimulateTurnUtils.java
- TripleAPlayer.java
- WW2V3Year41Test.java
Move BattleListing map building from BattleTracker into BattleListing

BattleTracker
- move logic of method getBattleListingFromPendingBattles() to constructor of BattleListing

BattleListing.java
- rename attribute battles to battlesMap
- change constructor to include logic of method BattleTracker.getBattleListingFromPendingBattles()
- extract new method getBattlesWith(predicate)

Subsequent changes for Getter on BattleListing.battlesMap
- AbstractAi.java
- AirThatCantLandUtilTest.java
- ProSimulateTurnUtils.java
- WW2V3Year41Test.java
fix RemoteActionCodeTest due to renaming IBattleDelegate.getBattles to getBattleListing
- required-op-codes.csv
@frigoref frigoref merged commit ba0653d into triplea-game:master Aug 4, 2024
1 check passed
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.

1 participant