From 86565fcca57454e91124410cfd6864ef1e202dc0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 9 Mar 2006 02:52:51 +0000 Subject: - 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 svn-id: r21150 --- base/gameDetector.h | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'base/gameDetector.h') diff --git a/base/gameDetector.h b/base/gameDetector.h index 0cada3e597..6eb9c5c231 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -34,25 +34,32 @@ namespace Audio { 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 -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 + GameDescriptor(const T &g) : + gameid(g.gameid), description(g.description) {} +}; class GameDetector { @@ -78,7 +85,7 @@ public: 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 -- cgit v1.2.3