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

Method BuildActionDropdownList

src/vehicle_gui.cpp:526–551  ·  view source on GitHub ↗

* Display the Action dropdown window. * @param show_autoreplace If true include the autoreplace item. * @param show_group If true include group-related stuff. * @param show_create If true include group-create item. * @return Itemlist for dropdown */

Source from the content-addressed store, hash-verified

524 * @return Itemlist for dropdown
525 */
526DropDownList BaseVehicleListWindow::BuildActionDropdownList(bool show_autoreplace, bool show_group, bool show_create)
527{
528 DropDownList list;
529
530 /* Autoreplace actions. */
531 if (show_autoreplace) {
532 list.push_back(MakeDropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE));
533 list.push_back(MakeDropDownListDividerItem());
534 }
535
536 /* Group actions. */
537 if (show_group) {
538 list.push_back(MakeDropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED));
539 list.push_back(MakeDropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL));
540 list.push_back(MakeDropDownListDividerItem());
541 } else if (show_create) {
542 list.push_back(MakeDropDownListStringItem(STR_VEHICLE_LIST_CREATE_GROUP, ADI_CREATE_GROUP));
543 list.push_back(MakeDropDownListDividerItem());
544 }
545
546 /* Depot actions. */
547 list.push_back(MakeDropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, ADI_SERVICE));
548 list.push_back(MakeDropDownListStringItem(this->vehicle_depot_name[this->vli.vtype], ADI_DEPOT));
549
550 return list;
551}
552
553/* cached values for VehicleNameSorter to spare many GetString() calls */
554static const Vehicle *_last_vehicle[2] = { nullptr, nullptr };

Callers 2

OnClickMethod · 0.80
OnClickMethod · 0.80

Calls 3

push_backMethod · 0.80

Tested by

no test coverage detected