aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2018-05-06 13:09:52 +0200
committerBastien Bouclet2018-05-10 09:04:23 +0200
commit643c24db75797728087999abd8acf1ecc83757fa (patch)
tree7f35b6b3b637139aaa2a8bef8c1836583e2291a5
parent8fb149e3c7603f023dfccf2b2056a9a2fda431c2 (diff)
downloadscummvm-rg350-643c24db75797728087999abd8acf1ecc83757fa.tar.gz
scummvm-rg350-643c24db75797728087999abd8acf1ecc83757fa.tar.bz2
scummvm-rg350-643c24db75797728087999abd8acf1ecc83757fa.zip
ENGINES: Change MetaEngine::listSupportedGames to return plain game descriptors
-rw-r--r--base/commandLine.cpp6
-rw-r--r--engines/advancedDetector.cpp8
-rw-r--r--engines/advancedDetector.h2
-rw-r--r--engines/game.h24
-rw-r--r--engines/metaengine.h2
-rw-r--r--engines/scumm/detection.cpp6
-rw-r--r--engines/sky/detection.cpp8
-rw-r--r--engines/sword1/detection.cpp18
-rw-r--r--engines/sword2/sword2.cpp8
9 files changed, 42 insertions, 40 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 0755165094..1c7916c48f 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -687,9 +687,9 @@ static void listGames() {
const PluginList &plugins = EngineMan.getPlugins();
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
- GameList list = (*iter)->get<MetaEngine>().getSupportedGames();
- for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
- printf("%-20s %s\n", v->gameid().c_str(), v->description().c_str());
+ PlainGameList list = (*iter)->get<MetaEngine>().getSupportedGames();
+ for (PlainGameList::iterator v = list.begin(); v != list.end(); ++v) {
+ printf("%-20s %s\n", v->gameId, v->description);
}
}
}
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 43c2082c7d..562ad5dfe2 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -583,14 +583,14 @@ ADDetectedGame AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles,
return result;
}
-GameList AdvancedMetaEngine::getSupportedGames() const {
+PlainGameList AdvancedMetaEngine::getSupportedGames() const {
if (_singleId != NULL) {
- GameList gl;
+ PlainGameList gl;
const PlainGameDescriptor *g = _gameIds;
while (g->gameId) {
if (0 == scumm_stricmp(_singleId, g->gameId)) {
- gl.push_back(GameDescriptor(g->gameId, g->description));
+ gl.push_back(*g);
return gl;
}
@@ -599,7 +599,7 @@ GameList AdvancedMetaEngine::getSupportedGames() const {
error("Engine %s doesn't have its singleid specified in ids list", _singleId);
}
- return GameList(_gameIds);
+ return PlainGameList(_gameIds);
}
PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index ec52134c78..5762009ea7 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -265,7 +265,7 @@ public:
* Returns list of targets supported by the engine.
* Distinguishes engines with single ID
*/
- virtual GameList getSupportedGames() const;
+ PlainGameList getSupportedGames() const override;
PlainGameDescriptor findGame(const char *gameId) const override;
diff --git a/engines/game.h b/engines/game.h
index 88033dcf09..a5cc4de4ec 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -50,6 +50,18 @@ struct PlainGameDescriptor {
*/
const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list);
+class PlainGameList : public Common::Array<PlainGameDescriptor> {
+public:
+ PlainGameList() {}
+ PlainGameList(const PlainGameList &list) : Common::Array<PlainGameDescriptor>(list) {}
+ PlainGameList(const PlainGameDescriptor *g) {
+ while (g->gameId) {
+ push_back(*g);
+ g++;
+ }
+ }
+};
+
/**
* Ths is an enum to describe how done a game is. This also indicates what level of support is expected.
*/
@@ -106,17 +118,7 @@ public:
};
/** List of games. */
-class GameList : public Common::Array<GameDescriptor> {
-public:
- GameList() {}
- GameList(const GameList &list) : Common::Array<GameDescriptor>(list) {}
- GameList(const PlainGameDescriptor *g) {
- while (g->gameId) {
- push_back(GameDescriptor(*g));
- g++;
- }
- }
-};
+typedef Common::Array<GameDescriptor> GameList;
/**
* A record describing the properties of a file. Used on the existing
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 9ce8dc9f11..74eb367200 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -69,7 +69,7 @@ public:
virtual const char *getOriginalCopyright() const = 0;
/** Returns a list of games supported by this engine. */
- virtual GameList getSupportedGames() const = 0;
+ virtual PlainGameList getSupportedGames() const = 0;
/** Query the engine for a PlainGameDescriptor for the specified gameid, if any. */
virtual PlainGameDescriptor findGame(const char *gameId) const = 0;
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 2ba5bd3f74..6276f1ae41 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -959,7 +959,7 @@ public:
virtual const char *getOriginalCopyright() const;
virtual bool hasFeature(MetaEngineFeature f) const;
- virtual GameList getSupportedGames() const;
+ PlainGameList getSupportedGames() const override;
PlainGameDescriptor findGame(const char *gameid) const override;
virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
@@ -992,8 +992,8 @@ bool ScummEngine::hasFeature(EngineFeature f) const {
(f == kSupportsSubtitleOptions);
}
-GameList ScummMetaEngine::getSupportedGames() const {
- return GameList(gameDescriptions);
+PlainGameList ScummMetaEngine::getSupportedGames() const {
+ return PlainGameList(gameDescriptions);
}
PlainGameDescriptor ScummMetaEngine::findGame(const char *gameid) const {
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 629996bae1..ffed998ab1 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -76,7 +76,7 @@ public:
virtual const char *getOriginalCopyright() const;
virtual bool hasFeature(MetaEngineFeature f) const;
- virtual GameList getSupportedGames() const;
+ PlainGameList getSupportedGames() const override;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
PlainGameDescriptor findGame(const char *gameid) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override;
@@ -110,9 +110,9 @@ bool Sky::SkyEngine::hasFeature(EngineFeature f) const {
(f == kSupportsSavingDuringRuntime);
}
-GameList SkyMetaEngine::getSupportedGames() const {
- GameList games;
- games.push_back(GameDescriptor(skySetting));
+PlainGameList SkyMetaEngine::getSupportedGames() const {
+ PlainGameList games;
+ games.push_back(skySetting);
return games;
}
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 62e8f1c905..80176aee40 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -87,7 +87,7 @@ public:
}
virtual bool hasFeature(MetaEngineFeature f) const;
- virtual GameList getSupportedGames() const;
+ PlainGameList getSupportedGames() const override;
PlainGameDescriptor findGame(const char *gameId) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override;
virtual SaveStateList listSaves(const char *target) const;
@@ -116,14 +116,14 @@ bool Sword1::SwordEngine::hasFeature(EngineFeature f) const {
(f == kSupportsLoadingDuringRuntime);
}
-GameList SwordMetaEngine::getSupportedGames() const {
- GameList games;
- games.push_back(GameDescriptor(sword1FullSettings, GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1DemoSettings, GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1MacFullSettings, GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1MacDemoSettings, GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1PSXSettings, GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1PSXDemoSettings, GUIO_NOMIDI));
+PlainGameList SwordMetaEngine::getSupportedGames() const {
+ PlainGameList games;
+ games.push_back(sword1FullSettings);
+ games.push_back(sword1DemoSettings);
+ games.push_back(sword1MacFullSettings);
+ games.push_back(sword1MacDemoSettings);
+ games.push_back(sword1PSXSettings);
+ games.push_back(sword1PSXDemoSettings);
return games;
}
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index bf2f329119..f9e308ca63 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -92,7 +92,7 @@ public:
}
virtual bool hasFeature(MetaEngineFeature f) const;
- virtual GameList getSupportedGames() const;
+ PlainGameList getSupportedGames() const override;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
PlainGameDescriptor findGame(const char *gameid) const override;
virtual DetectedGames detectGames(const Common::FSList &fslist) const;
@@ -119,11 +119,11 @@ bool Sword2::Sword2Engine::hasFeature(EngineFeature f) const {
(f == kSupportsLoadingDuringRuntime);
}
-GameList Sword2MetaEngine::getSupportedGames() const {
+PlainGameList Sword2MetaEngine::getSupportedGames() const {
const Sword2::GameSettings *g = Sword2::sword2_settings;
- GameList games;
+ PlainGameList games;
while (g->gameid) {
- games.push_back(GameDescriptor(g->gameid, g->description));
+ games.push_back(PlainGameDescriptor(g->gameid, g->description));
g++;
}
return games;