From 3a6540110bf3d27f142bce86dfa8cd326285509f Mon Sep 17 00:00:00 2001 From: phosit Date: Thu, 25 Sep 2025 19:56:27 +0200 Subject: [PATCH] Don't save matchsettings when loading a savegame When loading a savegame more settings are loaded then normally. Thous settings (such as TriggerScripts) can't be changed from the matchsetting-screen. With this commit the saved matchsettings.mp.json isn't overritten when loading a savegame. Fixes: #7632 --- .../gui/gamesetup/Controllers/GameSettingsController.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/public/gui/gamesetup/Controllers/GameSettingsController.js b/binaries/data/mods/public/gui/gamesetup/Controllers/GameSettingsController.js index cac2a5beeb..ba44c9e158 100644 --- a/binaries/data/mods/public/gui/gamesetup/Controllers/GameSettingsController.js +++ b/binaries/data/mods/public/gui/gamesetup/Controllers/GameSettingsController.js @@ -7,6 +7,7 @@ class GameSettingsController { this.setupWindow = setupWindow; this.mapCache = mapCache; + this.isSavedGame = isSavedGame; this.persistentMatchSettings = new PersistentMatchSettings(g_IsNetworked); this.guiData = new GameSettingsGuiData(); @@ -25,7 +26,7 @@ class GameSettingsController this.loadingChangeHandlers = new Set(); this.settingsLoadedHandlers = new Set(); - setupWindow.registerLoadHandler(this.onLoad.bind(this, isSavedGame)); + setupWindow.registerLoadHandler(this.onLoad.bind(this)); setupWindow.registerGetHotloadDataHandler(this.onGetHotloadData.bind(this)); setupWindow.registerClosePageHandler(this.onClose.bind(this)); @@ -75,9 +76,9 @@ class GameSettingsController this.settingsLoadedHandlers.add(handler); } - onLoad(isSavedGame, initData, hotloadData) + onLoad(initData, hotloadData) { - if (!isSavedGame) + if (!this.isSavedGame) { // This initial settings parsing in wrapped in a try-catch because it can fail unexpectedly, // and particularly could fail with mods that change persistent settings, so this is @@ -314,7 +315,7 @@ class GameSettingsController savePersistentMatchSettings() { - if (g_IsController) + if (g_IsController && !this.isSavedGame) // TODO: ought to only save a subset of settings. this.persistentMatchSettings.saveFile(this.getSettings()); }