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

Method UpdateSortingFromGrouping

src/vehicle_gui.cpp:1861–1877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1859}
1860
1861void BaseVehicleListWindow::UpdateSortingFromGrouping()
1862{
1863 /* Set up sorting. Make the window-specific _sorting variable
1864 * point to the correct global _sorting struct so we are freed
1865 * from having conditionals during window operation */
1866 switch (this->vli.vtype) {
1867 case VEH_TRAIN: this->sorting = &_sorting[this->grouping].train; break;
1868 case VEH_ROAD: this->sorting = &_sorting[this->grouping].roadveh; break;
1869 case VEH_SHIP: this->sorting = &_sorting[this->grouping].ship; break;
1870 case VEH_AIRCRAFT: this->sorting = &_sorting[this->grouping].aircraft; break;
1871 default: NOT_REACHED();
1872 }
1873 this->vehgroups.SetSortFuncs(this->GetVehicleSorterFuncs());
1874 this->vehgroups.SetListing(*this->sorting);
1875 this->vehgroups.ForceRebuild();
1876 this->vehgroups.NeedResort();
1877}
1878
1879void BaseVehicleListWindow::UpdateVehicleGroupBy(GroupBy group_by)
1880{

Callers 2

BaseVehicleListWindowMethod · 0.95
UpdateVehicleGroupByMethod · 0.95

Calls 6

GetVehicleSorterFuncsMethod · 0.95
NOT_REACHEDFunction · 0.85
SetSortFuncsMethod · 0.80
SetListingMethod · 0.80
ForceRebuildMethod · 0.80
NeedResortMethod · 0.80

Tested by

no test coverage detected