diff options
-rw-r--r-- | engines/mohawk/riven.cpp | 6 | ||||
-rw-r--r-- | engines/mohawk/riven_saveload.cpp | 18 | ||||
-rw-r--r-- | engines/mohawk/riven_saveload.h | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 38b38d2c56..95a8313536 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -171,7 +171,7 @@ Common::Error MohawkEngine_Riven::run() { error ("Could not find saved game"); // Attempt to load the game. On failure, just send us to the main menu. - if (!_saveLoad->loadGame(savedGamesList[gameToLoad])) { + if (_saveLoad->loadGame(savedGamesList[gameToLoad]).getCode() != Common::kNoError) { changeToStack(aspit); changeToCard(1); } @@ -729,7 +729,7 @@ void MohawkEngine_Riven::runLoadDialog() { } Common::Error MohawkEngine_Riven::loadGameState(int slot) { - return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]) ? Common::kNoError : Common::kUnknownError; + return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]); } Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) { @@ -738,7 +738,7 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String & if ((uint)slot < saveList.size()) _saveLoad->deleteSave(saveList[slot]); - return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError; + return _saveLoad->saveGame(desc); } Common::String MohawkEngine_Riven::getStackName(uint16 stack) const { diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 18c13ec12b..f5bf7782d4 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -88,13 +88,13 @@ static uint16 mapNewStackIDToOld(uint16 newID) { return 0; } -bool RivenSaveLoad::loadGame(Common::String filename) { +Common::Error RivenSaveLoad::loadGame(Common::String filename) { if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo - return false; + return Common::kNoError; Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename); if (!loadFile) - return false; + return Common::kReadingFailed; debug(0, "Loading game from \'%s\'", filename.c_str()); @@ -103,7 +103,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) { if (!mhk->openStream(loadFile)) { warning("Save file is not a Mohawk archive"); delete mhk; - return false; + return Common::Error(Common::kUnknownError, "Invalid save file"); } // First, let's make sure we're using a saved game file from this version of Riven by checking the VERS resource @@ -114,7 +114,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) { || (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) { warning("Incompatible saved game versions. No support for this yet"); delete mhk; - return false; + return Common::Error(Common::kUnknownError, "Incompatible save version"); } // Now, we'll read in the variable values. @@ -206,7 +206,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) { delete zips; delete mhk; - return true; + return Common::kNoError; } Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() { @@ -273,7 +273,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() { return stream; } -bool RivenSaveLoad::saveGame(Common::String filename) { +Common::Error RivenSaveLoad::saveGame(Common::String filename) { // NOTE: This code is designed to only output a Mohawk archive // for a Riven saved game. It's hardcoded to do this because // (as of right now) this is the only place in the engine @@ -295,7 +295,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) { Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename); if (!saveFile) - return false; + return Common::kWritingFailed; debug (0, "Saving game to \'%s\'", filename.c_str()); @@ -418,7 +418,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) { delete varsSection; delete zipsSection; - return true; + return Common::kNoError; } void RivenSaveLoad::deleteSave(Common::String saveName) { diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h index c1b3fc639e..37b73c26c6 100644 --- a/engines/mohawk/riven_saveload.h +++ b/engines/mohawk/riven_saveload.h @@ -42,8 +42,8 @@ public: ~RivenSaveLoad(); Common::StringArray generateSaveGameList(); - bool loadGame(Common::String); - bool saveGame(Common::String); + Common::Error loadGame(Common::String); + Common::Error saveGame(Common::String); void deleteSave(Common::String); private: |