aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2014-12-29 14:56:02 +0100
committerJohannes Schickel2014-12-29 14:59:13 +0100
commitbbfff93c6455247d9875003cdfd18c09d0c30e0f (patch)
tree0b0a2eddfdf9c322872d078a4ce2c906ffa03043
parentf4d5b150f1e4b786f2f6f79a1acd3315da9a8699 (diff)
downloadscummvm-rg350-bbfff93c6455247d9875003cdfd18c09d0c30e0f.tar.gz
scummvm-rg350-bbfff93c6455247d9875003cdfd18c09d0c30e0f.tar.bz2
scummvm-rg350-bbfff93c6455247d9875003cdfd18c09d0c30e0f.zip
GUI: Do not overwrite write protected saves in grid based save dialog.
This fixes overwriting of, for example, autosaves in the grid based save load dialog when using "New Save".
-rw-r--r--gui/saveload-dialog.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 339ec95c50..a333c5fe57 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -654,16 +654,25 @@ void SaveLoadChooserGrid::open() {
// In case there was a gap found use the slot.
if (lastSlot + 1 < curSlot) {
- _nextFreeSaveSlot = lastSlot + 1;
- break;
+ // Check that the save slot can be used for user saves.
+ SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), lastSlot + 1);
+ if (!desc.getWriteProtectedFlag()) {
+ _nextFreeSaveSlot = lastSlot + 1;
+ break;
+ }
}
lastSlot = curSlot;
}
// Use the next available slot otherwise.
- if (_nextFreeSaveSlot == -1 && lastSlot + 1 < _metaEngine->getMaximumSaveSlot()) {
- _nextFreeSaveSlot = lastSlot + 1;
+ const int maxSlot = _metaEngine->getMaximumSaveSlot();
+ for (int i = lastSlot; _nextFreeSaveSlot == -1 && i < maxSlot; ++i) {
+ // Check that the save slot can be used for user saves.
+ SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), i + 1);
+ if (!desc.getWriteProtectedFlag()) {
+ _nextFreeSaveSlot = i + 1;
+ }
}
}