Skip to content

Commit

Permalink
Issue MegaMek 6288: When resetting pilot check campaign settings for …
Browse files Browse the repository at this point in the history
…edge/SPA properly
  • Loading branch information
psikomonkie committed Dec 21, 2024
1 parent 7cbd5e5 commit 8c13697
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions MekHQ/src/mekhq/campaign/unit/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,9 @@ public void resetPilotAndEntity() {
// Clear any stale game data that may somehow have gotten set incorrectly
getCampaign().clearGameData(entity);
// Set up SPAs, Implants, Edge, etc
if (getCampaign().getCampaignOptions().isUseAbilities()) {
if (getCampaign().getCampaignOptions().isUseAbilities()
|| getCampaign().getCampaignOptions().isUseEdge()
|| getCampaign().getCampaignOptions().isUseImplants()) {
PilotOptions options = new PilotOptions(); // MegaMek-style as it is sent to MegaMek
// This double enumeration is annoying to work with for crew-served units.
// Get the option names while we enumerate so they can be used later
Expand All @@ -3776,9 +3778,14 @@ public void resetPilotAndEntity() {
IOptionGroup group = i.nextElement();
for (Enumeration<IOption> j = group.getOptions(); j.hasMoreElements();) {
IOption option = j.nextElement();
if (group.getKey().equals(PersonnelOptions.MD_ADVANTAGES)) {
if (getCampaign().getCampaignOptions().isUseImplants()
&& group.getKey().equals(PersonnelOptions.MD_ADVANTAGES)) {
cyberOptionNames.add(option.getName());
} else {
} else if (getCampaign().getCampaignOptions().isUseEdge()
&& group.getKey().equals(PersonnelOptions.EDGE_ADVANTAGES)) {
optionNames.add(option.getName());
} else if(getCampaign().getCampaignOptions().isUseAbilities()
&& !group.getKey().equals(PersonnelOptions.EDGE_ADVANTAGES)) {
optionNames.add(option.getName());
}
}
Expand Down

0 comments on commit 8c13697

Please sign in to comment.