aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/tads
diff options
context:
space:
mode:
authorPaul Gilbert2018-12-31 19:47:14 -0800
committerPaul Gilbert2018-12-31 19:47:14 -0800
commit013f39cb5d7029e9569861034661770d1578847e (patch)
treea8796b50ce79001dc04dcc9db7e661f5d928fead /engines/glk/tads
parent84b6534c3fcf3315ed1c7fe3cabbdd167fc748a9 (diff)
downloadscummvm-rg350-013f39cb5d7029e9569861034661770d1578847e.tar.gz
scummvm-rg350-013f39cb5d7029e9569861034661770d1578847e.tar.bz2
scummvm-rg350-013f39cb5d7029e9569861034661770d1578847e.zip
GLK: Standardizing on a common GameDescriptor class for detectors
Diffstat (limited to 'engines/glk/tads')
-rw-r--r--engines/glk/tads/detection.cpp22
-rw-r--r--engines/glk/tads/detection.h19
-rw-r--r--engines/glk/tads/detection_tables.h10
3 files changed, 19 insertions, 32 deletions
diff --git a/engines/glk/tads/detection.cpp b/engines/glk/tads/detection.cpp
index 95f7330d65..9206193f63 100644
--- a/engines/glk/tads/detection.cpp
+++ b/engines/glk/tads/detection.cpp
@@ -31,18 +31,18 @@ namespace Glk {
namespace TADS {
void TADSMetaEngine::getSupportedGames(PlainGameList &games) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
+ for (const GameDescriptor *pd = TADS_GAME_LIST; pd->_gameId; ++pd) {
games.push_back(*pd);
}
}
-TADSDescriptor TADSMetaEngine::findGame(const char *gameId) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
- if (!strcmp(gameId, pd->gameId))
+GameDescriptor TADSMetaEngine::findGame(const char *gameId) {
+ for (const GameDescriptor *pd = TADS_GAME_LIST; pd->_gameId; ++pd) {
+ if (!strcmp(gameId, pd->_gameId))
return *pd;
}
- return TADSDescriptor();;
+ return GameDescriptor::empty();
}
bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -81,8 +81,8 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
debug("ENTRY0(\"%s\", \"%s\", %u),", fname.c_str(), md5.c_str(), (uint)filesize);
}
- const TADSDescriptor &desc = TADS_GAME_LIST[0];
- gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown);
+ const GameDescriptor &desc = TADS_GAME_LIST[0];
+ gd = DetectedGame(desc._gameId, desc._description, Common::UNK_LANG, Common::kPlatformUnknown);
}
else {
PlainGameDescriptor gameDesc = findGame(p->_gameId);
@@ -97,10 +97,10 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
}
void TADSMetaEngine::detectClashes(Common::StringMap &map) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
- if (map.contains(pd->gameId))
- error("Duplicate game Id found - %s", pd->gameId);
- map[pd->gameId] = "";
+ for (const GameDescriptor *pd = TADS_GAME_LIST; pd->_gameId; ++pd) {
+ if (map.contains(pd->_gameId))
+ error("Duplicate game Id found - %s", pd->_gameId);
+ map[pd->_gameId] = "";
}
}
diff --git a/engines/glk/tads/detection.h b/engines/glk/tads/detection.h
index f876cb2cf2..0ed1e94214 100644
--- a/engines/glk/tads/detection.h
+++ b/engines/glk/tads/detection.h
@@ -25,25 +25,12 @@
#include "common/fs.h"
#include "engines/game.h"
+#include "glk/detection.h"
namespace Glk {
namespace TADS {
-/**
- * TADS game descriptior
- */
-struct TADSDescriptor {
- const char *gameId;
- const char *description;
- bool isTADS3;
-
- operator PlainGameDescriptor() const {
- PlainGameDescriptor pd;
- pd.gameId = gameId;
- pd.description = description;
- return pd;
- }
-};
+enum TADSOption { OPTION_TADS2 = 0, OPTION_TADS3 = 1 };
/**
* Meta engine for TADS interpreter
@@ -58,7 +45,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static TADSDescriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/tads/detection_tables.h b/engines/glk/tads/detection_tables.h
index d4d570920b..322c9dbb91 100644
--- a/engines/glk/tads/detection_tables.h
+++ b/engines/glk/tads/detection_tables.h
@@ -38,14 +38,14 @@ struct TADSGameDescription {
Common::Language _language;
};
-const TADSDescriptor TADS_GAME_LIST[] = {
+const GameDescriptor TADS_GAME_LIST[] = {
// TADS 2 Games
- { "tads2", "TADS 2 Game", false },
- { "oncefuture", "Once and Future", false },
+ { "tads2", "TADS 2 Game", OPTION_TADS2 },
+ { "oncefuture", "Once and Future", OPTION_TADS2 },
// TADS 3 Games
- { "tads3", "TADS 3 Game", true },
- { nullptr, nullptr, false }
+ { "tads3", "TADS 3 Game", OPTION_TADS3 },
+ { nullptr, nullptr, 0 }
};
#define ENTRY0(ID, MD5, FILESIZE) { ID, "", MD5, FILESIZE, Common::EN_ANY }