From 6412d091268d299f7f4d31382b0e4e9e4e352ad9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 13 Jun 2011 01:25:53 +0200 Subject: DETECTOR: Remove PlainGameDescriptorGUIOpts --- engines/game.cpp | 11 +++------- engines/game.h | 16 ++------------- engines/sword1/detection.cpp | 48 ++++++++++++++++++++++---------------------- 3 files changed, 29 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/game.cpp b/engines/game.cpp index a14edb8af4..c6d9905b52 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -38,17 +38,12 @@ GameDescriptor::GameDescriptor() { setVal("description", ""); } -GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) { - setVal("gameid", pgd.gameid); - setVal("description", pgd.description); -} - -GameDescriptor::GameDescriptor(const PlainGameDescriptorGUIOpts &pgd) { +GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd, uint32 guioptions) { setVal("gameid", pgd.gameid); setVal("description", pgd.description); - if (pgd.guioptions != 0) - setVal("guioptions", Common::getGameGUIOptionsDescription(pgd.guioptions)); + if (guioptions != 0) + setVal("guioptions", Common::getGameGUIOptionsDescription(guioptions)); } GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p, uint32 guioptions) { diff --git a/engines/game.h b/engines/game.h index 0d0fc853a3..3216cfb628 100644 --- a/engines/game.h +++ b/engines/game.h @@ -39,17 +39,6 @@ struct PlainGameDescriptor { const char *description; }; -/** - * Same as PlainGameDsscriptor except it adds Game GUI options parameter - * This is a plain struct to make it possible to declare NULL-terminated C arrays - * consisting of PlainGameDescriptors. - */ -struct PlainGameDescriptorGUIOpts { - const char *gameid; - const char *description; - uint32 guioptions; -}; - /** * Given a list of PlainGameDescriptors, returns the first PlainGameDescriptor * matching the given gameid. If not match is found return 0. @@ -67,8 +56,7 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla class GameDescriptor : public Common::StringMap { public: GameDescriptor(); - GameDescriptor(const PlainGameDescriptor &pgd); - GameDescriptor(const PlainGameDescriptorGUIOpts &pgd); + GameDescriptor(const PlainGameDescriptor &pgd, uint32 guioptions = 0); GameDescriptor(const Common::String &gameid, const Common::String &description, Common::Language language = Common::UNK_LANG, @@ -102,7 +90,7 @@ public: GameList(const GameList &list) : Common::Array(list) {} GameList(const PlainGameDescriptor *g) { while (g->gameid) { - push_back(GameDescriptor(g->gameid, g->description)); + push_back(GameDescriptor(*g)); g++; } } diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 48c3a0d14d..0c1e74082f 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -33,18 +33,18 @@ #include "engines/metaengine.h" /* Broken Sword */ -static const PlainGameDescriptorGUIOpts sword1FullSettings = - {"sword1", "Broken Sword: The Shadow of the Templars", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1DemoSettings = - {"sword1demo", "Broken Sword: The Shadow of the Templars (Demo)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1MacFullSettings = - {"sword1mac", "Broken Sword: The Shadow of the Templars (Mac)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1MacDemoSettings = - {"sword1macdemo", "Broken Sword: The Shadow of the Templars (Mac demo)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1PSXSettings = - {"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1PSXDemoSettings = - {"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)", Common::GUIO_NOMIDI}; +static const PlainGameDescriptor sword1FullSettings = + {"sword1", "Broken Sword: The Shadow of the Templars"}; +static const PlainGameDescriptor sword1DemoSettings = + {"sword1demo", "Broken Sword: The Shadow of the Templars (Demo)"}; +static const PlainGameDescriptor sword1MacFullSettings = + {"sword1mac", "Broken Sword: The Shadow of the Templars (Mac)"}; +static const PlainGameDescriptor sword1MacDemoSettings = + {"sword1macdemo", "Broken Sword: The Shadow of the Templars (Mac demo)"}; +static const PlainGameDescriptor sword1PSXSettings = + {"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)"}; +static const PlainGameDescriptor sword1PSXDemoSettings = + {"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)"}; // check these subdirectories (if present) @@ -117,12 +117,12 @@ bool Sword1::SwordEngine::hasFeature(EngineFeature f) const { GameList SwordMetaEngine::getSupportedGames() const { GameList 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); + games.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI)); return games; } @@ -198,17 +198,17 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { psxDemoFilesFound = false; if (mainFilesFound && pcFilesFound && demoFilesFound) - detectedGames.push_back(sword1DemoSettings); + detectedGames.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && psxFilesFound) - detectedGames.push_back(sword1PSXSettings); + detectedGames.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) - detectedGames.push_back(sword1PSXDemoSettings); + detectedGames.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && !psxFilesFound) - detectedGames.push_back(sword1FullSettings); + detectedGames.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && macFilesFound) - detectedGames.push_back(sword1MacFullSettings); + detectedGames.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && macDemoFilesFound) - detectedGames.push_back(sword1MacDemoSettings); + detectedGames.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI)); return detectedGames; } -- cgit v1.2.3