Codechange: use std::sort() in GUIList

This commit is contained in:
glx
2019-04-11 21:26:02 +02:00
committed by PeterN
parent b9b34f676b
commit 2db88953e7
14 changed files with 189 additions and 188 deletions

View File

@@ -1426,15 +1426,15 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
private:
/** Sort grfs by name. */
static int CDECL NameSorter(const GRFConfig * const *a, const GRFConfig * const *b)
static bool NameSorter(const GRFConfig * const &a, const GRFConfig * const &b)
{
int i = strnatcmp((*a)->GetName(), (*b)->GetName(), true); // Sort by name (natural sorting).
if (i != 0) return i;
int i = strnatcmp(a->GetName(), b->GetName(), true); // Sort by name (natural sorting).
if (i != 0) return i < 0;
i = (*a)->version - (*b)->version;
if (i != 0) return i;
i = a->version - b->version;
if (i != 0) return i < 0;
return memcmp((*a)->ident.md5sum, (*b)->ident.md5sum, lengthof((*b)->ident.md5sum));
return memcmp(a->ident.md5sum, b->ident.md5sum, lengthof(b->ident.md5sum)) < 0;
}
/** Filter grfs by tags/name */