Figure out what aircraft EngineIDs to put in the list */
| 1500 | |
| 1501 | /* Figure out what aircraft EngineIDs to put in the list */ |
| 1502 | void GenerateBuildAircraftList() |
| 1503 | { |
| 1504 | EngineID sel_id = EngineID::Invalid(); |
| 1505 | |
| 1506 | this->eng_list.clear(); |
| 1507 | |
| 1508 | const Station *st = this->listview_mode ? nullptr : Station::GetByTile(TileIndex(this->window_number)); |
| 1509 | |
| 1510 | BadgeTextFilter btf(this->string_filter, GSF_AIRCRAFT); |
| 1511 | BadgeDropdownFilter bdf(this->badge_filter_choices); |
| 1512 | |
| 1513 | /* Make list of all available planes. |
| 1514 | * Also check to see if the previously selected plane is still available, |
| 1515 | * and if not, reset selection to EngineID::Invalid(). This could be the case |
| 1516 | * when planes become obsolete and are removed */ |
| 1517 | for (const Engine *e : Engine::IterateType(VEH_AIRCRAFT)) { |
| 1518 | if (!this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue; |
| 1519 | EngineID eid = e->index; |
| 1520 | if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_company)) continue; |
| 1521 | /* First VEH_END window_numbers are fake to allow a window open for all different types at once */ |
| 1522 | if (!this->listview_mode && !CanVehicleUseStation(eid, st)) continue; |
| 1523 | if (!bdf.Filter(e->badges)) continue; |
| 1524 | |
| 1525 | /* Filter by name or NewGRF extra text */ |
| 1526 | if (!FilterByText(e) && !btf.Filter(e->badges)) continue; |
| 1527 | |
| 1528 | this->eng_list.emplace_back(eid, e->info.variant_id, e->display_flags, 0); |
| 1529 | |
| 1530 | if (eid == this->sel_engine) sel_id = eid; |
| 1531 | } |
| 1532 | |
| 1533 | this->SelectEngine(sel_id); |
| 1534 | } |
| 1535 | |
| 1536 | /* Generate the list of vehicles */ |
| 1537 | void GenerateBuildList() |
no test coverage detected