[Scummvm-cvs-logs] SF.net SVN: scummvm: [21150] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Mar 8 18:54:13 CET 2006


Revision: 21150
Author:   fingolfin
Date:     2006-03-08 18:52:51 -0800 (Wed, 08 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21150&view=rev

Log Message:
-----------
- Renamed GameSettings to PlainGameDescriptor
- Added new GameDescriptor struct (similar to PlainGameDescriptor but with
  Common::String members instead of const char * ones)
- Changed DetectedGame to subclass GameDescriptor
- Removed toGameSettings() in favor of new (template) constructors in
  DetectedGame and GameDescriptor
- Fixed a bug in the obsolete gameid handling in the SCUMM & SIMON engines

Modified Paths:
--------------
    scummvm/trunk/base/gameDetector.cpp
    scummvm/trunk/base/gameDetector.h
    scummvm/trunk/base/main.cpp
    scummvm/trunk/base/plugins.cpp
    scummvm/trunk/base/plugins.h
    scummvm/trunk/engines/cine/cine.cpp
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/lure/lure.cpp
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/sky/sky.cpp
    scummvm/trunk/engines/sword1/sword1.cpp
    scummvm/trunk/engines/sword2/sword2.cpp
    scummvm/trunk/gui/launcher.cpp
Modified: scummvm/trunk/base/gameDetector.cpp
===================================================================
--- scummvm/trunk/base/gameDetector.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/base/gameDetector.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -239,7 +239,7 @@
 	for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		GameList list = (*iter)->getSupportedGames();
 		for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
-			printf("%-20s %s\n", v->gameid, v->description);
+			printf("%-20s %s\n", v->gameid.c_str(), v->description.c_str());
 		}
 	}
 }
@@ -262,8 +262,8 @@
 			// to find the proper desc. In fact, the platform probably should
 			// be taken into account, too.
 			String gameid(name);
-			GameSettings g = GameDetector::findGame(gameid);
-			if (g.description)
+			GameDescriptor g = GameDetector::findGame(gameid);
+			if (g.description.size() > 0)
 				description = g.description;
 		}
 
@@ -271,15 +271,15 @@
 	}
 }
 
