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/signs_gui.cpp | |
parent | b9b34f676b96e29ec91711bd7ff74d2492424655 (diff) | |
download | openttd-2db88953e7e0e521b4514f356038eeb36b299dff.tar.xz |
Codechange: use std::sort() in GUIList
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r-- | src/signs_gui.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index a06898af7..d346ec185 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -72,21 +72,21 @@ struct SignList { } /** Sort signs by their name */ - static int CDECL SignNameSorter(const Sign * const *a, const Sign * const *b) + static bool SignNameSorter(const Sign * const &a, const Sign * const &b) { /* Signs are very very rarely using the default text, but there can also be * a lot of them. Therefore a worthwhile performance gain can be made by * directly comparing Sign::name instead of going through the string * system for each comparison. */ - const char *a_name = (*a)->name; - const char *b_name = (*b)->name; + const char *a_name = a->name; + const char *b_name = b->name; if (a_name == nullptr) a_name = SignList::default_name; if (b_name == nullptr) b_name = SignList::default_name; int r = strnatcmp(a_name, b_name); // Sort by name (natural sorting). - return r != 0 ? r : ((*a)->index - (*b)->index); + return r != 0 ? r < 0 : (a->index < b->index); } void SortSignsList() |