ENGINES: Properly identify the autosave file

Restructure isAutosave() function:
- Prioritize name test
- Access saveType test only if name test fails
Performs both tests when required, resolving false positives unique to each test, and ensures that only saves which fail both tests appear in autosave warning dialogs.

Properly fixes [https://bugs.scummvm.org/ticket/12363 #12363], refer [https://bugs.scummvm.org/ticket/13842 #13842]
This commit is contained in:
macca8 2022-10-25 10:37:01 +11:00 committed by GitHub
parent ca717aeca4
commit 572b3a5f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -86,11 +86,7 @@ void SaveStateDescriptor::setAutosave(bool autosave) {
}
bool SaveStateDescriptor::isAutosave() const {
if (_saveType != kSaveTypeUndetermined) {
return _saveType == kSaveTypeAutosave;
} else {
return hasAutosaveName();
}
return hasAutoSaveName() || _saveType == kSaveTypeAutosave;
}
bool SaveStateDescriptor::hasAutosaveName() const

View file

@ -2688,7 +2688,7 @@ bool GlobalOptionsDialog::updateAutosavePeriod(int newValue) {
if (autoSaveSlot < 0)
continue;
SaveStateDescriptor desc = metaEngine.querySaveMetaInfos(target.c_str(), autoSaveSlot);
if (desc.getSaveSlot() != -1 && !desc.getDescription().empty() && !desc.hasAutosaveName()) {
if (desc.getSaveSlot() != -1 && !desc.getDescription().empty() && !desc.isAutosave()) {
if (saveList.size() >= maxListSize) {
hasMore = true;
break;