Skip to content

Commit

Permalink
Codechange: Remove CDECL from filter functions. (OpenTTD#12578)
Browse files Browse the repository at this point in the history
These functions are not passed to qsort()...
  • Loading branch information
PeterN authored Apr 25, 2024
1 parent 0075a95 commit f44d8fa
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/build_vehicle_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ const StringID _engine_sort_listing[][12] = {{
}};

/** 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) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/industry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* @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 produced_cargo = cargoes.second;
Expand Down
4 changes: 2 additions & 2 deletions src/network/network_content_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
}

/** 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;

Expand All @@ -476,7 +476,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
}

/** 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[(*a)->type]) return true;
Expand Down
2 changes: 1 addition & 1 deletion src/network/network_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class NetworkGameWindow : public Window {
}
}

static bool CDECL NGameSearchFilter(NetworkGameList * const *item, StringFilter &sf)
static bool NGameSearchFilter(NetworkGameList * const *item, StringFilter &sf)
{
assert(item != nullptr);
assert((*item) != nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/newgrf_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
}

/** 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.AddLine((*a)->GetName());
Expand Down
2 changes: 1 addition & 1 deletion src/object_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class BuildObjectWindow : public Window {
}

/** 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);

Expand Down
2 changes: 1 addition & 1 deletion src/rail_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ struct BuildRailStationWindow : public PickerWindowBase {
}

/** 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.AddLine(GetString(StationClass::Get(*sc)->name));
Expand Down
2 changes: 1 addition & 1 deletion src/road_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ struct BuildRoadStationWindow : public PickerWindowBase {
}

/** 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.AddLine(GetString(RoadStopClass::Get(*sc)->name));
Expand Down
6 changes: 3 additions & 3 deletions src/signs_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct SignList {
}

/** 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. */
const std::string &a_name = (*a)->name.empty() ? SignList::default_name : (*a)->name;
Expand All @@ -104,14 +104,14 @@ struct SignList {
}

/** 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 */
return (*a)->owner != OWNER_DEITY;
}

/** 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));
/* Hide sign if non-own signs are hidden in the viewport */
Expand Down
2 changes: 1 addition & 1 deletion src/sortlist_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template <typename T, typename P = std::nullptr_t, typename F = const char*>
class GUIList : public std::vector<T> {
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.
typedef bool CDECL FilterFunction(const T*, F); ///< Signature of filter function.
using FilterFunction = bool(const T*, F); ///< Signature of filter function.

protected:
std::span<SortFunction * const> sort_func_list; ///< the sort criteria functions
Expand Down

0 comments on commit f44d8fa

Please sign in to comment.