aboutsummaryrefslogtreecommitdiff
path: root/base/gameDetector.h
diff options
context:
space:
mode:
authorMax Horn2006-02-17 00:22:53 +0000
committerMax Horn2006-02-17 00:22:53 +0000
commit7967e30c731bdc21342ef10271578e2ac5b4e9bc (patch)
treeecb8fe39598810b33781aeddc0ba78e45dba961e /base/gameDetector.h
parenta96760a2fdf32a1dc3c6cb44cfd247e4b1b3ab79 (diff)
downloadscummvm-rg350-7967e30c731bdc21342ef10271578e2ac5b4e9bc.tar.gz
scummvm-rg350-7967e30c731bdc21342ef10271578e2ac5b4e9bc.tar.bz2
scummvm-rg350-7967e30c731bdc21342ef10271578e2ac5b4e9bc.zip
Added global toGameSettings() template function for convenience; simplified GameSettings usage in some engines
svn-id: r20739
Diffstat (limited to 'base/gameDetector.h')
-rw-r--r--base/gameDetector.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/base/gameDetector.h b/base/gameDetector.h
index f8268f8bdf..0d7ceb2b33 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -43,10 +43,26 @@ enum {
struct GameSettings {
const char *gameid;
- const char *description;
- uint32 features;
+ const char *description; // TODO: Rename this to "title" or so
+ uint32 features; // TODO: Probably should get rid of this field
};
+/**
+ * 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, g.features };
+ return dummy;
+}
+
+
class GameDetector {
typedef Common::String String;