[Scummvm-git-logs] scummvm master -> 18ee050adf2e42e8f5719f2ce5195e7b15b9f9ac

criezy criezy at scummvm.org
Sat Aug 28 12:49:17 UTC 2021


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:
18ee050adf GUI: Only display autosave warning if there are normal saves in autosave slots


Commit: 18ee050adf2e42e8f5719f2ce5195e7b15b9f9ac
    https://github.com/scummvm/scummvm/commit/18ee050adf2e42e8f5719f2ce5195e7b15b9f9ac
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-08-28T13:48:53+01:00

Commit Message:
GUI: Only display autosave warning if there are normal saves in autosave slots

This fixes bug #12845.

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 90be14d544..5a880d24bb 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2520,44 +2520,46 @@ bool GlobalOptionsDialog::updateAutosavePeriod(int newValue) {
 			}
 		}
 	}
-	Common::U32StringArray altButtons;
-	altButtons.push_back(_("Ignore"));
-	altButtons.push_back(_("Disable autosave"));
-	Common::U32String message = _("WARNING: Autosave was enabled. Some of your games have existing "
+	if (!saveList.empty()) {
+		Common::U32StringArray altButtons;
+		altButtons.push_back(_("Ignore"));
+		altButtons.push_back(_("Disable autosave"));
+		Common::U32String message = _("WARNING: Autosave was enabled. Some of your games have existing "
 				  "saved games on the autosave slot. You can either move the "
 				  "existing saves to new slots, disable autosave, or ignore (you "
 				  "will be prompted when autosave is about to overwrite a save).\n"
 				  "List of games:\n");
-	for (ExistingSaveList::const_iterator it = saveList.begin(), end = saveList.end(); it != end; ++it)
-		message += Common::U32String(it->target) + Common::U32String(": ") + it->desc.getDescription() + "\n";
-	message.deleteLastChar();
-	if (hasMore)
-		message += _("\nAnd more...");
-	GUI::MessageDialog warn(message, _("Move"), altButtons);
-	switch (warn.runModal()) {
-	case GUI::kMessageOK: {
-		ExistingSaveList failedSaves;
-		for (ExistingSaveList::const_iterator it = saveList.begin(), end = saveList.end(); it != end; ++it) {
-			if (it->metaEngine->copySaveFileToFreeSlot(it->target.c_str(), it->desc.getSaveSlot())) {
-				g_system->getSavefileManager()->removeSavefile(
+		for (ExistingSaveList::const_iterator it = saveList.begin(), end = saveList.end(); it != end; ++it)
+			message += Common::U32String(it->target) + Common::U32String(": ") + it->desc.getDescription() + "\n";
+		message.deleteLastChar();
+		if (hasMore)
+			message += _("\nAnd more...");
+		GUI::MessageDialog warn(message, _("Move"), altButtons);
+		switch (warn.runModal()) {
+		case GUI::kMessageOK: {
+			ExistingSaveList failedSaves;
+			for (ExistingSaveList::const_iterator it = saveList.begin(), end = saveList.end(); it != end; ++it) {
+				if (it->metaEngine->copySaveFileToFreeSlot(it->target.c_str(), it->desc.getSaveSlot())) {
+					g_system->getSavefileManager()->removeSavefile(
 							it->metaEngine->getSavegameFile(it->desc.getSaveSlot(), it->target.c_str()));
-			} else {
-				failedSaves.push_back(*it);
+				} else {
+					failedSaves.push_back(*it);
+				}
 			}
+			if (!failedSaves.empty()) {
+				Common::U32String failMessage = _("ERROR: Failed to move the following saved games:\n");
+				for (ExistingSaveList::const_iterator it = failedSaves.begin(), end = failedSaves.end(); it != end; ++it)
+					failMessage += Common::U32String(it->target) + Common::U32String(": ") + it->desc.getDescription() + "\n";
+				failMessage.deleteLastChar();
+				GUI::MessageDialog(failMessage).runModal();
+			}
+			break;
 		}
-		if (!failedSaves.empty()) {
-			Common::U32String failMessage = _("ERROR: Failed to move the following saved games:\n");
-			for (ExistingSaveList::const_iterator it = failedSaves.begin(), end = failedSaves.end(); it != end; ++it)
-				failMessage += Common::U32String(it->target) + Common::U32String(": ") + it->desc.getDescription() + "\n";
-			failMessage.deleteLastChar();
-			GUI::MessageDialog(failMessage).runModal();
+		case GUI::kMessageAlt:
+			break;
+		case GUI::kMessageAlt + 1:
+			return false;
 		}
-		break;
-	}
-	case GUI::kMessageAlt:
-		break;
-	case GUI::kMessageAlt + 1:
-		return false;
 	}
 	return true;
 }




More information about the Scummvm-git-logs mailing list