[Scummvm-git-logs] scummvm master -> 0d364029fcca6281daab7790a74349ba2c08e5de
Die4Ever
noreply at scummvm.org
Thu Jan 13 08:53:03 UTC 2022
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:
0d364029fc ENGINES: Fix autosave name check (#3648)
Commit: 0d364029fcca6281daab7790a74349ba2c08e5de
https://github.com/scummvm/scummvm/commit/0d364029fcca6281daab7790a74349ba2c08e5de
Author: Die4Ever (30947252+Die4Ever at users.noreply.github.com)
Date: 2022-01-13T02:52:59-06:00
Commit Message:
ENGINES: Fix autosave name check (#3648)
The length of the German translation for Autosave is 23 characters. Save names in Groovie are limited to 15 characters, and it's probably not the only engine with a similar limit. This meant you would get a warning on every autosave, even though you just told it to overwrite. Mminimum of 14 characters for confidence that the name is a match and not a false positive.
Changed paths:
engines/savestate.cpp
diff --git a/engines/savestate.cpp b/engines/savestate.cpp
index 839d94dbfb7..6da9200be83 100644
--- a/engines/savestate.cpp
+++ b/engines/savestate.cpp
@@ -95,7 +95,16 @@ bool SaveStateDescriptor::isAutosave() const {
bool SaveStateDescriptor::hasAutosaveName() const
{
- return _description.contains(_("Autosave"));
+ const Common::U32String &autosave = _("Autosave");
+
+ // if the save file name is long enough, just check if it starts with "Autosave"
+ if (_description.size() >= autosave.size())
+ return _description.substr(0, autosave.size()) == autosave;
+
+ // if the save name has been trimmed, as long as it isn't too short, use fallback logic
+ if (_description.size() < 14)
+ return false;
+ return autosave.substr(0, _description.size()) == _description;
}
bool SaveStateDescriptor::isValid() const
More information about the Scummvm-git-logs
mailing list