-
Notifications
You must be signed in to change notification settings - Fork 291
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
Infantry refactor #3944
Infantry refactor #3944
Conversation
# Conflicts: # megamek/src/megamek/common/Infantry.java
# Conflicts: # megamek/src/megamek/common/BattleArmor.java # megamek/src/megamek/common/BattleForceElement.java # megamek/src/megamek/common/Infantry.java
@@ -827,7 +827,7 @@ | |||
|
|||
String infSquadNum = entityTag.getAttribute(INF_SQUAD_NUM); | |||
if (!infSquadNum.isBlank()) { | |||
inf.setSquadN(Integer.parseInt(infSquadNum)); | |||
inf.setSquadCount(Integer.parseInt(infSquadNum)); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm ok with this for the most part. We'll definitely want to give infantry a good beating in terms of testing after we merge it.
/** | ||
* Infantry only have critical slots for field gun ammo | ||
*/ | ||
// Infantry only have critical slots for field gun ammo | ||
private static final int[] NUM_OF_SLOTS = { 20, 20 }; | ||
private static final String[] LOCATION_ABBRS = { "MEN", "FGUN" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're polishing this, can we change the "MEN" location to "troopers" or "soldiers" or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like troopers myself. But agree with the men part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done. I was afraid this would break things but at least loading a damaged CI from a MUL is compatible across this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think locations might be determined by index rather than name. Although I could be wrong, it's been more than five minutes since I last looked at a MUL file.
When there, why not improve.
Removes unnecessary comments (for overrides mostly), improves a few method and field names, makes use of methods and improves the way some things are represented in the code.
The real changes are in Infantry, the changes in the other files adapt to changed method names.
This should be merged together with the adaptations for MML and MHQ.