Viewport: Refactor handling of vehicle route overlays

This commit is contained in:
Jonathan G Rennison
2023-05-06 19:14:39 +01:00
parent 31f476220d
commit 4c2244cc21
6 changed files with 126 additions and 101 deletions

View File

@@ -386,7 +386,7 @@ struct TimetableWindow : GeneralVehicleWindow {
~TimetableWindow()
{
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
MarkAllRouteStepsDirty(this->vehicle);
MarkDirtyFocusedRoutePaths(this->vehicle);
}
}
@@ -1173,16 +1173,14 @@ struct TimetableWindow : GeneralVehicleWindow {
virtual void OnFocus(Window *previously_focused_window) override
{
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
MarkAllRoutePathsDirty(this->vehicle);
MarkAllRouteStepsDirty(this->vehicle);
MarkDirtyFocusedRoutePaths(this->vehicle);
}
}
virtual void OnFocusLost(Window *newly_focused_window) override
{
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
MarkAllRoutePathsDirty(this->vehicle);
MarkAllRouteStepsDirty(this->vehicle);
MarkDirtyFocusedRoutePaths(this->vehicle);
}
}