diff options
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/lure.cpp | 8 | ||||
-rw-r--r-- | engines/lure/surface.cpp | 20 |
2 files changed, 20 insertions, 8 deletions
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index e65855420b..8a139ddd5a 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -167,10 +167,8 @@ const char *LureEngine::generateSaveName(int slotNumber) { bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) { Common::WriteStream *f = this->_saveFileMan->openForSaving( generateSaveName(slotNumber)); - if (f == NULL) { - warning("saveGame: Failed to save slot %d", slotNumber); + if (f == NULL) return false; - } f->write("lure", 5); f->writeByte(getLanguage()); @@ -193,10 +191,8 @@ bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) { bool LureEngine::loadGame(uint8 slotNumber) { Common::ReadStream *f = this->_saveFileMan->openForLoading( generateSaveName(slotNumber)); - if (f == NULL) { - warning(FAILED_MSG, slotNumber); + if (f == NULL) return false; - } // Check for header char buffer[5]; diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 99e6256821..a5ee93dd09 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -852,12 +852,18 @@ bool SaveRestoreDialog::show(bool saveDialog) { delete s; Sound.resume(); + int errorFlag = 0; if (doneFlag) { // Handle save or restore - if (saveDialog) + if (saveDialog) { doneFlag = engine.saveGame(selectedLine + 1, *saveNames[selectedLine]); - else + if (!doneFlag) + errorFlag = 1; + } else { doneFlag = engine.loadGame(selectedLine + 1); + if (!doneFlag) + errorFlag = 2; + } } mouse.popCursor(); @@ -866,6 +872,16 @@ bool SaveRestoreDialog::show(bool saveDialog) { for (index = 0; index < numSaves; ++index) delete saveNames[index]; Memory::dealloc(saveNames); + if (errorFlag != 0) { + Room::getReference().update(); + screen.update(); + + if (errorFlag == 1) + Dialog::show("Error occurred saving the game"); + else if (errorFlag == 2) + Dialog::show("Error occurred loading the savegame"); + } + return doneFlag; } |