diff options
author | Max Horn | 2006-02-17 00:22:53 +0000 |
---|---|---|
committer | Max Horn | 2006-02-17 00:22:53 +0000 |
commit | 7967e30c731bdc21342ef10271578e2ac5b4e9bc (patch) | |
tree | ecb8fe39598810b33781aeddc0ba78e45dba961e /base | |
parent | a96760a2fdf32a1dc3c6cb44cfd247e4b1b3ab79 (diff) | |
download | scummvm-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')
-rw-r--r-- | base/gameDetector.h | 20 |
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; |