diff --git a/MekHQ/src/mekhq/campaign/Campaign.java b/MekHQ/src/mekhq/campaign/Campaign.java index 8ffd980826..f387ce91ed 100644 --- a/MekHQ/src/mekhq/campaign/Campaign.java +++ b/MekHQ/src/mekhq/campaign/Campaign.java @@ -612,10 +612,10 @@ private void processShipSearch() { // TODO : mos zero should make ship available on retainer if (roll >= target.getValue()) { report.append("
Search successful. "); - + MechSummary ms = getUnitGenerator().generate(getFactionCode(), shipSearchType, -1, getGameYear(), getUnitRatingMod()); - + if (ms == null) { ms = getAtBConfig().findShip(shipSearchType); } @@ -2340,7 +2340,7 @@ && acquireEquipment(shoppingItem, person, system, transitTime)) { continue; } } - + // if we didn't find everything on this planet, then add to the remaining list if (shoppingItem.getQuantity() > 0 || shoppingItem.getDaysToWait() > 0) { // if we can't afford it, then don't keep searching for it on other planets @@ -2422,11 +2422,11 @@ public boolean canPayFor(IAcquisitionWork acquisition) { */ public PartAcquisitionResult findContactForAcquisition(IAcquisitionWork acquisition, Person person, PlanetarySystem system) { TargetRoll target = getTargetForAcquisition(acquisition, person); - + String impossibleSentencePrefix = person == null ? "Can't search for " : person.getFullName() + " can't search for "; String failedSentencePrefix = person == null ? "No contacts available for " : person.getFullName() + " is unable to find contacts for "; String succeededSentencePrefix = person == null ? "Possible contact for " : person.getFullName() + " has found a contact for "; - + // if it's already impossible, don't bother with the rest if (target.getValue() == TargetRoll.IMPOSSIBLE) { if (getCampaignOptions().isPlanetAcquisitionVerbose()) { @@ -2435,7 +2435,7 @@ public PartAcquisitionResult findContactForAcquisition(IAcquisitionWork acquisit } return PartAcquisitionResult.PartInherentFailure; } - + target = system.getPrimaryPlanet().getAcquisitionMods(target, getLocalDate(), getCampaignOptions(), getFaction(), acquisition.getTechBase() == Part.T_CLAN); @@ -5081,7 +5081,8 @@ public TargetRoll getTargetForAcquisition(final IAcquisitionWork acquisition, partAvailabilityLog.append(";(gauss ammo): -1"); break; } - if (((megamek.common.AmmoType) et).getMunitionType() == megamek.common.AmmoType.M_STANDARD) { + if (EnumSet.of(AmmoType.Munitions.M_STANDARD).containsAll( + ((megamek.common.AmmoType) et).getMunitionType())){ partAvailability--; partAvailabilityLog.append(";(standard ammo): -1"); } diff --git a/MekHQ/src/mekhq/campaign/parts/equipment/AmmoBin.java b/MekHQ/src/mekhq/campaign/parts/equipment/AmmoBin.java index 5734539e6d..48aabb6a29 100644 --- a/MekHQ/src/mekhq/campaign/parts/equipment/AmmoBin.java +++ b/MekHQ/src/mekhq/campaign/parts/equipment/AmmoBin.java @@ -38,6 +38,7 @@ import org.w3c.dom.NodeList; import java.io.PrintWriter; +import java.util.EnumSet; import java.util.Objects; /** @@ -117,7 +118,7 @@ public int getFullShots() { if (unit.getEntity() instanceof Protomech) { // If protomechs are using alternate munitions then cut in half - if (getType().getMunitionType() != AmmoType.M_STANDARD) { + if (!EnumSet.of(AmmoType.Munitions.M_STANDARD).containsAll(getType().getMunitionType())){ fullShots = fullShots / 2; } } @@ -235,7 +236,7 @@ protected void loadFieldsFromXmlNode(Node wn) { // FIXME: does not take into account BombType @Deprecated - public long getMunitionType() { + public EnumSet getMunitionType() { return getType().getMunitionType(); } diff --git a/MekHQ/src/mekhq/gui/dialog/SmallSVAmmoSwapDialog.java b/MekHQ/src/mekhq/gui/dialog/SmallSVAmmoSwapDialog.java index 8a1847e872..4e4c57f4b3 100644 --- a/MekHQ/src/mekhq/gui/dialog/SmallSVAmmoSwapDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/SmallSVAmmoSwapDialog.java @@ -55,7 +55,7 @@ public SmallSVAmmoSwapDialog(final JFrame frame, final Unit unit) { // from there. for (Part part : unit.getParts()) { if ((part instanceof InfantryAmmoBin) - && (((InfantryAmmoBin) part).getType().getMunitionType() == AmmoType.M_INFERNO)) { + && (((InfantryAmmoBin) part).getType().getMunitionType().contains(AmmoType.Munitions.M_INFERNO))) { WeaponRow row = new WeaponRow((InfantryAmmoBin) part); rows.add(row); panMain.add(row);