From 0d1f5bc2d0c828165abd422a2e0a47ad3d9ae8c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 Jan 2019 00:38:49 -0800 Subject: GLK: Fix gcc warning in engine construction --- engines/glk/detection.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'engines/glk') diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp index 4c0932a561..1b8ed5906a 100644 --- a/engines/glk/detection.cpp +++ b/engines/glk/detection.cpp @@ -73,8 +73,6 @@ templateEngine *create(OSystem *syst, Glk::GlkGameDescrip } } -#define CREATE(META, ENG) if (!(*engine = create(syst, gameDesc))) - Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) const { Glk::GameDescriptor td = Glk::GameDescriptor::empty(); assert(engine); @@ -108,11 +106,12 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) cons f.close(); // Create the correct engine - CREATE(Glk::Alan2::Alan2MetaEngine, Glk::Alan2::Alan2) - CREATE(Glk::Frotz::FrotzMetaEngine, Glk::Frotz::Frotz) - CREATE(Glk::Glulxe::GlulxeMetaEngine, Glk::Glulxe::Glulxe) - CREATE(Glk::Scott::ScottMetaEngine, Glk::Scott::Scott) - if (!((td = Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str()))._description)) { + *engine = nullptr; + if ((*engine = create(syst, gameDesc)) != nullptr) {} + else if ((*engine = create(syst, gameDesc)) != nullptr) {} + else if ((*engine = create(syst, gameDesc)) != nullptr) {} + else if ((*engine = create(syst, gameDesc)) != nullptr) {} + else if ((td = Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str()))._description) { if (td._options & Glk::TADS::OPTION_TADS3) *engine = new Glk::TADS::TADS3::TADS3(syst, gameDesc); else @@ -124,8 +123,6 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) cons return Common::kNoError; } -#undef CREATE - Common::String GlkMetaEngine::findFileByGameId(const Common::String &gameId) const { // Get the list of files in the folder and return detection against them Common::FSNode folder = Common::FSNode(ConfMan.get("path")); -- cgit v1.2.3