diff options
author | glx <glx@openttd.org> | 2019-04-11 21:26:02 +0200 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-04-13 12:49:18 +0100 |
commit | 2db88953e7e0e521b4514f356038eeb36b299dff (patch) | |
tree | 0f058052645065811ffa58deaee2e592583587b5 /src/group_gui.cpp | |
parent | b9b34f676b96e29ec91711bd7ff74d2492424655 (diff) | |
download | openttd-2db88953e7e0e521b4514f356038eeb36b299dff.tar.xz |
Codechange: use std::sort() in GUIList
Diffstat (limited to 'src/group_gui.cpp')
-rw-r--r-- | src/group_gui.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 19e6b6e31..8cca33268 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -144,26 +144,26 @@ private: } /** Sort the groups by their name */ - static int CDECL GroupNameSorter(const Group * const *a, const Group * const *b) + static bool GroupNameSorter(const Group * const &a, const Group * const &b) { static const Group *last_group[2] = { nullptr, nullptr }; static char last_name[2][64] = { "", "" }; - if (*a != last_group[0]) { - last_group[0] = *a; - SetDParam(0, (*a)->index); + if (a != last_group[0]) { + last_group[0] = a; + SetDParam(0, a->index); GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0])); } - if (*b != last_group[1]) { - last_group[1] = *b; - SetDParam(0, (*b)->index); + if (b != last_group[1]) { + last_group[1] = b; + SetDParam(0, b->index); GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1])); } int r = strnatcmp(last_name[0], last_name[1]); // Sort by name (natural sorting). - if (r == 0) return (*a)->index - (*b)->index; - return r; + if (r == 0) return a->index < b->index; + return r < 0; } /** |