* Cancel viewport vehicle following, and raise follow location widget if needed. * @param viewport_window Window of this viewport. */
| 3824 | * @param viewport_window Window of this viewport. |
| 3825 | */ |
| 3826 | void ViewportData::CancelFollow(const Window &viewport_window) |
| 3827 | { |
| 3828 | if (this->follow_vehicle == VehicleID::Invalid()) return; |
| 3829 | |
| 3830 | if (viewport_window.window_class == WC_MAIN_WINDOW) { |
| 3831 | /* We're cancelling follow in the main viewport, so we need to check for a vehicle view window |
| 3832 | * to raise the location follow widget. */ |
| 3833 | Window *vehicle_window = FindWindowById(WC_VEHICLE_VIEW, this->follow_vehicle); |
| 3834 | if (vehicle_window != nullptr) vehicle_window->RaiseWidgetWhenLowered(WID_VV_LOCATION); |
| 3835 | } |
| 3836 | |
| 3837 | this->follow_vehicle = VehicleID::Invalid(); |
| 3838 | } |
no test coverage detected