summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-20 17:11:02 +0000
committerrubidium <rubidium@openttd.org>2007-10-20 17:11:02 +0000
commit29ebb28c65dcabf7ba3d89d070d79e94b6a1fda1 (patch)
tree0603f21de8e081cbb494ec009581487aea6e3349 /src
parent99266a173ce8d5bf9bf1bb85e3b58be296430865 (diff)
downloadopenttd-29ebb28c65dcabf7ba3d89d070d79e94b6a1fda1.tar.xz
(svn r11314) -Fix [FS#1356]: stop following a vehicle when you sell/destroyed it.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 21c8996f1..28fb0e64c 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()