src/vehicle.cpp
changeset 10596 0ee9eba64c9c
parent 10581 7255fef8c069
child 10602 b6ae8f54d78f
equal deleted inserted replaced
10595:7957c71b0dfe 10596:0ee9eba64c9c
   588 	 *  other artic parts. */
   588 	 *  other artic parts. */
   589 	if ((this->type == VEH_TRAIN && EngineHasArticPart(this)) || (this->type == VEH_ROAD && RoadVehHasArticPart(this))) {
   589 	if ((this->type == VEH_TRAIN && EngineHasArticPart(this)) || (this->type == VEH_ROAD && RoadVehHasArticPart(this))) {
   590 		delete this->Next();
   590 		delete this->Next();
   591 	}
   591 	}
   592 
   592 
   593 	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
   593 	extern void StopGlobalFollowVehicle(const Vehicle *v);
   594 	if (w != NULL && w->viewport->follow_vehicle == this->index) {
   594 	StopGlobalFollowVehicle(this);
   595 		ScrollMainWindowTo(this->x_pos, this->y_pos, true); // lock the main view on the vehicle's last position
       
   596 		w->viewport->follow_vehicle = INVALID_VEHICLE;
       
   597 	}
       
   598 }
   595 }
   599 
   596 
   600 Vehicle::~Vehicle()
   597 Vehicle::~Vehicle()
   601 {
   598 {
   602 	free(this->name);
   599 	free(this->name);