SCI: Hopefully fix bug #3565505 - "SCI : crash when loading a savegame"

This bug occurs because in the cases specified in the bug report, the main
loop hasn't run fully yet, and there is a mini loop running instead (e.g.
inside Print())
Hopefully, this catches most cases where the crash occurs, but it needs more
testing to find if there is any other such case.
This commit is contained in:
Filippos Karapetis 2012-10-13 21:06:02 +03:00
parent b91a132763
commit 76ff4c7001

View File

@ -834,12 +834,16 @@ Common::Error SciEngine::saveGameState(int slot, const Common::String &desc) {
return Common::kNoError;
}
// Before enabling the load option in the ScummVM menu, the main game loop must
// have run at least once. When the game loop runs, kGameIsRestarting is invoked,
// thus the speed throttler is initialized. Hopefully fixes bug #3565505.
bool SciEngine::canLoadGameStateCurrently() {
return !_gamestate->executionStackBase;
return !_gamestate->executionStackBase && (_gamestate->_throttleLastTime > 0 || _gamestate->_throttleTrigger);
}
bool SciEngine::canSaveGameStateCurrently() {
return !_gamestate->executionStackBase;
return !_gamestate->executionStackBase && (_gamestate->_throttleLastTime > 0 || _gamestate->_throttleTrigger);
}
} // End of namespace Sci