[Scummvm-cvs-logs] SF.net SVN: scummvm:[42446] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Jul 13 20:47:32 CEST 2009
Revision: 42446
http://scummvm.svn.sourceforge.net/scummvm/?rev=42446&view=rev
Author: lordhoto
Date: 2009-07-13 18:47:32 +0000 (Mon, 13 Jul 2009)
Log Message:
-----------
Refactor GUI options update into a function in Common: updateGameGUIOptions.
Modified Paths:
--------------
scummvm/trunk/common/util.cpp
scummvm/trunk/common/util.h
scummvm/trunk/engines/advancedDetector.cpp
scummvm/trunk/engines/scumm/detection.cpp
Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp 2009-07-13 18:32:03 UTC (rev 42445)
+++ scummvm/trunk/common/util.cpp 2009-07-13 18:47:32 UTC (rev 42446)
@@ -24,6 +24,7 @@
#include "common/util.h"
#include "common/system.h"
+#include "common/config-manager.h"
#include "gui/debugger.h"
#include "engines/engine.h"
@@ -420,6 +421,14 @@
return res;
}
+void updateGameGUIOptions(const uint32 options) {
+ if ((options && !ConfMan.hasKey("guioptions")) ||
+ (ConfMan.hasKey("guioptions") && options != parseGameGUIOptions(ConfMan.get("guioptions")))) {
+ ConfMan.set("guioptions", getGameGUIOptionsDescription(options));
+ ConfMan.flushToDisk();
+ }
+}
+
} // End of namespace Common
Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h 2009-07-13 18:32:03 UTC (rev 42445)
+++ scummvm/trunk/common/util.h 2009-07-13 18:47:32 UTC (rev 42446)
@@ -284,6 +284,13 @@
uint32 parseGameGUIOptions(const String &str);
String getGameGUIOptionsDescription(uint32 options);
+/**
+ * Updates the GUI options of the current config manager
+ * domain, when they differ to the ones passed as
+ * parameter.
+ */
+void updateGameGUIOptions(const uint32 options);
+
} // End of namespace Common
Modified: scummvm/trunk/engines/advancedDetector.cpp
===================================================================
--- scummvm/trunk/engines/advancedDetector.cpp 2009-07-13 18:32:03 UTC (rev 42445)
+++ scummvm/trunk/engines/advancedDetector.cpp 2009-07-13 18:47:32 UTC (rev 42446)
@@ -296,14 +296,8 @@
// If the GUI options were updated, we catch this here and update them in the users config
// file transparently.
- const uint32 guiOptions = agdDesc->guioptions | params.guioptions;
+ Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions);
- if ((guiOptions && !ConfMan.hasKey("guioptions")) ||
- (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) {
- ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions));
- ConfMan.flushToDisk();
- }
-
debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str());
if (!createInstance(syst, engine, agdDesc))
return Common::kNoGameDataFoundError;
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2009-07-13 18:32:03 UTC (rev 42445)
+++ scummvm/trunk/engines/scumm/detection.cpp 2009-07-13 18:47:32 UTC (rev 42446)
@@ -884,14 +884,8 @@
// If the GUI options were updated, we catch this here and update them in the users config
// file transparently.
- const uint32 guiOptions = res.game.guioptions;
+ Common::updateGameGUIOptions(res.game.guioptions);
- if ((guiOptions && !ConfMan.hasKey("guioptions")) ||
- (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) {
- ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions));
- ConfMan.flushToDisk();
- }
-
// Finally, we have massaged the GameDescriptor to our satisfaction, and can
// instantiate the appropriate game engine. Hooray!
switch (res.game.version) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list