1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-25 05:04:07 +01:00

Fix 7b60e5ccad: Badge filters were only applied to trains. (#14565)

This commit is contained in:
Peter Nelson
2025-08-31 23:04:48 +01:00
committed by GitHub
parent 24a4a1652b
commit ff5e067341

View File

@@ -1436,12 +1436,14 @@ struct BuildVehicleWindow : Window {
this->eng_list.clear();
BadgeTextFilter btf(this->string_filter, GSF_ROADVEHICLES);
BadgeDropdownFilter bdf(this->badge_filter_choices);
for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
if (!this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue;
EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_ROAD, _local_company)) continue;
if (this->filter.roadtype != INVALID_ROADTYPE && !HasPowerOnRoad(e->u.road.roadtype, this->filter.roadtype)) continue;
if (!bdf.Filter(e->badges)) continue;
/* Filter by name or NewGRF extra text */
if (!FilterByText(e) && !btf.Filter(e->badges)) continue;
@@ -1460,11 +1462,13 @@ struct BuildVehicleWindow : Window {
this->eng_list.clear();
BadgeTextFilter btf(this->string_filter, GSF_SHIPS);
BadgeDropdownFilter bdf(this->badge_filter_choices);
for (const Engine *e : Engine::IterateType(VEH_SHIP)) {
if (!this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue;
EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_SHIP, _local_company)) continue;
if (!bdf.Filter(e->badges)) continue;
/* Filter by name or NewGRF extra text */
if (!FilterByText(e) && !btf.Filter(e->badges)) continue;
@@ -1486,6 +1490,7 @@ struct BuildVehicleWindow : Window {
const Station *st = this->listview_mode ? nullptr : Station::GetByTile(TileIndex(this->window_number));
BadgeTextFilter btf(this->string_filter, GSF_AIRCRAFT);
BadgeDropdownFilter bdf(this->badge_filter_choices);
/* Make list of all available planes.
* Also check to see if the previously selected plane is still available,
@@ -1497,6 +1502,7 @@ struct BuildVehicleWindow : Window {
if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_company)) continue;
/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
if (!this->listview_mode && !CanVehicleUseStation(eid, st)) continue;
if (!bdf.Filter(e->badges)) continue;
/* Filter by name or NewGRF extra text */
if (!FilterByText(e) && !btf.Filter(e->badges)) continue;