Fix #7526, 5b77102b6: FiosItem::operator< must return false for equality (#7528)

This commit is contained in:
glx22 2019-04-19 18:48:01 +02:00 committed by GitHub
parent ebd4f32d15
commit 66a8db9dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -52,16 +52,15 @@ extern void GetOldSaveGameName(const char *file, char *title, const char *last);
*/ */
bool FiosItem::operator< (const FiosItem &other) const bool FiosItem::operator< (const FiosItem &other) const
{ {
bool r = false; int r = false;
if ((_savegame_sort_order & SORT_BY_NAME) == 0 && (*this).mtime != other.mtime) { if ((_savegame_sort_order & SORT_BY_NAME) == 0 && (*this).mtime != other.mtime) {
r = (*this).mtime < other.mtime; r = (*this).mtime - other.mtime;
} else { } else {
r = strcasecmp((*this).title, other.title) < 0; r = strcasecmp((*this).title, other.title);
} }
if (r == 0) return false;
if (_savegame_sort_order & SORT_DESCENDING) r = !r; return (_savegame_sort_order & SORT_DESCENDING) ? r > 0 : r < 0;
return r;
} }
FileList::~FileList() FileList::~FileList()