mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
This commit is contained in:
parent
0075a95278
commit
f44d8fa2e4
|
@ -538,7 +538,7 @@ const StringID _engine_sort_listing[][12] = {{
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/** Filters vehicles by cargo and engine (in case of rail vehicle). */
|
/** Filters vehicles by cargo and engine (in case of rail vehicle). */
|
||||||
static bool CDECL CargoAndEngineFilter(const GUIEngineListItem *item, const CargoID cid)
|
static bool CargoAndEngineFilter(const GUIEngineListItem *item, const CargoID cid)
|
||||||
{
|
{
|
||||||
if (cid == CargoFilterCriteria::CF_ANY) {
|
if (cid == CargoFilterCriteria::CF_ANY) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1270,7 +1270,7 @@ typedef GUIList<const Industry *, const CargoID &, const std::pair<CargoID, Carg
|
||||||
* @param cargoes The accepted and produced cargo pair to look for.
|
* @param cargoes The accepted and produced cargo pair to look for.
|
||||||
* @return bool Whether the given cargoes accepted and produced by the industry.
|
* @return bool Whether the given cargoes accepted and produced by the industry.
|
||||||
*/
|
*/
|
||||||
static bool CDECL CargoFilter(const Industry * const *industry, const std::pair<CargoID, CargoID> &cargoes)
|
static bool CargoFilter(const Industry * const *industry, const std::pair<CargoID, CargoID> &cargoes)
|
||||||
{
|
{
|
||||||
auto accepted_cargo = cargoes.first;
|
auto accepted_cargo = cargoes.first;
|
||||||
auto produced_cargo = cargoes.second;
|
auto produced_cargo = cargoes.second;
|
||||||
|
|
|
@ -464,7 +464,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter content by tags/name */
|
/** Filter content by tags/name */
|
||||||
static bool CDECL TagNameFilter(const ContentInfo * const *a, ContentListFilterData &filter)
|
static bool TagNameFilter(const ContentInfo * const *a, ContentListFilterData &filter)
|
||||||
{
|
{
|
||||||
if ((*a)->state == ContentInfo::SELECTED || (*a)->state == ContentInfo::AUTOSELECTED) return true;
|
if ((*a)->state == ContentInfo::SELECTED || (*a)->state == ContentInfo::AUTOSELECTED) return true;
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter content by type, but still show content selected for download. */
|
/** Filter content by type, but still show content selected for download. */
|
||||||
static bool CDECL TypeOrSelectedFilter(const ContentInfo * const *a, ContentListFilterData &filter)
|
static bool TypeOrSelectedFilter(const ContentInfo * const *a, ContentListFilterData &filter)
|
||||||
{
|
{
|
||||||
if (filter.types.none()) return true;
|
if (filter.types.none()) return true;
|
||||||
if (filter.types[(*a)->type]) return true;
|
if (filter.types[(*a)->type]) return true;
|
||||||
|
|
|
@ -338,7 +338,7 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CDECL NGameSearchFilter(NetworkGameList * const *item, StringFilter &sf)
|
static bool NGameSearchFilter(NetworkGameList * const *item, StringFilter &sf)
|
||||||
{
|
{
|
||||||
assert(item != nullptr);
|
assert(item != nullptr);
|
||||||
assert((*item) != nullptr);
|
assert((*item) != nullptr);
|
||||||
|
|
|
@ -1458,7 +1458,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter grfs by tags/name */
|
/** Filter grfs by tags/name */
|
||||||
static bool CDECL TagNameFilter(const GRFConfig * const *a, StringFilter &filter)
|
static bool TagNameFilter(const GRFConfig * const *a, StringFilter &filter)
|
||||||
{
|
{
|
||||||
filter.ResetState();
|
filter.ResetState();
|
||||||
filter.AddLine((*a)->GetName());
|
filter.AddLine((*a)->GetName());
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter object classes by class name. */
|
/** Filter object classes by class name. */
|
||||||
static bool CDECL TagNameFilter(ObjectClassID const *oc, StringFilter &filter)
|
static bool TagNameFilter(ObjectClassID const *oc, StringFilter &filter)
|
||||||
{
|
{
|
||||||
ObjectClass *objclass = ObjectClass::Get(*oc);
|
ObjectClass *objclass = ObjectClass::Get(*oc);
|
||||||
|
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter station classes by class name. */
|
/** Filter station classes by class name. */
|
||||||
static bool CDECL TagNameFilter(StationClassID const * sc, StringFilter &filter)
|
static bool TagNameFilter(StationClassID const * sc, StringFilter &filter)
|
||||||
{
|
{
|
||||||
filter.ResetState();
|
filter.ResetState();
|
||||||
filter.AddLine(GetString(StationClass::Get(*sc)->name));
|
filter.AddLine(GetString(StationClass::Get(*sc)->name));
|
||||||
|
|
|
@ -1246,7 +1246,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter classes by class name. */
|
/** Filter classes by class name. */
|
||||||
static bool CDECL TagNameFilter(RoadStopClassID const *sc, StringFilter &filter)
|
static bool TagNameFilter(RoadStopClassID const *sc, StringFilter &filter)
|
||||||
{
|
{
|
||||||
filter.ResetState();
|
filter.ResetState();
|
||||||
filter.AddLine(GetString(RoadStopClass::Get(*sc)->name));
|
filter.AddLine(GetString(RoadStopClass::Get(*sc)->name));
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct SignList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter sign list by sign name */
|
/** Filter sign list by sign name */
|
||||||
static bool CDECL SignNameFilter(const Sign * const *a, StringFilter &filter)
|
static bool SignNameFilter(const Sign * const *a, StringFilter &filter)
|
||||||
{
|
{
|
||||||
/* Same performance benefit as above for sorting. */
|
/* Same performance benefit as above for sorting. */
|
||||||
const std::string &a_name = (*a)->name.empty() ? SignList::default_name : (*a)->name;
|
const std::string &a_name = (*a)->name.empty() ? SignList::default_name : (*a)->name;
|
||||||
|
@ -104,14 +104,14 @@ struct SignList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter sign list excluding OWNER_DEITY */
|
/** Filter sign list excluding OWNER_DEITY */
|
||||||
static bool CDECL OwnerDeityFilter(const Sign * const *a, StringFilter &)
|
static bool OwnerDeityFilter(const Sign * const *a, StringFilter &)
|
||||||
{
|
{
|
||||||
/* You should never be able to edit signs of owner DEITY */
|
/* You should never be able to edit signs of owner DEITY */
|
||||||
return (*a)->owner != OWNER_DEITY;
|
return (*a)->owner != OWNER_DEITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter sign list by owner */
|
/** Filter sign list by owner */
|
||||||
static bool CDECL OwnerVisibilityFilter(const Sign * const *a, StringFilter &)
|
static bool OwnerVisibilityFilter(const Sign * const *a, StringFilter &)
|
||||||
{
|
{
|
||||||
assert(!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS));
|
assert(!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS));
|
||||||
/* Hide sign if non-own signs are hidden in the viewport */
|
/* Hide sign if non-own signs are hidden in the viewport */
|
||||||
|
|
|
@ -47,7 +47,7 @@ template <typename T, typename P = std::nullptr_t, typename F = const char*>
|
||||||
class GUIList : public std::vector<T> {
|
class GUIList : public std::vector<T> {
|
||||||
public:
|
public:
|
||||||
using SortFunction = std::conditional_t<std::is_same_v<P, std::nullptr_t>, bool (const T&, const T&), bool (const T&, const T&, const P)>; ///< Signature of sort function.
|
using SortFunction = std::conditional_t<std::is_same_v<P, std::nullptr_t>, bool (const T&, const T&), bool (const T&, const T&, const P)>; ///< Signature of sort function.
|
||||||
typedef bool CDECL FilterFunction(const T*, F); ///< Signature of filter function.
|
using FilterFunction = bool(const T*, F); ///< Signature of filter function.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::span<SortFunction * const> sort_func_list; ///< the sort criteria functions
|
std::span<SortFunction * const> sort_func_list; ///< the sort criteria functions
|
||||||
|
|
Loading…
Reference in New Issue