mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
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.
This commit is contained in:
parent
d794b2390a
commit
0d364029fc
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user