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

Refactored Strategic Formations #5268

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

IllianiCBT
Copy link
Collaborator

This PR does a bunch of refactoring for the new Strategic Formations system. It bolsters existing methods with a few extra calls and integrates better across MHQ. This includes self-sanitizing methods and a centralized way to review the TO&E to ensure it's always up-to-date. A number of bugs have been resolved and the general user experience has been improved.

Revised the strategic formation handling within the campaign code by introducing a centralized recalculation method to improve efficiency and consistency. Removed redundant checks and added sanitization for ineligible formations to maintain data integrity. This change also improved the logic for interacting with strategic formations, reducing duplicated code and enhancing readability.
Revised the `recalculateStrategicFormations` method to improve clarity and efficiency by adding separate sub-force calculations. Updated campaign processing to ensure strategic formation status is recalculated consistently. Integrated logging for better traceability of strategic formation eligibility and status updates.
@IllianiCBT IllianiCBT self-assigned this Dec 1, 2024
Revised the method for recalculating strategic formations to optimize the handling of existing and new formations within a campaign. The update includes checking the eligibility of formations and adjusting the strategy status dynamically. Additionally, a method was added to remove non-eligible formations from the campaign's strategic structures.
Replaced several method names for better clarity and consistency, such as changing `importStrategicFormation` to `addStrategicFormation`. Updated calls to fetch and manipulate strategic formations with new methods, improving code readability and maintainability.
* @return the sanitized {@link Hashtable} of {@link StrategicFormation} objects stored in the
* current campaign.
*/
public Hashtable<Integer, StrategicFormation> getStrategicFormationsTable() {

Check notice

Code scanning / CodeQL

Exposing internal representation Note

getStrategicFormationsTable exposes the internal representation stored in field strategicFormations. The value may be modified
after this call to getStrategicFormationsTable
.
@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.47%. Comparing base (d1b53f6) to head (cd4bc9b).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5268   +/-   ##
=========================================
  Coverage     10.47%   10.47%           
- Complexity     6039     6044    +5     
=========================================
  Files           959      959           
  Lines        135067   135115   +48     
  Branches      19650    19657    +7     
=========================================
+ Hits          14147    14154    +7     
- Misses       119569   119612   +43     
+ Partials       1351     1349    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HammerGS HammerGS merged commit ba67042 into MegaMek:master Dec 2, 2024
4 checks 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.

4 participants