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
This commit is contained in:
Filippos Karapetis 2010-07-22 12:38:48 +00:00
parent a01152a3ba
commit 8eca9d6acb
3 changed files with 4 additions and 4 deletions

View file

@ -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) {

View file

@ -934,8 +934,6 @@ 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->variablesSegment[VAR_TEMP] = s->variablesSegment[VAR_PARAM] = s->_segMan->findSegmentByType(SEG_TYPE_STACK);

View file

@ -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
}