From 1443a2721c77e4336dd894e66a377950b4f23273 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 5 Jul 2010 20:10:56 +0000 Subject: [PATCH] Fix update of GUI options, which only differ in the language setting. svn-id: r50706 --- common/util.cpp | 11 +++++++---- common/util.h | 2 +- engines/advancedDetector.cpp | 2 +- engines/scumm/detection.cpp | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common/util.cpp b/common/util.cpp index 7e1282773df..521a12e4c7a 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -365,12 +365,15 @@ const String getGameGUIOptionsDescription(uint32 options) { return res; } -void updateGameGUIOptions(const uint32 options) { +void updateGameGUIOptions(const uint32 options, const String &langOption) { + const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption; + if ((options && !ConfMan.hasKey("guioptions")) || - (ConfMan.hasKey("guioptions") && options != parseGameGUIOptions(ConfMan.get("guioptions")))) { - ConfMan.set("guioptions", getGameGUIOptionsDescription(options)); + (ConfMan.hasKey("guioptions") && ConfMan.get("guioptions") != newOptionString)) { + ConfMan.set("guioptions", newOptionString); ConfMan.flushToDisk(); } } -} // End of namespace Common +} // End of namespace Common + diff --git a/common/util.h b/common/util.h index 823788ca04f..7a9cf4fb2d4 100644 --- a/common/util.h +++ b/common/util.h @@ -240,7 +240,7 @@ const String getGameGUIOptionsDescriptionLanguage(Language lang); * domain, when they differ to the ones passed as * parameter. */ -void updateGameGUIOptions(const uint32 options); +void updateGameGUIOptions(const uint32 options, const String &langOption); } // End of namespace Common diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 974970ff0f8..315763a6da7 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -306,7 +306,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) // If the GUI options were updated, we catch this here and update them in the users config // file transparently. - Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions); + Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions, getGameGUIOptionsDescriptionLanguage(agdDesc->language)); debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); if (!createInstance(syst, engine, agdDesc)) diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 407b139c7ea..c3a91200930 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -1024,7 +1024,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co // If the GUI options were updated, we catch this here and update them in the users config // file transparently. - Common::updateGameGUIOptions(res.game.guioptions); + Common::updateGameGUIOptions(res.game.guioptions, getGameGUIOptionsDescriptionLanguage(res.language)); // Finally, we have massaged the GameDescriptor to our satisfaction, and can // instantiate the appropriate game engine. Hooray!