Use a lower resort interval in veh windows when sorting by timetable delay

This commit is contained in:
Jonathan G Rennison
2021-06-28 22:37:40 +01:00
parent c9c6b4cd92
commit 906ee568d6
4 changed files with 12 additions and 0 deletions

View File

@@ -1995,6 +1995,13 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
}
}
void BaseVehicleListWindow::UpdateSortingInterval()
{
uint16 resort_interval = DAY_TICKS * 10;
if (this->grouping == GB_NONE && this->vehgroups.SortType() == VST_TIMETABLE_DELAY) resort_interval = DAY_TICKS;
this->vehgroups.SetResortInterval(resort_interval);
}
void BaseVehicleListWindow::UpdateSortingFromGrouping()
{
/* Set up sorting. Make the window-specific _sorting variable
@@ -2011,6 +2018,7 @@ void BaseVehicleListWindow::UpdateSortingFromGrouping()
this->vehgroups.SetListing(*this->sorting);
this->vehgroups.ForceRebuild();
this->vehgroups.NeedResort();
this->UpdateSortingInterval();
}
void BaseVehicleListWindow::UpdateVehicleGroupBy(GroupBy group_by)
@@ -2314,6 +2322,7 @@ public:
case WID_VL_SORT_BY_PULLDOWN:
this->vehgroups.SetSortType(index);
this->UpdateSortingInterval();
break;
case WID_VL_FILTER_BY_CARGO: