Mercurial > hg > openttd
diff src/vehicle.cpp @ 7765:aa5048ea50a0 draft
(svn r11314) -Fix [FS#1356]: stop following a vehicle when you sell/destroyed it.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 20 Oct 2007 17:11:02 +0000 (2007-10-20) |
parents | 013f54f32e5e |
children | bb4e6370dfdf |
line wrap: on
line diff
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -529,6 +529,14 @@ 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()