aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDavid Fioramonti2018-05-21 18:07:46 -0700
committerDavid Fioramonti2018-05-22 19:47:00 -0700
commit0500096703dba668e56b5ebb37c7ba5a58c32f0d (patch)
tree717706b204118991909f503cbe5cd65625eed7d1 /engines
parentae2637e36e7e09f9b3061d5b70f5a9f8fe5858c3 (diff)
downloadscummvm-rg350-0500096703dba668e56b5ebb37c7ba5a58c32f0d.tar.gz
scummvm-rg350-0500096703dba668e56b5ebb37c7ba5a58c32f0d.tar.bz2
scummvm-rg350-0500096703dba668e56b5ebb37c7ba5a58c32f0d.zip
MOHAWK: MYST: Do not autosave over saves from the original
The previous logic was enabling autosaving if the metadata file was not present, but saves from the original don't have metadata. Now it checks if the non-metadata file can be loaded to determine if the slot is empty.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst_state.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index efc5025de5..a1077a71f1 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