aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/detection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk/detection.cpp')
-rw-r--r--engines/glk/detection.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index d4773c250b..1e1eb10a8f 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -82,6 +82,11 @@ public:
* Query the engine for a PlainGameDescriptor for the specified gameid, if any.
*/
virtual PlainGameDescriptor findGame(const char *gameId) const override;
+
+ /**
+ * Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
+ */
+ void detectClashes() const;
};
bool GlkMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -204,6 +209,9 @@ PlainGameDescriptor GlkMetaEngine::findGame(const char *gameId) const {
}
DetectedGames GlkMetaEngine::detectGames(const Common::FSList &fslist) const {
+ // This is as good a place as any to detect multiple sub-engines using the same Ids
+ detectClashes();
+
DetectedGames detectedGames;
Glk::Frotz::FrotzMetaEngine::detectGames(fslist, detectedGames);
Glk::Glulxe::GlulxeMetaEngine::detectGames(fslist, detectedGames);
@@ -213,6 +221,14 @@ DetectedGames GlkMetaEngine::detectGames(const Common::FSList &fslist) const {
return detectedGames;
}
+void GlkMetaEngine::detectClashes() const {
+ Common::StringMap map;
+ Glk::Frotz::FrotzMetaEngine::detectClashes(map);
+ Glk::Glulxe::GlulxeMetaEngine::detectClashes(map);
+ Glk::Scott::ScottMetaEngine::detectClashes(map);
+ Glk::TADS::TADSMetaEngine::detectClashes(map);
+}
+
SaveStateList GlkMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;