[Scummvm-cvs-logs] CVS: scummvm/base gameDetector.h,1.12,1.13 gameDetector.cpp,1.32,1.33

Max Horn fingolfin at users.sourceforge.net
Fri Oct 17 12:14:11 CEST 2003


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1:/tmp/cvs-serv30034/base

Modified Files:
	gameDetector.h gameDetector.cpp 
Log Message:
moved platform/language constants to common/util.*

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gameDetector.h	17 Oct 2003 12:18:58 -0000	1.12
+++ gameDetector.h	17 Oct 2003 15:35:45 -0000	1.13
@@ -38,27 +38,6 @@
 	GF_DEFAULT_TO_1X_SCALER = 1 << 31
 };
 
-/**
- * List of language ids.
- * @note The order and mappings of the values 0..8 are *required* to stay the
- * way they are now, as scripts in COMI rely on them. So don't touch them.
- */
-enum Language {
-	UNK_LANG = -1,	// Use default language (i.e. none specified)
-	EN_USA = 0,
-	DE_DEU = 1,
-	FR_FRA = 2,
-	IT_ITA = 3,
-	PT_BRA = 4,
-	ES_ESP = 5,
-	JA_JPN = 6,
-	ZH_TWN = 7,
-	KO_KOR = 8,
-	SE_SWE = 9,
-	EN_GRB = 10,
-	HB_HEB = 20
-};
-
 enum Platform {
 	kPlatformUnknown = -1,
 	kPlatformPC = 0,
@@ -115,8 +94,6 @@
 
 	static int parseGraphicsMode(const String &s);	// Used in main()
 	static int parseMusicDriver(const String &s);
-	static Language parseLanguage(const String &s);
-	static Platform parsePlatform(const String &s);
 	
 	static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);
 

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- gameDetector.cpp	17 Oct 2003 12:18:58 -0000	1.32
+++ gameDetector.cpp	17 Oct 2003 15:35:45 -0000	1.33
@@ -151,28 +151,6 @@
 	{0, 0, 0}
 };
 
-struct LanguageDescription {
-	const char *name;
-	const char *description;
-	Language id;
-};
-
-static const struct LanguageDescription languages[] = {
-	{"en", "English", EN_USA},
-	{"de", "German", DE_DEU},
-	{"fr", "French", FR_FRA},
-	{"it", "Italian", IT_ITA},
-	{"pt", "Portuguese", PT_BRA},
-	{"es", "Spanish", ES_ESP},
-	{"jp", "Japanese", JA_JPN},
-	{"zh", "Chinese (Taiwan)", ZH_TWN},
-	{"kr", "Korean", KO_KOR},
-	{"gb", "English", EN_GRB},
-	{"se", "Swedish", SE_SWE},
-	{"hb", "Hebrew", HB_HEB},
-	{0, 0, UNK_LANG}
-};
-
 GameDetector::GameDetector() {
 
 	// Graphics
@@ -365,7 +343,7 @@
 				break;
 			case 'q':
 				HANDLE_OPTION();
-				if (parseLanguage(option) == UNK_LANG)
+				if (Common::parseLanguage(option) == Common::UNK_LANG)
 					goto ShowHelpAndExit;
 				ConfMan.set("language", option);
 				break;
@@ -409,7 +387,7 @@
 				// Long options. Let the fun begin!
 				if (!strncmp(s, "platform=", 9)) {
 					s += 9;
-					int platform = parsePlatform(s);
+					int platform = Common::parsePlatform(s);
 					if (platform == kPlatformUnknown)
 						goto ShowHelpAndExit;
 
@@ -489,38 +467,6 @@
 	}
 
 	return -1;
-}
-
-Language GameDetector::parseLanguage(const String &str) {
-	if (str.isEmpty())
-		return UNK_LANG;
-
-	const char *s = str.c_str();
-	const LanguageDescription *l = languages;
-	while (l->name) {
-		if (!scumm_stricmp(l->name, s))
-			return l->id;
-		l++;
-	}
-
-	return UNK_LANG;
-}
-
-Platform GameDetector::parsePlatform(const String &str) {
-	if (str.isEmpty())
-		return kPlatformUnknown;
-
-	const char *s = str.c_str();
-	if (!scumm_stricmp(s, "pc"))
-		return kPlatformPC;
-	else if (!scumm_stricmp(s, "amiga") || !scumm_stricmp(s, "1"))
-		return kPlatformAmiga;
-	else if (!scumm_stricmp(s, "atari-st") || !scumm_stricmp(s, "atari") || !scumm_stricmp(s, "2"))
-		return kPlatformAtariST;
-	else if (!scumm_stricmp(s, "macintosh") || !scumm_stricmp(s, "mac") || !scumm_stricmp(s, "3"))
-		return kPlatformMacintosh;
-	else
-		return kPlatformUnknown;
 }
 
 int GameDetector::parseMusicDriver(const String &str) {





More information about the Scummvm-git-logs mailing list