From 79cee7e08fe44f96271e7b0062704690fc5c9ef3 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 20 Oct 2007 17:11:02 +0000 Subject: [PATCH] (svn r11314) -Fix [FS#1356]: stop following a vehicle when you sell/destroyed it. --- src/vehicle.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 21c8996f18..28fb0e64cc 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -529,6 +529,14 @@ void Vehicle::PreDestructor() if ((this->type == VEH_TRAIN && EngineHasArticPart(this)) || (this->type == VEH_ROAD && RoadVehHasArticPart(this))) { delete this->Next(); } + + Window **wp; + FOR_ALL_WINDOWS(wp) { + Window *w = *wp; + if (w->viewport != NULL && WP(w, vp_d).follow_vehicle == this->index) { + WP(w, vp_d).follow_vehicle = INVALID_VEHICLE; + } + } } Vehicle::~Vehicle()