[Scummvm-git-logs] scummvm master -> fad953b0884d4ad9349b3897663986f95751f434
sev-
noreply at scummvm.org
Wed Nov 22 17:42:52 UTC 2023
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:
fad953b088 SLUDGE: Sort saves alphabetically, matching the original behaviour
Commit: fad953b0884d4ad9349b3897663986f95751f434
https://github.com/scummvm/scummvm/commit/fad953b0884d4ad9349b3897663986f95751f434
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-11-22T18:42:41+01:00
Commit Message:
SLUDGE: Sort saves alphabetically, matching the original behaviour
Changed paths:
engines/sludge/variable.cpp
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index a083e9c140a..9b67371fca4 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -188,6 +188,10 @@ int StackHandler::getStackSize() const {
return r;
}
+static int stringCompareToIgnoreCase(const Common::String &s1, const Common::String &s2) {
+ return s1.compareToIgnoreCase(s2) > 0;
+}
+
bool StackHandler::getSavedGamesStack(const Common::String &ext) {
// Make pattern
uint len = ext.size();
@@ -197,11 +201,14 @@ bool StackHandler::getSavedGamesStack(const Common::String &ext) {
// Get all saved files
Common::StringArray sa = g_system->getSavefileManager()->listSavefiles(pattern);
+ Common::sort(sa.begin(), sa.end(), stringCompareToIgnoreCase);
+
+
// Save file names to stacks
Variable newName;
newName.varType = SVT_NULL;
- Common::StringArray::iterator it;
- for (it = sa.begin(); it != sa.end(); ++it) {
+
+ for (Common::StringArray::iterator it = sa.begin(); it != sa.end(); ++it) {
(*it).erase((*it).size() - len, len);
newName.makeTextVar((*it));
if (!addVarToStack(newName, first))
More information about the Scummvm-git-logs
mailing list