[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.598,1.599

Max Horn fingolfin at users.sourceforge.net
Fri Oct 14 03:29:30 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28262

Modified Files:
	scumm.cpp 
Log Message:
Don't hardcode platform code strings

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.598
retrieving revision 1.599
diff -u -d -r1.598 -r1.599
--- scumm.cpp	14 Oct 2005 02:13:33 -0000	1.598
+++ scumm.cpp	14 Oct 2005 10:27:24 -0000	1.599
@@ -112,7 +112,7 @@
 struct ObsoleteTargets {
 	const char *from;
 	const char *to;
-	const char *platform;
+	Common::Platform platform;
 
 	GameSettings toGameSettings() const {
 		GameSettings dummy = { from, "Obsolete Target", GF_MULTIPLE_VERSIONS };
@@ -120,36 +120,44 @@
 	}
 };
 
+static const Common::Platform UNK = Common::kPlatformUnknown;
+
+/**
+ * Conversion table mapping old obsolete target names to the
+ * corresponding new target and platform combination.
+ *
+ * We use an ugly macro 'UNK' here to make the following table more readable.
+ */
 static ObsoleteTargets obsoleteTargetsTable[] = {
-	{"comidemo", "comi", NULL},
-	{"digdemo", "dig", NULL},
-	{"digdemoMac", "dig", "macintosh"},
-	{"dottdemo", "tentacle", NULL},
-	{"fate", "atlantis", NULL},
-	{"ftMac", "ft",  "macintosh"},
-	{"ftpcdemo", "ft", NULL},
-	{"ftdemo", "ft",  "macintosh"},
-	{"game", "monkey", NULL},
-	{"indy3ega", "indy3", NULL},
-	{"indy3towns", "indy3", "fmtowns"},
-	{"indy4", "atlantis", "fmtowns"},
-	{"indydemo", "atlantis", "fmtowns"},
-	{"loomcd", "loom", NULL},
-	{"loomTowns", "loom", "fmtowns"},
-	{"mi2demo", "monkey2", NULL},
-	{"monkey1", "monkey", NULL},
-	{"monkeyEGA", "monkey", NULL},
-	{"monkeyVGA", "monkey", NULL},
-	{"playfate", "atlantis", NULL},
-	{"samnmax-alt", "samnmax", NULL},
-	{"samnmaxMac", "samnmax", "macintosh"},
-	{"samdemo", "samnmax", NULL},
-	{"samdemoMac", "samnmax", "macintosh"},
-	{"snmdemo", "samnmax", NULL},
-	{"snmidemo", "samnmax", NULL},
-	{"tentacleMac", "tentacle", "macintosh"},
-	{"zakTowns", "zak", "fmtowns"},
-	{NULL, NULL, NULL}
+	{"comidemo", "comi", UNK},
+	{"digdemo", "dig", UNK},
+	{"digdemoMac", "dig", Common::kPlatformMacintosh},
+	{"dottdemo", "tentacle", UNK},
+	{"fate", "atlantis", UNK},
+	{"ftMac", "ft",  Common::kPlatformMacintosh},
+	{"ftpcdemo", "ft", UNK},
+	{"ftdemo", "ft",  Common::kPlatformMacintosh},
+	{"game", "monkey", UNK},
+	{"indy3ega", "indy3", UNK},
+	{"indy3towns", "indy3", Common::kPlatformFMTowns},
+	{"indy4", "atlantis", Common::kPlatformFMTowns},
+	{"indydemo", "atlantis", Common::kPlatformFMTowns},
+	{"loomcd", "loom", UNK},
+	{"loomTowns", "loom", Common::kPlatformFMTowns},
+	{"mi2demo", "monkey2", UNK},
+	{"monkey1", "monkey", UNK},
+	{"monkeyEGA", "monkey", UNK},
+	{"monkeyVGA", "monkey", UNK},
+	{"playfate", "atlantis", UNK},
+	{"samnmax-alt", "samnmax", UNK},
+	{"samnmaxMac", "samnmax", Common::kPlatformMacintosh},
+	{"samdemo", "samnmax", UNK},
+	{"samdemoMac", "samnmax", Common::kPlatformMacintosh},
+	{"snmdemo", "samnmax", UNK},
+	{"snmidemo", "samnmax", UNK},
+	{"tentacleMac", "tentacle", Common::kPlatformMacintosh},
+	{"zakTowns", "zak", Common::kPlatformFMTowns},
+	{NULL, NULL, UNK}
 };
 
 static const ScummGameSettings scumm_settings[] = {
@@ -3043,8 +3051,8 @@
 
 			ConfMan.set("gameid", o->to);
 
-			if (o->platform)
-				ConfMan.set("platform", o->platform);
+			if (o->platform != Common::kPlatformUnknown)
+				ConfMan.set("platform", Common::getPlatformCode(o->platform));
 
 			warning("Target upgraded from %s to %s", o->from, o->to);
 			ConfMan.flushToDisk();





More information about the Scummvm-git-logs mailing list