Changeset - r7765:856ce739ab4d
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-10-20 17:11:02
rubidium@openttd.org
(svn r11314) -Fix [FS#1356]: stop following a vehicle when you sell/destroyed it.
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -526,12 +526,20 @@ void Vehicle::PreDestructor()
 
	/* Now remove any artic part. This will trigger an other
 
	 *  destroy vehicle, which on his turn can remove any
 
	 *  other artic parts. */
 
	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()
 
{
 
	DeleteName(this->string_id);
 

	
0 comments (0 inline, 0 general)