From 5006dbd932bb548b1f648a33576b22d8b5210c26 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 30 May 2007 18:39:35 +0000 Subject: AdvDetector changes: made upgradeTargetIfNecessary internal; cleanup to findGameID svn-id: r27020 --- common/advancedDetector.cpp | 19 +++++++++---------- common/advancedDetector.h | 5 +---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 84b8365584..7e53f4b921 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -69,7 +69,7 @@ GameList gameIDList(const Common::ADParams ¶ms) { return GameList(params.list); } -void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { +static void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { if (params.obsoleteList == 0) return; @@ -97,25 +97,21 @@ GameDescriptor findGameID( const PlainGameDescriptor *g = params.list; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) - return *g; + return GameDescriptor(*g); g++; } - GameDescriptor gs; - if (params.obsoleteList != 0) { const Common::ADObsoleteGameID *o = params.obsoleteList; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { - gs["gameid"] = gameid; - gs["description"] = "Obsolete game ID"; - return gs; + return GameDescriptor(gameid, "Obsolete game ID"); } o++; } - } else - return GameDescriptor(g->gameid, g->description); - return gs; + } + + return GameDescriptor(); } static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGameDescriptor *sg) { @@ -221,6 +217,9 @@ const ADGameDescription *detectBestMatchingGame( PluginError detectGameForEngineCreation( const Common::ADParams ¶ms ) { + + upgradeTargetIfNecessary(params); + Common::String gameid = ConfMan.get("gameid"); FSList fslist; diff --git a/common/advancedDetector.h b/common/advancedDetector.h index ec8249db83..82862d8ebf 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -207,9 +207,7 @@ GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms); const ADGameDescription *detectBestMatchingGame(const Common::ADParams ¶ms); // FIXME/TODO: Rename this function to something more sensible. -void upgradeTargetIfNecessary(const Common::ADParams ¶ms); - -// FIXME/TODO: Rename this function to something more sensible. +// Only used by ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); @@ -237,7 +235,6 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ assert(syst); \ assert(engine); \ - Common::AdvancedDetector::upgradeTargetIfNecessary(params); \ PluginError err = Common::AdvancedDetector::detectGameForEngineCreation(params); \ if (err == kNoError) \ *engine = factoryFunc(syst); \ -- cgit v1.2.3