Skip to content

Commit

Permalink
Merge pull request MegaMek#5865 from IllianiCBT/toe_updateOnRemoval
Browse files Browse the repository at this point in the history
Fixed Force Updates after Removal in `TOEMouseAdapter`
  • Loading branch information
IllianiCBT authored Jan 23, 2025
2 parents ce2661e + a94364f commit 0381893
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
import mekhq.campaign.mission.Scenario;
import mekhq.campaign.personnel.Person;
import mekhq.campaign.personnel.enums.PersonnelRole;
import mekhq.campaign.unit.*;
import mekhq.campaign.unit.HangarSorter;
import mekhq.campaign.unit.Unit;
import mekhq.campaign.universe.Faction;
import mekhq.gui.CampaignGUI;
import mekhq.gui.baseComponents.JScrollableMenu;
Expand Down Expand Up @@ -510,6 +511,12 @@ public void actionPerformed(ActionEvent action) {
gui.getCampaign().removeForce(force);
}
}

// We cycle through all forces because we need to assess how the removal affected them,
// Even for truly huge campaigns this is still very cheap.
for (Force force : forces) {
MekHQ.triggerEvent(new OrganizationChangedEvent(gui.getCampaign(), force));
}
} else if (command.contains(TOEMouseAdapter.REMOVE_LANCE_TECH)) {
if (null != singleForce && singleForce.getTechID() != null) {
Person oldTech = gui.getCampaign().getPerson(singleForce.getTechID());
Expand Down

0 comments on commit 0381893

Please sign in to comment.