diff options
-rw-r--r-- | engines/mohawk/riven.cpp | 27 | ||||
-rw-r--r-- | engines/mohawk/riven.h | 1 | ||||
-rw-r--r-- | engines/mohawk/riven_saveload.cpp | 4 |
3 files changed, 23 insertions, 9 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 03afafe800..21cc701255 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -27,6 +27,7 @@ #include "common/translation.h" #include "common/system.h" #include "gui/saveload.h" +#include "gui/message.h" #include "mohawk/cursors.h" #include "mohawk/installer_archive.h" @@ -173,10 +174,10 @@ Common::Error MohawkEngine_Riven::run() { // Load game from launcher/command line if requested int gameToLoad = ConfMan.getInt("save_slot"); - // Attempt to load the game. On failure, just send us to the main menu. - if (_saveLoad->loadGame(gameToLoad).getCode() != Common::kNoError) { - changeToStack(kStackAspit); - changeToCard(1); + // Attempt to load the game. + Common::Error loadError = _saveLoad->loadGame(gameToLoad); + if (loadError.getCode() != Common::kNoError) { + return loadError; } } else { // Otherwise, start us off at aspit's card 1 (the main menu) @@ -227,7 +228,7 @@ void MohawkEngine_Riven::doFrame() { case Common::KEYCODE_F5: runDialog(*_optionsDialog); if (_optionsDialog->getLoadSlot() >= 0) - loadGameState(_optionsDialog->getLoadSlot()); + loadGameStateAndDisplayError(_optionsDialog->getLoadSlot()); _gfx->setTransitionMode((RivenTransitionMode) _vars["transitionmode"]); _card->initializeZipMode(); break; @@ -433,14 +434,26 @@ void MohawkEngine_Riven::runLoadDialog() { GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false); int slot = slc.runModalWithCurrentTarget(); - if (slot >= 0) - loadGameState(slot); + if (slot >= 0) { + loadGameStateAndDisplayError(slot); + } } Common::Error MohawkEngine_Riven::loadGameState(int slot) { return _saveLoad->loadGame(slot); } +void MohawkEngine_Riven::loadGameStateAndDisplayError(int slot) { + assert(slot >= 0); + + Common::Error loadError = loadGameState(slot); + + if (loadError.getCode() != Common::kNoError) { + GUI::MessageDialog dialog(loadError.getDesc()); + dialog.runModal(); + } +} + Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) { return _saveLoad->saveGame(slot, desc); } diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 908deb73b6..0bd6fc66c9 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -99,6 +99,7 @@ public: bool canLoadGameStateCurrently(); bool canSaveGameStateCurrently(); Common::Error loadGameState(int slot); + void loadGameStateAndDisplayError(int slot); Common::Error saveGameState(int slot, const Common::String &desc); bool hasFeature(EngineFeature f) const; diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 0d701239c7..c83862d614 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -180,9 +180,9 @@ Common::Error RivenSaveLoad::loadGame(const int slot) { delete vers; if ((saveGameVersion == kCDSaveGameVersion && (_vm->getFeatures() & GF_DVD)) || (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) { - warning("Incompatible saved game versions. No support for this yet"); + warning("Unable to load: Saved game created using an incompatible game version - CD vs DVD"); delete mhk; - return Common::Error(Common::kUnknownError, "Incompatible save version"); + return Common::Error(Common::kUnknownError, "Saved game created using an incompatible game version - CD vs DVD"); } // Now, we'll read in the variable values. |