-GameSettings GameDetector::findGame(const String &gameName, const Plugin **plugin) {
-	// Find the GameSettings for this target
+GameDescriptor GameDetector::findGame(const String &gameName, const Plugin **plugin) {
+	// Find the GameDescriptor for this target
 	const PluginList &plugins = PluginManager::instance().getPlugins();
-	GameSettings result = {NULL, NULL};
+	GameDescriptor result;
 
 	PluginList::const_iterator iter = plugins.begin();
 	for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		result = (*iter)->findGame(gameName.c_str());
-		if (result.gameid) {
+		if (result.gameid.size() > 0) {
 			if (plugin)
 				*plugin = *iter;
 			break;
@@ -384,7 +384,7 @@
 			// To verify this, check if there is either a game domain (i.e.
 			// a configured target) matching this argument, or if we can
 			// find any target with that name.
-			if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s).gameid)) {
+			if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s).gameid.size() > 0)) {
 				setTarget(s);
 			} else {
 				if (current_option == NULL)
@@ -641,15 +641,15 @@
 		_gameid = _targetName;
 
 	printf("Looking for %s\n", _gameid.c_str());
-	GameSettings game = findGame(_gameid, &_plugin);
+	GameDescriptor game = findGame(_gameid, &_plugin);
 
-	if (!game.gameid) {
+	if (game.gameid.size() == 0) {
 		printf("Failed game detection\n");
 		warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str());
 		return false;
 	}
 
-	printf("Trying to start game '%s'\n", game.description);
+	printf("Trying to start game '%s'\n", game.description.c_str());
 
 	String gameDataPath(ConfMan.get("path"));
 	if (gameDataPath.isEmpty()) {

Modified: scummvm/trunk/base/gameDetector.h
===================================================================
--- scummvm/trunk/base/gameDetector.h	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/base/gameDetector.h	2006-03-09 02:52:51 UTC (rev 21150)
@@ -34,27 +34,34 @@
 	class Mixer;
 }
 
-struct GameSettings {
+struct PlainGameDescriptor {
 	const char *gameid;
 	const char *description;	// TODO: Rename this to "title" or so
 };
 
-/**
- * This template function allows to easily convert structs that mimic GameSettings
- * to a GameSettings instance.
- *
- * Normally, one would just subclass GameSettings to get this effect much easier.
- * However, subclassing a struct turns it into a non-POD type. One of the
- * consequences is that you can't have inline intialized arrays of that type.
- * But we heavily rely on those, hence we can't subclass GameSettings...
- */
-template <class T>
-GameSettings toGameSettings(const T &g) {
-	GameSettings dummy = { g.gameid, g.description };
-	return dummy;
-}
+struct GameDescriptor {
+	Common::String gameid;
+	Common::String description;	// TODO: Rename this to "title" or so
+	
+	GameDescriptor() {}
+	GameDescriptor(Common::String g, Common::String d) :
+		gameid(g), description(d) {}
 
+	/**
+	 * This template constructor allows to easily convert structs that mimic GameDescriptor
+	 * to a GameDescriptor instance.
+	 *
+	 * Normally, one would just subclass GameDescriptor to get this effect much easier.
+	 * However, subclassing a struct turns it into a non-POD type. One of the
+	 * consequences is that you can't have inline intialized arrays of that type.
+	 * But we heavily rely on those, hence we can't subclass GameDescriptor...
+	 */
+	template <class T>
+	GameDescriptor(const T &g) :
+		gameid(g.gameid), description(g.description) {}
+};
 
+
 class GameDetector {
 	typedef Common::String String;
 
@@ -78,7 +85,7 @@
 
 	static Audio::Mixer *createMixer();
 
-	static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);
+	static GameDescriptor findGame(const String &gameName, const Plugin **plugin = NULL);
 
 //protected:
 	void setTarget(const String &name);	// TODO: This should be protected

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/base/main.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -291,8 +291,8 @@
 	// Set the window caption to the game name
 	Common::String caption(ConfMan.get("description", detector._targetName));
 
-	const char *desc = GameDetector::findGame(detector._gameid).description;
-	if (caption.isEmpty() && desc)
+	Common::String desc = GameDetector::findGame(detector._gameid).description;
+	if (caption.isEmpty() && !desc.isEmpty())
 		caption = desc;
 	if (caption.isEmpty())
 		caption = detector._targetName;

Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/base/plugins.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -32,7 +32,7 @@
 typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
 
 typedef const char *(*NameFunc)();
-typedef GameSettings (*GameIDQueryFunc)(const char *gameid);
+typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
 typedef GameList (*GameIDListFunc)();
 typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
 
@@ -93,7 +93,7 @@
 
 	GameList getSupportedGames() const { return _plugin->_games; }
 
-	GameSettings findGame(const char *gameid) const {
+	GameDescriptor findGame(const char *gameid) const {
 		assert(_plugin->_qf);
 		return (*_plugin->_qf)(gameid);
 	}
@@ -134,7 +134,7 @@
 
 	GameList getSupportedGames() const { return _games; }
 
-	GameSettings findGame(const char *gameid) const {
+	GameDescriptor findGame(const char *gameid) const {
 		assert(_qf);
 		return (*_qf)(gameid);
 	}

Modified: scummvm/trunk/base/plugins.h
===================================================================
--- scummvm/trunk/base/plugins.h	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/base/plugins.h	2006-03-09 02:52:51 UTC (rev 21150)
@@ -27,7 +27,7 @@
 #include "common/array.h"
 #include "common/singleton.h"
 #include "common/util.h"
-#include "base/gameDetector.h"	// For GameSettings
+#include "base/gameDetector.h"	// For GameDescriptor
 
 class Engine;
 class FSList;
@@ -35,34 +35,28 @@
 class OSystem;
 
 /** List of games. */
-typedef Common::Array<GameSettings> GameList;
+typedef Common::Array<GameDescriptor> GameList;
 
 /**
- * A detected game. Carries the GameSettings, but also (optionally)
+ * A detected game. Carries the GameDescriptor, but also (optionally)
  * information about the language and platform of the detected game.
  */
-struct DetectedGame {
-	const char *gameid;
-	const char *description;
+struct DetectedGame : public GameDescriptor {
 	Common::Language language;
 	Common::Platform platform;
 	DetectedGame(const char *g = 0, const char *d = 0,
 	             Common::Language l = Common::UNK_LANG,
 	             Common::Platform p = Common::kPlatformUnknown)
-		: gameid(g), description(d), language(l), platform(p) {}
-	DetectedGame(const GameSettings &game,
+		: GameDescriptor(g, d), language(l), platform(p) {}
+
+	template <class T>
+	DetectedGame(const T &game,
 	             Common::Language l = Common::UNK_LANG,
 	             Common::Platform p = Common::kPlatformUnknown)
-		: gameid(game.gameid), description(game.description), language(l), platform(p) {}
+		: GameDescriptor(game.gameid, game.description), language(l), platform(p) {}
 };
 
-template <class T>
-DetectedGame toDetectedGame(const T &g) {
-	DetectedGame dummy(g.gameid, g.description);
-	return dummy;
-}
 
-
 /** List of detected games. */
 typedef Common::Array<DetectedGame> DetectedGameList;
 
@@ -83,7 +77,7 @@
 	virtual int getVersion() const	{ return 0; }	// TODO!
 
 	virtual GameList getSupportedGames() const = 0;
-	virtual GameSettings findGame(const char *gameid) const = 0;
+	virtual GameDescriptor findGame(const char *gameid) const = 0;
 	virtual DetectedGameList detectGames(const FSList &fslist) const = 0;
 
 	virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
@@ -99,8 +93,8 @@
  * Each plugin has to define the following functions:
  * - GameList Engine_##ID##_gameIDList()
  *   -> returns a list of gameid/desc pairs. Only used to implement '--list-games'.
- * - GameSettings Engine_##ID##_findGameID(const char *gameid)
- *   -> asks the Engine for a GameSettings matching the gameid. If that is not
+ * - GameDescriptor Engine_##ID##_findGameID(const char *gameid)
+ *   -> asks the Engine for a GameDescriptor matching the gameid. If that is not
  *      possible, the engine MUST set the gameid of the returned value to 0.
  *      Note: This MUST succeed for every gameID on the list returned by
  *      gameIDList(), but MAY also work for additional gameids (e.g. to support
@@ -130,7 +124,7 @@
 	extern "C" { \
 		PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \
 		PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \
-		PLUGIN_EXPORT GameSettings PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
+		PLUGIN_EXPORT GameDescriptor PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
 		PLUGIN_EXPORT Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return Engine_##ID##_create(detector, syst); } \
 		PLUGIN_EXPORT DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return Engine_##ID##_detectGames(fslist); } \
 	}
@@ -144,7 +138,7 @@
 class PluginRegistrator {
 	friend class StaticPlugin;
 public:
-	typedef GameSettings (*GameIDQueryFunc)(const char *gameid);
+	typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
 	typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
 	typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
 

Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/cine/cine.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -63,9 +63,8 @@
 	byte id;
 	uint32 features;
 	const char *detectname;
-	GameSettings toGameSettings() const {
-		GameSettings dummy = { name, description };
-		return dummy;
+	GameDescriptor toGameDescriptor() const {
+		return GameDescriptor(name, description);
 	}
 };
 
@@ -80,21 +79,21 @@
 	const CINEGameSettings *g = cine_settings;
 
 	while (g->name) {
-		games.push_back(g->toGameSettings());
+		games.push_back(g->toGameDescriptor());
 		g++;
 	}
 
 	return games;
 }
 
-GameSettings Engine_CINE_findGameID(const char *gameid) {
+GameDescriptor Engine_CINE_findGameID(const char *gameid) {
 	const CINEGameSettings *g = cine_settings;
 	while (g->name) {
 		if (0 == scumm_stricmp(gameid, g->name))
 			break;
 		g++;
 	}
-	return g->toGameSettings();
+	return g->toGameDescriptor();
 }
 
 DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
@@ -109,7 +108,7 @@
 
 			if (0 == scumm_stricmp(g->detectname, gameName)) {
 				// Match found, add to list of candidates, then abort inner loop.
-				detectedGames.push_back(g->toGameSettings());
+				detectedGames.push_back(g->toGameDescriptor());
 				break;
 			}
 		}

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/gob/gob.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -118,7 +118,7 @@
 };
 
 // Keep list of different supported games
-static const GameSettings gob_list[] = {
+static const PlainGameDescriptor gob_list[] = {
 	{"gob1", "Gobliiins"},
 	{"gob2", "Gobliins 2"},
 	{0, 0}
@@ -275,7 +275,7 @@
 
 GameList Engine_GOB_gameIDList() {
 	GameList games;
-	const GameSettings *g = gob_list;
+	const PlainGameDescriptor *g = gob_list;
 
 	while (g->gameid) {
 		games.push_back(*g);
@@ -285,8 +285,8 @@
 	return games;
 }
 
-GameSettings Engine_GOB_findGameID(const char *gameid) {
-	const GameSettings *g = gob_list;
+GameDescriptor Engine_GOB_findGameID(const char *gameid) {
+	const PlainGameDescriptor *g = gob_list;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
 			break;
@@ -328,7 +328,7 @@
 		if (detectedGames.isEmpty()) {
 			printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
 
-			const GameSettings *g1 = gob_list;
+			const PlainGameDescriptor *g1 = gob_list;
 			while (g1->gameid) {
 				detectedGames.push_back(*g1);
 				g1++;

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -96,7 +96,7 @@
 };
 
 // Keep list of different supported games
-static const GameSettings kyra_list[] = {
+static const PlainGameDescriptor kyra_list[] = {
 	{ "kyra1", "The Legend of Kyrandia" },
 	{ 0, 0 }
 };
@@ -131,7 +131,7 @@
 
 GameList Engine_KYRA_gameIDList() {
 	GameList games;
-	const GameSettings *g = kyra_list;
+	const PlainGameDescriptor *g = kyra_list;
 
 	while (g->gameid) {
 		games.push_back(*g);
@@ -140,8 +140,8 @@
 	return games;
 }
 
-GameSettings Engine_KYRA_findGameID(const char *gameid) {
-	const GameSettings *g = kyra_list;
+GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
+	const PlainGameDescriptor *g = kyra_list;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
 			break;
@@ -187,7 +187,7 @@
 		if (detectedGames.isEmpty()) {
 			printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
 
-			const GameSettings *g1 = kyra_list;
+			const PlainGameDescriptor *g1 = kyra_list;
 			while (g1->gameid) {
 				detectedGames.push_back(*g1);
 				g1++;

Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/lure/lure.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -68,14 +68,14 @@
 
 // Keep list of different supported games
 
-static const GameSettings lure_list[] = {
+static const PlainGameDescriptor lure_list[] = {
 	{ "lure", "Lure of the Temptress" },
 	{ 0, 0 }
 };
 
 GameList Engine_LURE_gameIDList() {
 	GameList games;
-	const GameSettings *g = lure_list;
+	const PlainGameDescriptor *g = lure_list;
 
 	while (g->gameid) {
 		games.push_back(*g);
@@ -84,8 +84,8 @@
 	return games;
 }
 
-GameSettings Engine_LURE_findGameID(const char *gameid) {
-	const GameSettings *g = lure_list;
+GameDescriptor Engine_LURE_findGameID(const char *gameid) {
+	const PlainGameDescriptor *g = lure_list;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
 			break;
@@ -125,13 +125,13 @@
 		}
 		for (g = lure_games; g->gameid; g++) {
 			if (strcmp(g->md5sum, (char *)md5str) == 0) {
-				detectedGames.push_back(toDetectedGame(*g));
+				detectedGames.push_back(*g);
 			}
 		}
 		if (detectedGames.isEmpty()) {
 			debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
 
-			const GameSettings *g1 = lure_list;
+			const PlainGameDescriptor *g1 = lure_list;
 			while (g1->gameid) {
 				detectedGames.push_back(*g1);
 				g1++;

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/queen/queen.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -55,7 +55,7 @@
 #endif
 
 /* Flight of the Amazon Queen */
-static const GameSettings queen_setting[] = {
+static const PlainGameDescriptor queen_setting[] = {
 	{ "queen", "Flight of the Amazon Queen" },
 	{ "queen", "Flight of the Amazon Queen (Demo)" },
 	{ "queen", "Flight of the Amazon Queen (Interview)" },
@@ -68,15 +68,14 @@
 	return games;
 }
 
-GameSettings Engine_QUEEN_findGameID(const char *gameid) {
+GameDescriptor Engine_QUEEN_findGameID(const char *gameid) {
 	if (0 == scumm_stricmp(gameid, queen_setting[0].gameid))
 		return queen_setting[0];
-	GameSettings dummy = { 0, 0 };
-	return dummy;
+	return GameDescriptor();
 }
 
 
-GameSettings determineTarget(uint32 size) {
+GameDescriptor determineTarget(uint32 size) {
 	switch (size) {
 	case 3724538:	//regular demo
 	case 3732177:

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/saga/saga.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -56,7 +56,7 @@
 #include "saga/objectmap.h"
 #include "saga/resnames.h"
 
-static const GameSettings saga_games[] = {
+static const PlainGameDescriptor saga_games[] = {
 	{"ite", "Inherit the Earth"},
 	{"ihnm", "I Have No Mouth and I Must Scream"},
 	{0, 0}
@@ -64,7 +64,7 @@
 
 GameList Engine_SAGA_gameIDList() {
 	GameList games;
-	const GameSettings *g = saga_games;
+	const PlainGameDescriptor *g = saga_games;
 
 	while (g->gameid) {
 		games.push_back(*g);
@@ -74,8 +74,8 @@
 	return games;
 }
 
-GameSettings Engine_SAGA_findGameID(const char *gameid) {
-	const GameSettings *g = saga_games;
+GameDescriptor Engine_SAGA_findGameID(const char *gameid) {
+	const PlainGameDescriptor *g = saga_games;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
 			break;

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -55,7 +55,6 @@
 	kMD5FileSizeLimit = 1024 * 1024
 };
 
-
 struct ObsoleteGameID {
 	const char *from;
 	const char *to;
@@ -75,7 +74,7 @@
  * This table contains all game IDs supported by the SCUMM engine, and maps
  * them to the full humand readable game name.
  */
-static const GameSettings gameDescriptions[] = {
+static const PlainGameDescriptor gameDescriptions[] = {
 	{ "atlantis", "Indiana Jones and the Fate of Atlantis" },
 	{ "indy3", "Indiana Jones and the Last Crusade" },
 	{ "loom", "Loom" },
@@ -851,7 +850,7 @@
 
 
 static const char *findDescriptionFromGameID(const char *gameid) {
-	const GameSettings *g = gameDescriptions;
+	const PlainGameDescriptor *g = gameDescriptions;
 	while (g->gameid) {
 		if (!scumm_stricmp(g->gameid, gameid)) {
 			return g->description;
@@ -874,32 +873,32 @@
 
 
 GameList Engine_SCUMM_gameIDList() {
-	const GameSettings *g = gameDescriptions;
+	const PlainGameDescriptor *g = gameDescriptions;
 	GameList games;
 	while (g->gameid) {
-		games.push_back(*g);
+		games.push_back(GameDescriptor(g->gameid, g->description));
 		g++;
 	}
 	return games;
 }
 
-GameSettings Engine_SCUMM_findGameID(const char *gameid) {
+GameDescriptor Engine_SCUMM_findGameID(const char *gameid) {
 	// First search the list of supported game IDs.
-	const GameSettings *g = gameDescriptions;
+	const PlainGameDescriptor *g = gameDescriptions;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
-			return *g;
+			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.
-	GameSettings gs = { 0, 0 };
+	GameDescriptor gs;
 	const ObsoleteGameID *o = obsoleteGameIDsTable;
 	while (o->from) {
 		if (0 == scumm_stricmp(gameid, o->from)) {
 			gs.gameid = gameid;
-			gs.gameid = "Obsolete game ID";
+			gs.description = "Obsolete game ID";
 			return gs;
 		}
 		o++;
@@ -1072,7 +1071,7 @@
 								if we find something which has an unknown MD5, assume
 								that it is an (so far unknown) version of Indy3.
 
-								We can combin this with a look at the resource headers:
+								We can combine this with a look at the resource headers:
 
 								Indy3:
 								_numGlobalObjects 1000
@@ -1189,7 +1188,7 @@
 
 				const char *gameid = elem->gameid;
 
-				// Find the GameSettings for that gameid
+				// Find the GameDescriptor for that gameid
 				for (g = scumm_settings; g->gameid; ++g) {
 					if (0 == scumm_stricmp(g->gameid, gameid))
 							break;
@@ -1318,7 +1317,7 @@
 	}
 
 	// Now search our 'database' for the MD5; if a match is found, we use 
-	// the information in the 'database' to correct the GameSettings.
+	// the information in the 'database' to correct the GameDescriptor.
 	g = multiple_versions_md5_settings;
 	while (g->gameid) {
 		if (!scumm_stricmp(md5, g->gameid)) {
@@ -1366,7 +1365,7 @@
 	if (!elem)
 		printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5);
 
-	// Finally, we have massaged the GameSettings to our satisfaction, and can
+	// Finally, we have massaged the GameDescriptor to our satisfaction, and can
 	// instantiate the appropriate game engine. Hooray!
 	switch (game.version) {
 	case 1:

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -76,7 +76,7 @@
 	{NULL, NULL, Common::kPlatformUnknown}
 };
 
-static const GameSettings simonGames[] = {
+static const PlainGameDescriptor simonGames[] = {
 	// Simon the Sorcerer 1 & 2
 	{"feeble", "The Feeble Files"},
 	{"simon1", "Simon the Sorcerer 1"},
@@ -87,32 +87,32 @@
 
 GameList Engine_SIMON_gameIDList() {
 	GameList games;
-	const GameSettings *g = simonGames;
+	const PlainGameDescriptor *g = simonGames;
 	while (g->gameid) {
-		games.push_back(*g);
+		games.push_back(GameDescriptor(g->gameid, g->description));
 		g++;
 	}
 
 	return games;
 }
 
-GameSettings Engine_SIMON_findGameID(const char *gameid) {
+GameDescriptor Engine_SIMON_findGameID(const char *gameid) {
 	// First search the list of supported game IDs.
-	const GameSettings *g = simonGames;
+	const PlainGameDescriptor *g = simonGames;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
-			return *g;
+			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.
-	GameSettings gs = { 0, 0 };
+	GameDescriptor gs;
 	const ObsoleteGameID *o = obsoleteGameIDsTable;
 	while (o->from) {
 		if (0 == scumm_stricmp(gameid, o->from)) {
 			gs.gameid = gameid;
-			gs.gameid = "Obsolete game ID";
+			gs.description = "Obsolete game ID";
 			return gs;
 		}
 		o++;

Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/sky/sky.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -77,7 +77,7 @@
  With apologies to the CD32 SteelSky file.
 */
 
-static const GameSettings skySetting =
+static const PlainGameDescriptor skySetting =
 	{"sky", "Beneath a Steel Sky" };
 
 GameList Engine_SKY_gameIDList() {
@@ -86,11 +86,10 @@
 	return games;
 }
 
-GameSettings Engine_SKY_findGameID(const char *gameid) {
+GameDescriptor Engine_SKY_findGameID(const char *gameid) {
 	if (0 == scumm_stricmp(gameid, skySetting.gameid))
 		return skySetting;
-	GameSettings dummy = { 0, 0 };
-	return dummy;
+	return GameDescriptor();
 }
 
 DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -48,9 +48,9 @@
 using namespace Sword1;
 
 /* Broken Sword 1 */
-static const GameSettings sword1FullSettings =
+static const PlainGameDescriptor sword1FullSettings =
 	{"sword1", "Broken Sword 1: The Shadow of the Templars"};
-static const GameSettings sword1DemoSettings =
+static const PlainGameDescriptor sword1DemoSettings =
 	{"sword1demo", "Broken Sword 1: The Shadow of the Templars (Demo)"};
 
 // check these subdirectories (if present)
@@ -73,13 +73,12 @@
 	return games;
 }
 
-GameSettings Engine_SWORD1_findGameID(const char *gameid) {
+GameDescriptor Engine_SWORD1_findGameID(const char *gameid) {
 	if (0 == scumm_stricmp(gameid, sword1FullSettings.gameid))
 		return sword1FullSettings;
 	if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameid))
 		return sword1DemoSettings;
-	GameSettings dummy = { 0, 0 };
-	return dummy;
+	return GameDescriptor();
 }
 
 void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) {

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -67,20 +67,20 @@
 	const Sword2GameSettings *g = sword2_settings;
 	GameList games;
 	while (g->gameid) {
-		games.push_back(toGameSettings(*g));
+		games.push_back(*g);
 		g++;
 	}
 	return games;
 }
 
-GameSettings Engine_SWORD2_findGameID(const char *gameid) {
+GameDescriptor Engine_SWORD2_findGameID(const char *gameid) {
 	const Sword2GameSettings *g = sword2_settings;
 	while (g->gameid) {
 		if (0 == scumm_stricmp(gameid, g->gameid))
 			break;
 		g++;
 	}
-	return toGameSettings(*g);
+	return *g;
 }
 
 DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
@@ -99,7 +99,7 @@
 
 				if (0 == scumm_stricmp(g->detectname, gameName)) {
 					// Match found, add to list of candidates, then abort inner loop.
-					detectedGames.push_back(toDetectedGame(*g));
+					detectedGames.push_back(*g);
 					break;
 				}
 			}

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-03-09 01:42:56 UTC (rev 21149)
+++ scummvm/trunk/gui/launcher.cpp	2006-03-09 02:52:51 UTC (rev 21150)
@@ -114,7 +114,7 @@
 	typedef Common::String String;
 	typedef Common::StringList StringList;
 public:
-	EditGameDialog(const String &domain, const char *desc);
+	EditGameDialog(const String &domain, const String &desc);
 
 	void open();
 	void close();
@@ -137,7 +137,7 @@
 	CheckboxWidget *_globalVolumeOverride;
 };
 
-EditGameDialog::EditGameDialog(const String &domain, const char *desc)
+EditGameDialog::EditGameDialog(const String &domain, const String &desc)
 	: OptionsDialog(domain, 10, 40, 320 - 2 * 10, 140) {
 
 	const int screenW = g_system->getOverlayWidth();
@@ -176,7 +176,7 @@
 
 	// GAME: Determine the description string
 	String description(ConfMan.get("description", domain));
-	if (description.isEmpty() && desc) {
+	if (description.isEmpty() && !desc.isEmpty()) {
 		description = desc;
 	}
 
@@ -570,8 +570,8 @@
 		if (gameid.isEmpty())
 			gameid = iter->_key;
 		if (description.isEmpty()) {
-			GameSettings g = GameDetector::findGame(gameid);
-			if (g.description)
+			GameDescriptor g = GameDetector::findGame(gameid);
+			if (!g.description.isEmpty())
 				description = g.description;
 		}
 
@@ -667,17 +667,16 @@
 
 			// Adapt the description string if custom platform/language is set
 			if (customLanguage || customPlatform) {
-				String desc = result.description;
-				desc += " (";
+				result.description += " (";
 				if (customLanguage)
-					desc += Common::getLanguageDescription(result.language);
+					result.description += Common::getLanguageDescription(result.language);
 				if (customLanguage && customPlatform)
-					desc += "/";
+					result.description += "/";
 				if (customPlatform)
-					desc += Common::getPlatformDescription(result.platform);
-				desc += ")";
+					result.description += Common::getPlatformDescription(result.platform);
+				result.description += ")";
 
-				ConfMan.set("description", desc, domain);
+				ConfMan.set("description", result.description, domain);
 			}
 
 			// Display edit dialog for the new entry


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