aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-01 00:38:49 -0800
committerPaul Gilbert2019-01-01 00:38:49 -0800
commit0d1f5bc2d0c828165abd422a2e0a47ad3d9ae8c9 (patch)
treecca7c5800fb2e6aec9bc94a21a98d2acdf35f8b3 /engines/glk
parent402fb78aaf49177a9333b8ab9b7a826e56726dc0 (diff)
downloadscummvm-rg350-0d1f5bc2d0c828165abd422a2e0a47ad3d9ae8c9.tar.gz
scummvm-rg350-0d1f5bc2d0c828165abd422a2e0a47ad3d9ae8c9.tar.bz2
scummvm-rg350-0d1f5bc2d0c828165abd422a2e0a47ad3d9ae8c9.zip
GLK: Fix gcc warning in engine construction
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/detection.cpp15
1 files changed, 6 insertions, 9 deletions
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 @@ template<class META, class ENG>Engine *create(OSystem *syst, Glk::GlkGameDescrip
}
}
-#define CREATE(META, ENG) if (!(*engine = create<META, ENG>(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<Glk::Alan2::Alan2MetaEngine, Glk::Alan2::Alan2>(syst, gameDesc)) != nullptr) {}
+ else if ((*engine = create<Glk::Frotz::FrotzMetaEngine, Glk::Frotz::Frotz>(syst, gameDesc)) != nullptr) {}
+ else if ((*engine = create<Glk::Glulxe::GlulxeMetaEngine, Glk::Glulxe::Glulxe>(syst, gameDesc)) != nullptr) {}
+ else if ((*engine = create<Glk::Scott::ScottMetaEngine, Glk::Scott::Scott>(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"));