MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GenerateBuildRoadVehList

Method GenerateBuildRoadVehList

src/build_vehicle_gui.cpp:1450–1474  ·  view source on GitHub ↗

Figure out what road vehicle EngineIDs to put in the list */

Source from the content-addressed store, hash-verified

1448
1449 /* Figure out what road vehicle EngineIDs to put in the list */
1450 void GenerateBuildRoadVehList()
1451 {
1452 EngineID sel_id = EngineID::Invalid();
1453
1454 this->eng_list.clear();
1455
1456 BadgeTextFilter btf(this->string_filter, GSF_ROADVEHICLES);
1457 BadgeDropdownFilter bdf(this->badge_filter_choices);
1458
1459 for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
1460 if (!this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue;
1461 EngineID eid = e->index;
1462 if (!IsEngineBuildable(eid, VEH_ROAD, _local_company)) continue;
1463 if (this->filter.roadtype != INVALID_ROADTYPE && !HasPowerOnRoad(e->VehInfo<RoadVehicleInfo>().roadtype, this->filter.roadtype)) continue;
1464 if (!bdf.Filter(e->badges)) continue;
1465
1466 /* Filter by name or NewGRF extra text */
1467 if (!FilterByText(e) && !btf.Filter(e->badges)) continue;
1468
1469 this->eng_list.emplace_back(eid, e->info.variant_id, e->display_flags, 0);
1470
1471 if (eid == this->sel_engine) sel_id = eid;
1472 }
1473 this->SelectEngine(sel_id);
1474 }
1475
1476 /* Figure out what ship EngineIDs to put in the list */
1477 void GenerateBuildShipList()

Callers 1

GenerateBuildListMethod · 0.95

Calls 7

SelectEngineMethod · 0.95
InvalidFunction · 0.85
IsEngineBuildableFunction · 0.85
HasPowerOnRoadFunction · 0.85
IsVariantHiddenMethod · 0.80
clearMethod · 0.45
FilterMethod · 0.45

Tested by

no test coverage detected