summaryrefslogtreecommitdiff
path: root/src/newgrf_gui.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-04-11 21:26:02 +0200
committerPeterN <peter@fuzzle.org>2019-04-13 12:49:18 +0100
commit2db88953e7e0e521b4514f356038eeb36b299dff (patch)
tree0f058052645065811ffa58deaee2e592583587b5 /src/newgrf_gui.cpp
parentb9b34f676b96e29ec91711bd7ff74d2492424655 (diff)
downloadopenttd-2db88953e7e0e521b4514f356038eeb36b299dff.tar.xz
Codechange: use std::sort() in GUIList
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r--src/newgrf_gui.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index aa8764f3c..d31d10bc8 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -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 */