diff options
author | Johannes Schickel | 2008-11-09 13:12:38 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-11-09 13:12:38 +0000 |
commit | 85c1d35ae378bd149670ac2c0fa928b7234eb50d (patch) | |
tree | 0d6e7f08bc1482dbe4f301bfa2ab68287eff2ad1 /engines/kyra | |
parent | 36de1204e343743b4c86d8b30113640b3e697c7c (diff) | |
download | scummvm-rg350-85c1d35ae378bd149670ac2c0fa928b7234eb50d.tar.gz scummvm-rg350-85c1d35ae378bd149670ac2c0fa928b7234eb50d.tar.bz2 scummvm-rg350-85c1d35ae378bd149670ac2c0fa928b7234eb50d.zip |
Error out on savegame load failure (again).
svn-id: r34953
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/gui_hof.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_mr.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 1 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/saveload.cpp | 12 |
9 files changed, 24 insertions, 11 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index 1b3413e724..c134745956 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -785,7 +785,7 @@ int GUI_HoF::optionsButton(Button *button) { if (!_loadedSave && _reloadTemporarySave) { _vm->_unkSceneScreenFlag1 = true; - _vm->loadGameState(999); + _vm->loadGameStateCheck(999); //_vm->_saveFileMan->removeSavefile(_vm->getSavegameFilename(999)); _vm->_unkSceneScreenFlag1 = false; } @@ -1195,7 +1195,7 @@ int GUI_HoF::loadMenu(Button *caller) { } else if (_vm->_gameToLoad >= 0) { restorePage1(_vm->_screenBuffer); restorePalette(); - _vm->loadGameState(_vm->_gameToLoad); + _vm->loadGameStateCheck(_vm->_gameToLoad); if (_vm->_gameToLoad == 0) { _restartGame = true; for (int i = 0; i < 23; ++i) diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 64d0c91d24..a778f98ed6 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -658,7 +658,7 @@ int GUI_LoK::loadGameMenu(Button *button) { } else { restorePalette(); if (_vm->_gameToLoad != -1) - _vm->loadGameState(_vm->_gameToLoad); + _vm->loadGameStateCheck(_vm->_gameToLoad); _displayMenu = false; _menuRestoreScreen = false; } diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index 616c235266..e3f250c20e 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -1366,7 +1366,7 @@ int GUI_MR::optionsButton(Button *button) { if (!_loadedSave && _reloadTemporarySave) { _vm->_unkSceneScreenFlag1 = true; - _vm->loadGameState(999); + _vm->loadGameStateCheck(999); //_vm->_saveFileMan->removeSavefile(_vm->getSavegameFilename(999)); _vm->_unkSceneScreenFlag1 = false; } @@ -1408,7 +1408,7 @@ int GUI_MR::loadMenu(Button *caller) { restorePage1(_vm->_screenBuffer); restorePalette(); _vm->_menuDirectlyToLoad = false; - _vm->loadGameState(_vm->_gameToLoad); + _vm->loadGameStateCheck(_vm->_gameToLoad); if (_vm->_gameToLoad == 0) { _restartGame = true; _vm->runStartupScript(1, 1); @@ -1425,7 +1425,7 @@ int GUI_MR::loadSecondChance(Button *button) { _vm->_gameToLoad = 999; restorePage1(_vm->_screenBuffer); - _vm->loadGameState(_vm->_gameToLoad); + _vm->loadGameStateCheck(_vm->_gameToLoad); _displayMenu = false; _loadedSave = true; return 0; diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 9811448cde..3ec6a44338 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -439,7 +439,7 @@ void KyraEngine_HoF::startup() { enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); saveGameState(0, "New Game", 0); } else { - loadGameState(_gameToLoad); + loadGameStateCheck(_gameToLoad); } _screen->showMouse(); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 34be623369..b56a96205e 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -394,7 +394,7 @@ void KyraEngine_LoK::startup() { saveGameState(0, "New game", 0); } else { _screen->setFont(Screen::FID_8_FNT); - loadGameState(_gameToLoad); + loadGameStateCheck(_gameToLoad); _gameToLoad = -1; } } @@ -476,7 +476,7 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990; if (event.kbd.flags == Common::KBD_CTRL) - loadGameState(saveLoadSlot); + loadGameStateCheck(saveLoadSlot); else { char savegameName[14]; sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0'); diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 877a6d4397..823b253534 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -690,7 +690,7 @@ void KyraEngine_MR::startup() { if (_gameToLoad == -1) enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); else - loadGameState(_gameToLoad); + loadGameStateCheck(_gameToLoad); if (_menuDirectlyToLoad) (*_mainButtonData[0].buttonCallback)(&_mainButtonData[0]); diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 2d68dd2315..4ef9f479c8 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -306,6 +306,7 @@ protected: static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, bool loadThumbnail, SaveHeader &header); + void loadGameStateCheck(int slot); virtual Common::Error loadGameState(int slot) = 0; Common::Error saveGameState(int slot, const char *saveName) { return saveGameState(slot, saveName, 0); } virtual Common::Error saveGameState(int slot, const char *saveName, const Graphics::Surface *thumbnail) = 0; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 368c14e29d..3099652af3 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -185,7 +185,7 @@ int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) { int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990; if (event.kbd.flags == Common::KBD_CTRL) { - loadGameState(saveLoadSlot); + loadGameStateCheck(saveLoadSlot); _eventList.clear(); breakLoop = true; } else { diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 9fea2f0ea1..07e770518f 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -251,5 +251,17 @@ void KyraEngine_v1::checkAutosave() { } } +void KyraEngine_v1::loadGameStateCheck(int slot) { + if (loadGameState(slot) != Common::kNoError) { + const char *filename = getSavegameFilename(slot); + Common::String errorMessage = "Could not load savegame: '"; + errorMessage += filename; + errorMessage += "'"; + + GUIErrorMessage(errorMessage); + error(errorMessage.c_str()); + } +} + } // end of namespace Kyra |