From 7dcf8901c4645ff740e89e3c102e1b1aa9e9b943 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Tue, 14 Jan 2025 19:09:54 -0600 Subject: [PATCH] Refined scenario state handling in Stratcon Wizard Adjusted logic to ensure objective translations and scaling occur only when appropriate scenario states are active. This prevents unnecessary processing after reinforcements are committed. Cleaned up state references for improved consistency and readability. --- .../mekhq/gui/stratcon/StratconScenarioWizard.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java b/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java index 459fec2003..98c10117ce 100644 --- a/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java +++ b/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java @@ -33,7 +33,6 @@ import mekhq.campaign.stratcon.StratconCampaignState; import mekhq.campaign.stratcon.StratconRulesManager; import mekhq.campaign.stratcon.StratconScenario; -import mekhq.campaign.stratcon.StratconScenario.ScenarioState; import mekhq.campaign.stratcon.StratconTrackState; import mekhq.campaign.unit.Unit; import mekhq.gui.utilities.JScrollPaneWithSpeed; @@ -51,9 +50,8 @@ import static mekhq.campaign.stratcon.StratconRulesManager.*; import static mekhq.campaign.stratcon.StratconRulesManager.ReinforcementResultsType.DELAYED; import static mekhq.campaign.stratcon.StratconRulesManager.ReinforcementResultsType.FAILED; -import static mekhq.campaign.stratcon.StratconRulesManager.calculateReinforcementTargetNumber; -import static mekhq.campaign.stratcon.StratconRulesManager.getEligibleLeadershipUnits; -import static mekhq.campaign.stratcon.StratconRulesManager.processReinforcementDeployment; +import static mekhq.campaign.stratcon.StratconScenario.ScenarioState.PRIMARY_FORCES_COMMITTED; +import static mekhq.campaign.stratcon.StratconScenario.ScenarioState.REINFORCEMENTS_COMMITTED; import static mekhq.gui.baseComponents.MHQDialogImmersive.getSpeakerDescription; import static mekhq.gui.dialog.resupplyAndCaches.ResupplyDialogUtilities.getSpeakerIcon; import static mekhq.utilities.ImageUtilities.scaleImageIconToWidth; @@ -851,7 +849,7 @@ private void btnCommitClicked(ActionEvent evt, @Nullable Integer reinforcementTa // go through all the force lists and add the selected forces to the scenario for (String templateID : availableForceLists.keySet()) { for (Force force : availableForceLists.get(templateID).getSelectedValuesList()) { - if (currentScenario.getCurrentState() == ScenarioState.PRIMARY_FORCES_COMMITTED) { + if (currentScenario.getCurrentState() == PRIMARY_FORCES_COMMITTED) { ReinforcementEligibilityType reinforcementType = getReinforcementType( force.getId(), currentTrackState, campaign, currentCampaignState); @@ -904,8 +902,10 @@ private void btnCommitClicked(ActionEvent evt, @Nullable Integer reinforcementTa currentScenario.updateMinefieldCount(Minefield.TYPE_CONVENTIONAL, getNumMinefields()); - translateTemplateObjectives(currentScenario.getBackingScenario(), campaign); - scaleObjectiveTimeLimits(currentScenario.getBackingScenario(), campaign); + if (currentScenario.getCurrentState().ordinal() < REINFORCEMENTS_COMMITTED.ordinal()) { + translateTemplateObjectives(currentScenario.getBackingScenario(), campaign); + scaleObjectiveTimeLimits(currentScenario.getBackingScenario(), campaign); + } this.getParent().repaint();