diff options
author | Bastien Bouclet | 2018-05-26 09:01:57 +0200 |
---|---|---|
committer | GitHub | 2018-05-26 09:01:57 +0200 |
commit | 2925d2ef2fde54a86fe65d79f9e15c01f08f3f49 (patch) | |
tree | 3365369d4d88f3f5b0266ee06d38867aa2258d81 /engines | |
parent | ac5f61265f9101a29a4fa87177036ff39e68ecaa (diff) | |
parent | 0d88be5e05ffc5d00e88f735d538042694e7f2f6 (diff) | |
download | scummvm-rg350-2925d2ef2fde54a86fe65d79f9e15c01f08f3f49.tar.gz scummvm-rg350-2925d2ef2fde54a86fe65d79f9e15c01f08f3f49.tar.bz2 scummvm-rg350-2925d2ef2fde54a86fe65d79f9e15c01f08f3f49.zip |
Merge pull request #1198 from dafioram/mohawk10536
MOHAWK: README: Minor autosave changes and notes for autosaving
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/myst_state.cpp | 16 | ||||
-rw-r--r-- | engines/mohawk/riven_saveload.cpp | 3 |
2 files changed, 14 insertions, 5 deletions
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp index efc5025de5..c65ece55d5 100644 --- a/engines/mohawk/myst_state.cpp +++ b/engines/mohawk/myst_state.cpp @@ -259,12 +259,19 @@ bool MystGameState::saveMetadata(int slot) { bool MystGameState::isAutoSaveAllowed() { // Open autosave slot and see if it an autosave // Autosaving will be enabled if it is an autosave or if there is no save in that slot - Common::String filename = buildMetadataFilename(kAutoSaveSlot); - Common::ScopedPtr<Common::InSaveFile> metadataFile(g_system->getSavefileManager()->openForLoading(filename)); - if (!metadataFile) { // There is no save in the autosave slot, enable autosave + + Common::String dataFilename = buildSaveFilename(kAutoSaveSlot); + Common::ScopedPtr<Common::InSaveFile> dataFile(g_system->getSavefileManager()->openForLoading(dataFilename)); + if (!dataFile) { // Cannot load non-meta file, enable autosave return true; } + Common::String metaFilename = buildMetadataFilename(kAutoSaveSlot); + Common::ScopedPtr<Common::InSaveFile> metadataFile(g_system->getSavefileManager()->openForLoading(metaFilename)); + if (!metadataFile) { // Can load non-meta file, but not metafile, could be a save from the original, disable autosave + return false; + } + Common::Serializer m(metadataFile.get(), nullptr); // Read the metadata file @@ -302,7 +309,8 @@ SaveStateDescriptor MystGameState::querySaveMetaInfos(int slot) { desc.setSaveDate(metadata.saveYear, metadata.saveMonth, metadata.saveDay); desc.setSaveTime(metadata.saveHour, metadata.saveMinute); desc.setPlayTime(metadata.totalPlayTime); - desc.setDeletableFlag(slot != kAutoSaveSlot); + if (metadata.autoSave) // Allow non-saves to be deleted, but not autosaves + desc.setDeletableFlag(slot != kAutoSaveSlot); Graphics::Surface *thumbnail; if (!Graphics::loadThumbnail(*metadataFile, thumbnail)) { diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 5ba0e51f8c..e8d29a0c24 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -142,7 +142,8 @@ SaveStateDescriptor RivenSaveLoad::querySaveMetaInfos(const int slot) { descriptor.setPlayTime(metadata.totalPlayTime); descriptor.setSaveDate(metadata.saveYear, metadata.saveMonth, metadata.saveDay); descriptor.setSaveTime(metadata.saveHour, metadata.saveMinute); - descriptor.setDeletableFlag(slot != kAutoSaveSlot); + if (metadata.autoSave) // Allow non-saves to be deleted, but not autosaves + descriptor.setDeletableFlag(slot != kAutoSaveSlot); delete metaStream; |