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

Method GenerateBuildShipList

src/build_vehicle_gui.cpp:1477–1499  ·  view source on GitHub ↗

Figure out what ship EngineIDs to put in the list */

Source from the content-addressed store, hash-verified

1475
1476 /* Figure out what ship EngineIDs to put in the list */
1477 void GenerateBuildShipList()
1478 {
1479 EngineID sel_id = EngineID::Invalid();
1480 this->eng_list.clear();
1481
1482 BadgeTextFilter btf(this->string_filter, GSF_SHIPS);
1483 BadgeDropdownFilter bdf(this->badge_filter_choices);
1484
1485 for (const Engine *e : Engine::IterateType(VEH_SHIP)) {
1486 if (!this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue;
1487 EngineID eid = e->index;
1488 if (!IsEngineBuildable(eid, VEH_SHIP, _local_company)) continue;
1489 if (!bdf.Filter(e->badges)) continue;
1490
1491 /* Filter by name or NewGRF extra text */
1492 if (!FilterByText(e) && !btf.Filter(e->badges)) continue;
1493
1494 this->eng_list.emplace_back(eid, e->info.variant_id, e->display_flags, 0);
1495
1496 if (eid == this->sel_engine) sel_id = eid;
1497 }
1498 this->SelectEngine(sel_id);
1499 }
1500
1501 /* Figure out what aircraft EngineIDs to put in the list */
1502 void GenerateBuildAircraftList()

Callers 1

GenerateBuildListMethod · 0.95

Calls 6

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

Tested by

no test coverage detected