[Scummvm-cvs-logs] SF.net SVN: scummvm: [27426] scummvm/trunk/engines/scumm
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Jun 15 19:40:59 CEST 2007
Revision: 27426
http://scummvm.svn.sourceforge.net/scummvm/?rev=27426&view=rev
Author: fingolfin
Date: 2007-06-15 10:40:59 -0700 (Fri, 15 Jun 2007)
Log Message:
-----------
Changed SCUMM engine to use findDescriptionFromGameID, Common::ADObsoleteGameID and Common::AdvancedDetector::findGameID
Modified Paths:
--------------
scummvm/trunk/engines/scumm/detection.cpp
scummvm/trunk/engines/scumm/detection_tables.h
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2007-06-15 17:37:28 UTC (rev 27425)
+++ scummvm/trunk/engines/scumm/detection.cpp 2007-06-15 17:40:59 UTC (rev 27426)
@@ -49,17 +49,6 @@
#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 @@
}
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 @@
// 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 @@
// 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;
Modified: scummvm/trunk/engines/scumm/detection_tables.h
===================================================================
--- scummvm/trunk/engines/scumm/detection_tables.h 2007-06-15 17:37:28 UTC (rev 27425)
+++ scummvm/trunk/engines/scumm/detection_tables.h 2007-06-15 17:40:59 UTC (rev 27426)
@@ -28,6 +28,7 @@
#include "common/stdafx.h"
+#include "common/advancedDetector.h"
#include "common/rect.h"
#include "common/util.h"
@@ -49,12 +50,6 @@
#pragma mark --- Data types & constants ---
#pragma mark -
-struct ObsoleteGameID {
- const char *from;
- const char *to;
- Common::Platform platform;
-};
-
#define UNK Common::kPlatformUnknown
#pragma mark -
@@ -146,7 +141,7 @@
* Conversion table mapping old obsolete game IDs to the
* corresponding new game ID and platform combination.
*/
-static const ObsoleteGameID obsoleteGameIDsTable[] = {
+static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = {
{"bluesabctimedemo", "bluesabctime", UNK},
{"BluesBirthdayDemo", "BluesBirthday", UNK},
{"comidemo", "comi", UNK},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list