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

Initial pass to update MekHQ for fix 1152 on MM #3757

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,10 @@ private void processShipSearch() {
// TODO : mos zero should make ship available on retainer
if (roll >= target.getValue()) {
report.append("<br/>Search successful. ");

MechSummary ms = getUnitGenerator().generate(getFactionCode(), shipSearchType, -1,
getGameYear(), getUnitRatingMod());

if (ms == null) {
ms = getAtBConfig().findShip(shipSearchType);
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()) {
Expand All @@ -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);

Expand Down Expand Up @@ -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");
}
Expand Down
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/campaign/parts/equipment/AmmoBin.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.w3c.dom.NodeList;

import java.io.PrintWriter;
import java.util.EnumSet;
import java.util.Objects;

/**
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -235,7 +236,7 @@ protected void loadFieldsFromXmlNode(Node wn) {

// FIXME: does not take into account BombType
@Deprecated
public long getMunitionType() {
public EnumSet<AmmoType.Munitions> getMunitionType() {
return getType().getMunitionType();
}

Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/gui/dialog/SmallSVAmmoSwapDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading