diff options
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 274c9e20f..7fcd64b5b 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2171,3 +2171,12 @@ void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int c default: NOT_REACHED(); } } + +void StopGlobalFollowVehicle(const Vehicle *v) +{ + Window *w = FindWindowById(WC_MAIN_WINDOW, 0); + if (w != NULL && w->viewport->follow_vehicle == v->index) { + ScrollMainWindowTo(v->x_pos, v->y_pos, true); // lock the main view on the vehicle's last position + w->viewport->follow_vehicle = INVALID_VEHICLE; + } +} |