From f34aeea9601fcdb422cef67464b6410379ecfbc3 Mon Sep 17 00:00:00 2001 From: Pawel Kolodziejski Date: Wed, 27 May 2009 10:03:49 +0000 Subject: [PATCH] added default game id for config file support: 'gameid' in 'residual' section --- base/commandLine.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/base/commandLine.cpp b/base/commandLine.cpp index e72b62b6cb9..8a005578969 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -417,13 +417,15 @@ bool processSettings(Common::String &command, Common::StringMap &settings) { #endif // DISABLE_COMMAND_LINE + Common::String gameId; + if (command.empty()) + gameId = ConfMan.get("gameid", Common::ConfigManager::kApplicationDomain); + else + gameId = command; - // If a target was specified, check whether there is either a game - // domain (i.e. a target) matching this argument, or alternatively - // whether there is a gameid matching that name. - if (!command.empty()) { - GameDescriptor gd = EngineMan.findGame(command); - if (ConfMan.hasGameDomain(command) || !gd.gameid().empty()) { + if (!gameId.empty()) { + GameDescriptor gd = EngineMan.findGame(gameId); + if (ConfMan.hasGameDomain(gameId) || !gd.gameid().empty()) { bool idCameFromCommandLine = false; // WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching @@ -432,11 +434,11 @@ bool processSettings(Common::String &command, Common::StringMap &settings) { // We designate gameids which come strictly from command line // so AdvancedDetector will not save config file with invalid // gameid in case target autoupgrade was performed - if (!ConfMan.hasGameDomain(command)) { + if (!ConfMan.hasGameDomain(gameId)) { idCameFromCommandLine = true; } - ConfMan.setActiveDomain(command); + ConfMan.setActiveDomain(gameId); if (idCameFromCommandLine) ConfMan.set("id_came_from_command_line", "1");