[Scummvm-cvs-logs] scummvm master -> bbfff93c6455247d9875003cdfd18c09d0c30e0f

lordhoto lordhoto at gmail.com
Mon Dec 29 15:21:56 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bbfff93c64 GUI: Do not overwrite write protected saves in grid based save dialog.


Commit: bbfff93c6455247d9875003cdfd18c09d0c30e0f
    https://github.com/scummvm/scummvm/commit/bbfff93c6455247d9875003cdfd18c09d0c30e0f
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-12-29T14:59:13+01:00

Commit Message:
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".

Changed paths:
    gui/saveload-dialog.cpp



diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 339ec95..a333c5f 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;
+			}
 		}
 	}
 






More information about the Scummvm-git-logs mailing list