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

Method CancelFollow

src/viewport.cpp:3826–3838  ·  view source on GitHub ↗

* Cancel viewport vehicle following, and raise follow location widget if needed. * @param viewport_window Window of this viewport. */

Source from the content-addressed store, hash-verified

3824 * @param viewport_window Window of this viewport.
3825 */
3826void 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}

Callers 4

HandleAutoscrollFunction · 0.80
HandleKeyScrollingFunction · 0.80
StopGlobalFollowVehicleFunction · 0.80
ScrollWindowToFunction · 0.80

Calls 3

InvalidFunction · 0.85
FindWindowByIdFunction · 0.85

Tested by

no test coverage detected