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

Armor rework, part 1b #5116

Merged
merged 10 commits into from
Feb 4, 2024
Merged

Armor rework, part 1b #5116

merged 10 commits into from
Feb 4, 2024

Conversation

neoancient
Copy link
Member

Continuation of #5101.
Removes armor names array from EquipmentType.
Moves armor cost calculations from EquipmentType to ArmorType.
Splits protomech armor from standard armor due to differences in cost.

@@ -47,11 +47,11 @@
if (aero.hasPatchworkArmor()) {
int armorcost = 0;
for (int loc = 0; loc < aero.locations(); loc++) {
armorcost += aero.getArmorWeight(loc) * EquipmentType.getArmorCost(aero.getArmorType(loc));
armorcost += aero.getArmorWeight(loc) * ArmorType.forEntity(aero, loc).getCost();

Check failure

Code scanning / CodeQL

Implicit narrowing conversion in compound assignment High

Implicit cast of source type double to narrower destination type int.
@@ -57,11 +57,11 @@
if (fighter.hasPatchworkArmor()) {
int armorcost = 0;
for (int loc = 0; loc < fighter.locations(); loc++) {
armorcost += fighter.getArmorWeight(loc) * EquipmentType.getArmorCost(fighter.getArmorType(loc));
armorcost += fighter.getArmorWeight(loc) * ArmorType.forEntity(fighter, loc).getCost();

Check failure

Code scanning / CodeQL

Implicit narrowing conversion in compound assignment High

Implicit cast of source type double to narrower destination type int.
Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

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

Just one question, more likely for my own education than anything else.

@@ -293,7 +307,7 @@ private static ArmorType createClanFerroFibrous() {
armor.setInternalName("Clan Ferro-Fibrous");
armor.addLookupName("Clan Ferro-Fibrous Armor");
armor.addLookupName("Clan Ferro Fibre");
armor.tonnage = TONNAGE_VARIABLE;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we're removing setting the tonnage?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not used. Armor tonnage is determined by the number of points of armor on the unit and calculated by points per ton or weight per point depending on unit type.

@HammerGS HammerGS merged commit 832ca16 into master Feb 4, 2024
1 of 4 checks passed
HammerGS added a commit that referenced this pull request Feb 4, 2024
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.

3 participants