From d6e47d5fd322cf7cb61bee94b946096ecef64abb Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 15 Jun 2007 17:36:41 +0000 Subject: ADV detector: Refactored findGameID() a bit, making it possible to use it outside the AdvancedDetector framework; also made it generate somewhat more user friendly desc for obsolete game IDs svn-id: r27424 --- common/advancedDetector.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'common/advancedDetector.cpp') diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 7d7cadbade..6b4d3f685e 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -100,25 +100,31 @@ static void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { GameDescriptor findGameID( const char *gameid, - const Common::ADParams ¶ms + const PlainGameDescriptor *list, + const Common::ADObsoleteGameID *obsoleteList ) { - const PlainGameDescriptor *g = params.list; - while (g->gameid) { - if (0 == scumm_stricmp(gameid, g->gameid)) - return GameDescriptor(*g); - g++; - } - - if (params.obsoleteList != 0) { - const Common::ADObsoleteGameID *o = params.obsoleteList; + // First search the list of supported game IDs for a match. + const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, list); + if (g) + return GameDescriptor(*g); + + // If we didn't find the gameid in the main list, check if it + // is an obsolete game id. + if (obsoleteList != 0) { + const Common::ADObsoleteGameID *o = obsoleteList; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { - return GameDescriptor(gameid, "Obsolete game ID"); + g = findPlainGameDescriptor(o->to, list); + if (g && g->description) + return GameDescriptor(gameid, "Obsolete game ID (" + Common::String(g->description) + ")"); + else + return GameDescriptor(gameid, "Obsolete game ID"); } o++; } } + // No match found return GameDescriptor(); } -- cgit v1.2.3