diff options
author | Max Horn | 2007-06-15 17:40:59 +0000 |
---|---|---|
committer | Max Horn | 2007-06-15 17:40:59 +0000 |
commit | a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41 (patch) | |
tree | 4d07d09de24470505e9255693059d3b266cd798e /engines/scumm/detection.cpp | |
parent | 0a7bb215d9d4888c7106b41f6ca2ee46e09bca70 (diff) | |
download | scummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.tar.gz scummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.tar.bz2 scummvm-rg350-a0983ff7bbd90bc3f712d5e9da53b4fe3a09fd41.zip |
Changed SCUMM engine to use findDescriptionFromGameID, Common::ADObsoleteGameID and Common::AdvancedDetector::findGameID
svn-id: r27426
Diffstat (limited to 'engines/scumm/detection.cpp')
-rw-r--r-- | engines/scumm/detection.cpp | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index da5419c904..d8cf4556d7 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -49,17 +49,6 @@ enum { #pragma mark --- Miscellaneous --- #pragma mark - -static const char *findDescriptionFromGameID(const char *gameid) { - const PlainGameDescriptor *g = gameDescriptions; - while (g->gameid) { - if (!scumm_stricmp(g->gameid, gameid)) { - return g->description; - } - g++; - } - error("Unknown gameid '%s' encountered in findDescriptionFromGameID", gameid); -} - static int compareMD5Table(const void *a, const void *b) { const char *key = (const char *)a; const MD5Table *elem = (const MD5Table *)b; @@ -683,27 +672,7 @@ GameList Engine_SCUMM_gameIDList() { } GameDescriptor Engine_SCUMM_findGameID(const char *gameid) { - // First search the list of supported game IDs. - const PlainGameDescriptor *g = gameDescriptions; - while (g->gameid) { - if (0 == scumm_stricmp(gameid, g->gameid)) - return GameDescriptor(g->gameid, g->description); - g++; - } - - // If we didn't find the gameid in the main list, check if it - // is an obsolete game id. - GameDescriptor gs; - const ObsoleteGameID *o = obsoleteGameIDsTable; - while (o->from) { - if (0 == scumm_stricmp(gameid, o->from)) { - gs["gameid"] = gameid; - gs["description"] = "Obsolete game ID"; - return gs; - } - o++; - } - return gs; + return Common::AdvancedDetector::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable); } @@ -717,8 +686,9 @@ GameList Engine_SCUMM_detectGames(const FSList &fslist) { // In particular, they are detected as ZakTowns, which is bad. for (Common::List<DetectorResult>::iterator x = results.begin(); x != results.end(); ++x) { - GameDescriptor dg(x->game.gameid, findDescriptionFromGameID(x->game.gameid), - x->language, x->game.platform); + const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions); + assert(g); + GameDescriptor dg(x->game.gameid, g->description, x->language, x->game.platform); dg.updateDesc(x->extra); // Append additional information, if set, to the description. // Compute and set the preferred target name for this game. @@ -766,7 +736,7 @@ PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) { // We start by checking whether the specified game ID is obsolete. // If that is the case, we automatically upgrade the target to use // the correct new game ID (and platform, if specified). - for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) { + for (const Common::ADObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) { if (!scumm_stricmp(gameid, o->from)) { // Match found, perform upgrade gameid = o->to; |