diff options
author | Filippos Karapetis | 2010-07-22 12:38:48 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-07-22 12:38:48 +0000 |
commit | 8eca9d6acb55ae121145ca5779c493244a6499f3 (patch) | |
tree | cb90af6022b1310c4bb5241f139ba1d261c51bd8 /engines | |
parent | a01152a3bacdeec06a4206b939bcfc1dc2c8ee65 (diff) | |
download | scummvm-rg350-8eca9d6acb55ae121145ca5779c493244a6499f3.tar.gz scummvm-rg350-8eca9d6acb55ae121145ca5779c493244a6499f3.tar.bz2 scummvm-rg350-8eca9d6acb55ae121145ca5779c493244a6499f3.zip |
SCI: Fixed a bug when loading some saved games (sometimes, the execution stack wasn't cleared properly when loading and you couldn't save or restore)
svn-id: r51140
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 4 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 5690969065..c080120d7b 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -805,7 +805,6 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { s->_msgState = new MessageState(s->_segMan); s->abortScriptProcessing = kAbortLoadGame; - s->shrinkStackToBase(); } bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata *meta) { diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index ada6d8ed92..61cc4c429a 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -934,9 +934,7 @@ void run_vm(EngineState *s) { if (!local_script) error("run_vm(): program counter gone astray (local_script pointer is null)"); - // TODO: Revise this - if (s->abortScriptProcessing != kAbortLoadGame) - s->executionStackBase = s->_executionStack.size() - 1; + s->executionStackBase = s->_executionStack.size() - 1; s->variablesSegment[VAR_TEMP] = s->variablesSegment[VAR_PARAM] = s->_segMan->findSegmentByType(SEG_TYPE_STACK); s->variablesBase[VAR_TEMP] = s->variablesBase[VAR_PARAM] = s->stack_base; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 16984639af..2dfcf076ab 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -414,13 +414,16 @@ void SciEngine::runGame() { exitGame(); if (_gamestate->abortScriptProcessing == kAbortRestartGame) { + _gamestate->abortScriptProcessing = kAbortNone; _gamestate->_segMan->resetSegMan(); initGame(); initStackBaseWithSelector(SELECTOR(play)); _gamestate->gameWasRestarted = true; } else if (_gamestate->abortScriptProcessing == kAbortLoadGame) { _gamestate->abortScriptProcessing = kAbortNone; + _gamestate->_executionStack.clear(); initStackBaseWithSelector(SELECTOR(replay)); + _gamestate->shrinkStackToBase(); } else { break; // exit loop } |