From db2ffa42856d0ecd337b7a0fdd342d7560f2bdca Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 8 Jul 2006 14:51:26 +0000 Subject: Changes init error handling of kyra engine (engine fails at Engine_KYRA_create now instead of KyraEngine::init, also adds check for invalid game path like the scumm engine does). svn-id: r23426 --- engines/kyra/kyra.cpp | 4 ---- engines/kyra/plugin.cpp | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index d2f699343d..d8b0cfc1a4 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -115,10 +115,6 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system) } int KyraEngine::init() { - if (setupGameFlags()) { - return -1; - } - // Setup mixer if (!_mixer->isReady()) { warning("Sound initialization failed."); diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp index 18b9c4f1dd..18b56ab22c 100644 --- a/engines/kyra/plugin.cpp +++ b/engines/kyra/plugin.cpp @@ -272,6 +272,21 @@ PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) { *engine = new KyraEngine_v3(syst); } else error("Kyra engine created with invalid gameid."); + + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + warning("KyraEngine: invalid game path '%s'", dir.path().c_str()); + return kInvalidPathError; + } + + if (*engine) { + if (((KyraEngine*)(*engine))->setupGameFlags()) { + warning("KyraEngine: unable to locate game data at path '%s'", dir.path().c_str()); + delete *engine; + return kNoGameDataFoundError; + } + } return kNoError; } -- cgit v1.2.3