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

Corrected Weight Class Initialization of Artillery Units #5701

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Jan 8, 2025

  • Scenario generation was treated artillery formations as if they did not use weight classes, resulting in generation failing due to an illegal weight class of -1.
  • Changed artillery formations to now be treated like any other formation, allowing for unit substitution in instances where generation fails.
  • Changed generation failure messaging to cite weight class integer, not name. This means that if we ever try passing an illegal weight class we will be able to see exactly what was passed, rather than getting an IllegalArgumentException

Fix #5694

Replaced the verbose `EntityWeightClass.getClassName` method with a direct call to `getWeightClass`. This change reduces unnecessary complexity in log messages for better readability and maintainability.
Replaced repeated method call with a boolean variable to improve code readability and maintainability. Consolidated logic in the weight class condition, reducing redundancy and improving clarity.
@IllianiCBT IllianiCBT added Bug AtB StratCon Bugs relating strictly to StratCon labels Jan 8, 2025
@IllianiCBT IllianiCBT self-assigned this Jan 8, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.03%. Comparing base (4cf3be1) to head (4ba3832).
Report is 79 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5701   +/-   ##
=========================================
  Coverage     10.02%   10.03%           
- Complexity     6068     6071    +3     
=========================================
  Files          1074     1074           
  Lines        141641   141640    -1     
  Branches      20645    20643    -2     
=========================================
+ Hits          14206    14209    +3     
+ Misses       126063   126058    -5     
- Partials       1372     1373    +1     

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

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Sleet01 Sleet01 merged commit a3e9d09 into MegaMek:master Jan 9, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AtB Bug StratCon Bugs relating strictly to StratCon
Projects
None yet
3 participants