mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Cleanup 2db88953e7
: Remove VL_FIRST_SORT as it's useless
This commit is contained in:
parent
a7fee48b7f
commit
7222bc5814
@ -21,9 +21,8 @@ enum SortListFlags {
|
|||||||
VL_DESC = 1 << 0, ///< sort descending or ascending
|
VL_DESC = 1 << 0, ///< sort descending or ascending
|
||||||
VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop
|
VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop
|
||||||
VL_REBUILD = 1 << 2, ///< rebuild the sort list
|
VL_REBUILD = 1 << 2, ///< rebuild the sort list
|
||||||
VL_FIRST_SORT = 1 << 3, ///< sort with quick sort first
|
VL_FILTER = 1 << 3, ///< filter disabled/enabled
|
||||||
VL_FILTER = 1 << 4, ///< filter disabled/enabled
|
VL_END = 1 << 4,
|
||||||
VL_END = 1 << 5,
|
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(SortListFlags)
|
DECLARE_ENUM_AS_BIT_SET(SortListFlags)
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ public:
|
|||||||
GUIList() :
|
GUIList() :
|
||||||
sort_func_list(nullptr),
|
sort_func_list(nullptr),
|
||||||
filter_func_list(nullptr),
|
filter_func_list(nullptr),
|
||||||
flags(VL_FIRST_SORT),
|
flags(VL_NONE),
|
||||||
sort_type(0),
|
sort_type(0),
|
||||||
filter_type(0),
|
filter_type(0),
|
||||||
resort_timer(1)
|
resort_timer(1)
|
||||||
@ -104,7 +103,7 @@ public:
|
|||||||
void SetSortType(uint8 n_type)
|
void SetSortType(uint8 n_type)
|
||||||
{
|
{
|
||||||
if (this->sort_type != 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;
|
this->sort_type = n_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,8 +135,6 @@ public:
|
|||||||
CLRBITS(this->flags, VL_DESC);
|
CLRBITS(this->flags, VL_DESC);
|
||||||
}
|
}
|
||||||
this->sort_type = l.criteria;
|
this->sort_type = l.criteria;
|
||||||
|
|
||||||
SETBITS(this->flags, VL_FIRST_SORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,10 +239,6 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the list.
|
* 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
|
* @param compare The function to compare two list items
|
||||||
* @return true if the list sequence has been altered
|
* @return true if the list sequence has been altered
|
||||||
*
|
*
|
||||||
@ -265,13 +258,6 @@ public:
|
|||||||
|
|
||||||
const bool desc = (this->flags & VL_DESC) != 0;
|
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); });
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -394,7 +380,7 @@ public:
|
|||||||
void RebuildDone()
|
void RebuildDone()
|
||||||
{
|
{
|
||||||
CLRBITS(this->flags, VL_REBUILD);
|
CLRBITS(this->flags, VL_REBUILD);
|
||||||
SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT);
|
SETBITS(this->flags, VL_RESORT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user