Exclude parent item from directory sort in FiosGetFileList

This commit is contained in:
Jonathan G Rennison 2024-09-17 22:03:56 +01:00
parent d13b28c34c
commit 7eddb72585

View File

@ -358,7 +358,7 @@ static void FiosGetFileList(SaveLoadOperation fop, bool show_dirs, fios_getlist_
struct dirent *dirent;
DIR *dir;
FiosItem *fios;
size_t sort_start;
size_t sort_start = 0;
file_list.clear();
@ -372,6 +372,7 @@ static void FiosGetFileList(SaveLoadOperation fop, bool show_dirs, fios_getlist_
fios->name = "..";
SetDParamStr(0, "..");
fios->title = GetString(STR_SAVELOAD_PARENT_DIRECTORY);
sort_start = file_list.size();
}
/* Show subdirectories */
@ -398,7 +399,7 @@ static void FiosGetFileList(SaveLoadOperation fop, bool show_dirs, fios_getlist_
if (show_dirs) {
SortingBits order = _savegame_sort_order;
_savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING;
std::sort(file_list.begin(), file_list.end());
std::sort(file_list.begin() + sort_start, file_list.end());
_savegame_sort_order = order;
}