Skip to content

Commit

Permalink
Merge pull request #4797 from Sleet01/fix_3761_update_munitions_equal…
Browse files Browse the repository at this point in the history
…ity_tests_mm

Fix MekHQ #3761: update munitions equality tests in mm
  • Loading branch information
NickAragua authored Sep 21, 2023
2 parents 027a6d3 + b418dee commit 60603a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public String getElementAt(int index) {
int totalShots = 0;
EnumSet<AmmoType.Munitions> munition = ((AmmoType) mounted.getLinked().getType()).getMunitionType();
for (Mounted current = mounted.getLinked(); current != null; current = current.getLinked()) {
if (((AmmoType) current.getType()).getMunitionType() == munition) {
if (((AmmoType) current.getType()).getMunitionType().equals(munition)) {
shotsLeft += current.getUsableShotsLeft();
totalShots += current.getOriginalShots();
}
Expand Down
4 changes: 2 additions & 2 deletions megamek/src/megamek/common/AmmoType.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public boolean isCompatibleWith(AmmoType other) {
}

// MML Launchers, ugh.
if ((is(T_MML) || other.is(T_MML)) && (getMunitionType() == other.getMunitionType())) {
if ((is(T_MML) || other.is(T_MML)) && (getMunitionType().equals(other.getMunitionType()))) {
// LRMs...
if (is(T_MML) && hasFlag(F_MML_LRM) && other.is(T_LRM)) {
return true;
Expand All @@ -424,7 +424,7 @@ public boolean isCompatibleWith(AmmoType other) {
}

// General Launchers
if (is(other.getAmmoType()) && (getMunitionType() == other.getMunitionType())) {
if (is(other.getAmmoType()) && (getMunitionType().equals(other.getMunitionType()))) {
return true;
}

Expand Down

0 comments on commit 60603a2

Please sign in to comment.