ENGINES: If an autosave can't be created, try again in 5 minutes

This commit is contained in:
Paul Gilbert 2020-02-09 16:21:27 -08:00 committed by Paul Gilbert
parent 1687427e8e
commit 510818499d

View File

@ -494,8 +494,17 @@ void Engine::handleAutoSave() {
}
void Engine::saveAutosaveIfEnabled() {
if (_autosaveInterval != 0 && canSaveAutosaveCurrently())
saveGameState(getAutosaveSlot(), _("Autosave"), true);
if (_autosaveInterval != 0) {
bool canSave = canSaveAutosaveCurrently();
if (!canSave || saveGameState(getAutosaveSlot(), _("Autosave"), true).getCode() != Common::kNoError) {
// Couldn't autosave at the designated time. Rather than wait until
// the next autosave interval, which may be some time, set the next
// interval to be in five minutes time
_lastAutosaveTime = _system->getMillis() + (5 * 60 * 1000) - _autosaveInterval;
return;
}
}
// Reset the last autosave time
_lastAutosaveTime = _system->getMillis();