From b84ee752cf50448590391b7c5e9f7ec448b9adfb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 14 Dec 2018 18:25:20 -0800 Subject: GLK: Detect game Id clashes across different sub-engines --- engines/glk/scott/detection.cpp | 8 ++++++++ engines/glk/scott/detection.h | 6 ++++++ 2 files changed, 14 insertions(+) (limited to 'engines/glk/scott') diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp index a02e3c56ad..6c04a25646 100644 --- a/engines/glk/scott/detection.cpp +++ b/engines/glk/scott/detection.cpp @@ -77,5 +77,13 @@ bool ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g return !gameList.empty(); } +void ScottMetaEngine::detectClashes(Common::StringMap &map) { + for (const PlainGameDescriptor *pd = SCOTT_GAME_LIST; pd->gameId; ++pd) { + if (map.contains(pd->gameId)) + error("Duplicate game Id found - %s", pd->gameId); + map[pd->gameId] = ""; + } +} + } // End of namespace Scott } // End of namespace Glk diff --git a/engines/glk/scott/detection.h b/engines/glk/scott/detection.h index 384197c467..709b7de1d9 100644 --- a/engines/glk/scott/detection.h +++ b/engines/glk/scott/detection.h @@ -24,6 +24,7 @@ #define GLK_SCOTT_DETECTION #include "common/fs.h" +#include "common/hash-str.h" #include "engines/game.h" namespace Glk { @@ -45,6 +46,11 @@ public: * Detect supported games */ static bool detectGames(const Common::FSList &fslist, DetectedGames &gameList); + + /** + * Check for game Id clashes with other sub-engines + */ + static void detectClashes(Common::StringMap &map); }; } // End of namespace Scott -- cgit v1.2.3