mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-08 20:07:11 +00:00
SLUDGE: Sort saves alphabetically, matching the original behaviour
This commit is contained in:
parent
3af9526fff
commit
fad953b088
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user