[Scummvm-git-logs] scummvm master -> aa8cabd18f3b40f6bd9c67b8a97e432bd13ec34e
orgads
noreply at scummvm.org
Wed Nov 24 07:07:07 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:
aa8cabd18f ENGINE: Suppress autosave overwrite warning when description is empty
Commit: aa8cabd18f3b40f6bd9c67b8a97e432bd13ec34e
https://github.com/scummvm/scummvm/commit/aa8cabd18f3b40f6bd9c67b8a97e432bd13ec34e
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-11-24T09:07:03+02:00
Commit Message:
ENGINE: Suppress autosave overwrite warning when description is empty
Some engines (like kyra) return a SaveStateDescriptor with slot assigned,
even when the slot is free. The indication for an empty save is empty
description on these cases.
Changed paths:
engines/engine.cpp
engines/savestate.cpp
engines/savestate.h
diff --git a/engines/engine.cpp b/engines/engine.cpp
index bfaa53f3e0..9068eefd5b 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -567,9 +567,7 @@ void Engine::handleAutoSave() {
bool Engine::warnBeforeOverwritingAutosave() {
SaveStateDescriptor desc = getMetaEngine()->querySaveMetaInfos(
_targetName.c_str(), getAutosaveSlot());
- if (desc.getSaveSlot() == -1)
- return true;
- if (desc.hasAutosaveName())
+ if (!desc.isValid() || desc.hasAutosaveName())
return true;
Common::U32StringArray altButtons;
altButtons.push_back(_("Overwrite"));
diff --git a/engines/savestate.cpp b/engines/savestate.cpp
index e7180119c1..3b4b539016 100644
--- a/engines/savestate.cpp
+++ b/engines/savestate.cpp
@@ -98,3 +98,8 @@ bool SaveStateDescriptor::hasAutosaveName() const
{
return _description.contains(_("Autosave"));
}
+
+bool SaveStateDescriptor::isValid() const
+{
+ return _slot >= 0 && !_description.empty();
+}
diff --git a/engines/savestate.h b/engines/savestate.h
index 510ed235f0..15bbb6a66e 100644
--- a/engines/savestate.h
+++ b/engines/savestate.h
@@ -221,6 +221,11 @@ public:
* Returns true if the save has an autosave name
*/
bool hasAutosaveName() const;
+
+ /**
+ * Returns true if this entry is valid
+ */
+ bool isValid() const;
private:
/**
* The saveslot id, as it would be passed to the "-x" command line switch.
More information about the Scummvm-git-logs
mailing list