From 29858dadcdf4dd277995cfa83ecdeac31316df46 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 2 Apr 2006 21:28:01 +0000 Subject: Treat 'targes' like the other command line 'commands' svn-id: r21570 --- base/gameDetector.cpp | 16 +++++++--------- base/gameDetector.h | 2 +- base/main.cpp | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index e10ad0e694..30d96c49f3 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -352,8 +352,8 @@ Common::String GameDetector::parseCommandLine(Common::StringMap &settings, int a if (i != argc - 1) usage("Stray argument '%s'", s); - // We defer checking whether this is a valid target to a later point - settings["target"] = s; + // We defer checking whether this is a valid target to a later point. + return s; } else { char shortCmdLower = tolower(s[1]); @@ -537,19 +537,17 @@ unknownOption: } -void GameDetector::processSettings(Common::StringMap &settings) { +void GameDetector::processSettings(Common::String &target, Common::StringMap &settings) { // 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 (settings.contains("target")) { - String str(settings["target"]); - if (ConfMan.hasGameDomain(str) || findGame(str).gameid.size() > 0) { - setTarget(str); + if (!target.empty()) { + if (ConfMan.hasGameDomain(target) || findGame(target).gameid.size() > 0) { + setTarget(target); } else { - usage("Unrecognized game target '%s'", str.c_str()); + usage("Unrecognized game target '%s'", target.c_str()); } - settings.erase("target"); // This option should not be passed to ConfMan. } diff --git a/base/gameDetector.h b/base/gameDetector.h index 5299e3cbe5..f9234bb9c6 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -70,7 +70,7 @@ public: GameDetector(); static Common::String parseCommandLine(Common::StringMap &settings, int argc, char **argv); - void processSettings(Common::StringMap &settings); + void processSettings(Common::String &target, Common::StringMap &settings); bool detectMain(); String _targetName; diff --git a/base/main.cpp b/base/main.cpp index a15380a28c..d2856feb81 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -368,7 +368,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) { #ifndef _WIN32_WCE GameDetector detector; #endif - detector.processSettings(settings); + detector.processSettings(command, settings); #ifdef __SYMBIAN32__ // init keymap support here: we wanna move this somewhere else? -- cgit v1.2.3