From 594b93fc5598b6375eb25faef898a9d3693020a3 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Mon, 21 Oct 2024 16:21:17 -0500 Subject: [PATCH] Fixed Preset Picker Date Issues Moved date and game year setting to ensure they apply after preset selection. This guarantees the correct initialization of campaign settings. --- MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java index db6a62606b..d48946b4a2 100644 --- a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java @@ -320,9 +320,6 @@ public Campaign doInBackground() throws Exception { if ((preset != null) && (preset.getGameOptions() != null)) { campaign.setGameOptions(preset.getGameOptions()); } - campaign.setLocalDate(dc.getDate()); - campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear()); - campaign.setStartingSystem((preset == null) ? null : preset.getPlanet()); // This must be after the date chooser to enable correct functionality. setVisible(false); @@ -330,7 +327,17 @@ public Campaign doInBackground() throws Exception { // Campaign Options if (isSelect && preset != null) { preset.applyContinuousToCampaign(campaign); + + // This needs to be after we've applied the preset + campaign.setLocalDate(dc.getDate()); + campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear()); + campaign.setStartingSystem(preset.getPlanet()); } else { + // This needs to be before we trigger the customize preset dialog + campaign.setLocalDate(dc.getDate()); + campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear()); + campaign.setStartingSystem((preset == null) ? null : preset.getPlanet()); + CampaignOptionsDialog optionsDialog = new CampaignOptionsDialog(dialog, getFrame(), campaign, true); optionsDialog.setLocationRelativeTo(getFrame()); optionsDialog.applyPreset(preset);