diff options
author | glx22 <glx@openttd.org> | 2021-01-01 00:37:29 +0100 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2021-01-01 01:04:27 +0100 |
commit | 7222bc5814ebe3430e6cef17f12fb3fcd5ad5eb6 (patch) | |
tree | ff1d26460b3d0e32eb084678d277922c7063ab94 | |
parent | a7fee48b7f4ae58166b0ea93ecd532f419654595 (diff) | |
download | openttd-7222bc5814ebe3430e6cef17f12fb3fcd5ad5eb6.tar.xz |
Cleanup 2db88953e7: Remove VL_FIRST_SORT as it's useless
-rw-r--r-- | src/sortlist_type.h | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/sortlist_type.h b/src/sortlist_type.h index e5bfe06a9..9c14d382b 100644 --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -21,9 +21,8 @@ enum SortListFlags { VL_DESC = 1 << 0, ///< sort descending or ascending VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop VL_REBUILD = 1 << 2, ///< rebuild the sort list - VL_FIRST_SORT = 1 << 3, ///< sort with quick sort first - VL_FILTER = 1 << 4, ///< filter disabled/enabled - VL_END = 1 << 5, + VL_FILTER = 1 << 3, ///< filter disabled/enabled + VL_END = 1 << 4, }; DECLARE_ENUM_AS_BIT_SET(SortListFlags) @@ -80,7 +79,7 @@ public: GUIList() : sort_func_list(nullptr), filter_func_list(nullptr), - flags(VL_FIRST_SORT), + flags(VL_NONE), sort_type(0), filter_type(0), resort_timer(1) @@ -104,7 +103,7 @@ public: void SetSortType(uint8 n_type) { if (this->sort_type != n_type) { - SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT); + SETBITS(this->flags, VL_RESORT); this->sort_type = n_type; } } @@ -136,8 +135,6 @@ public: CLRBITS(this->flags, VL_DESC); } this->sort_type = l.criteria; - - SETBITS(this->flags, VL_FIRST_SORT); } /** @@ -242,10 +239,6 @@ public: /** * Sort the list. - * For the first sorting we use quick sort since it is - * faster for irregular sorted data. After that we - * use gsort. - * * @param compare The function to compare two list items * @return true if the list sequence has been altered * @@ -265,13 +258,6 @@ public: const bool desc = (this->flags & VL_DESC) != 0; - if (this->flags & VL_FIRST_SORT) { - CLRBITS(this->flags, VL_FIRST_SORT); - - std::sort(std::vector<T>::begin(), std::vector<T>::end(), [&](const T &a, const T &b) { return desc ? compare(b, a) : compare(a, b); }); - return true; - } - std::sort(std::vector<T>::begin(), std::vector<T>::end(), [&](const T &a, const T &b) { return desc ? compare(b, a) : compare(a, b); }); return true; } @@ -394,7 +380,7 @@ public: void RebuildDone() { CLRBITS(this->flags, VL_REBUILD); - SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT); + SETBITS(this->flags, VL_RESORT); } }; |