diff options
-rw-r--r-- | engines/lure/lure.cpp | 27 | ||||
-rw-r--r-- | engines/lure/lure.h | 1 |
2 files changed, 21 insertions, 7 deletions
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 5fbd8558e1..92954d6e31 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -62,24 +62,24 @@ int LureEngine::init() { int_engine = this; _system->beginGFXTransaction(); - initCommonGFX(false); - _system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); + initCommonGFX(false); + _system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->endGFXTransaction(); // Check the version of the lure.dat file Common::File f; - VersionStructure version; - if (!f.open(SUPPORT_FILENAME)) - error("Error opening %s for validation", SUPPORT_FILENAME); + VersionStructure version; + if (!f.open(SUPPORT_FILENAME)) + GUIError("Could not locate Lure support file"); f.seek(0xbf * 8); f.read(&version, sizeof(VersionStructure)); f.close(); if (READ_LE_UINT16(&version.id) != 0xffff) - error("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME); + GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME); else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) - error("Incorrect version of %s file - expected %d.%d but got %d.%d", + GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d", SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, version.vMajor, version.vMinor); @@ -229,6 +229,19 @@ bool LureEngine::loadGame(uint8 slotNumber) { return true; } +void LureEngine::GUIError(const char *msg, ...) { + char buffer[STRINGBUFLEN]; + va_list va; + + // Generate the full error message + va_start(va, msg); + vsnprintf(buffer, STRINGBUFLEN, msg, va); + va_end(va); + + Engine::GUIErrorMessage(buffer); + exit(1); +} + Common::String *LureEngine::detectSave(int slotNumber) { Common::ReadStream *f = this->_saveFileMan->openForLoading( generateSaveName(slotNumber)); diff --git a/engines/lure/lure.h b/engines/lure/lure.h index 07aef9a361..eacdf19c41 100644 --- a/engines/lure/lure.h +++ b/engines/lure/lure.h @@ -76,6 +76,7 @@ public: bool saveGame(uint8 slotNumber, Common::String &caption); Common::String *detectSave(int slotNumber); uint8 saveVersion() { return _saveVersion; } + void GUIError(const char *msg, ...); uint32 getFeatures() const; Common::Language getLanguage() const; |