SCUMM: Improve autosave handling

v5+ scripts can request saving/loading of savegames, this type of
savegame is internally called a "temporary" savegame
(_saveStateTemporary == true) which is invisible to the user (I'm not
sure whether this is by design or not).

Currently the savegame handling in scummLoop_handleSaveLoad() doesn't
distinguish between such temporary savegames and normal autosaves and
unconditionally resets _lastSaveTime (even after loading).
This has the unwanted side effect of potentially delaying the creation
of normal autosaves which are supposed to be created in accordance with
the autosave period setting in the GUI.

This commit makes sure that _lastSaveTime only gets updated if and only
if saving a (non-temporary) autosave.
This commit is contained in:
Adrian Frühwirth 2018-05-03 10:20:51 +02:00
parent 9482347928
commit 8cb0109b40

View File

@ -2435,6 +2435,9 @@ void ScummEngine::scummLoop_handleSaveLoad() {
if (success && _saveTemporaryState && VAR_GAME_LOADED != 0xFF && _game.version <= 7)
VAR(VAR_GAME_LOADED) = 201;
if (!_saveTemporaryState)
_lastSaveTime = _system->getMillis();
} else {
success = loadState(_saveLoadSlot, _saveTemporaryState, filename);
if (!success)
@ -2458,7 +2461,6 @@ void ScummEngine::scummLoop_handleSaveLoad() {
clearClickedStatus();
_saveLoadFlag = 0;
_lastSaveTime = _system->getMillis();
}
}