diff options
Diffstat (limited to 'engines/lure/lure.cpp')
-rw-r--r-- | engines/lure/lure.cpp | 27 |
1 files changed, 20 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)); |