src/vehicle.cpp
changeset 9274 42b67e65f1c2
parent 9259 6007531b4ae5
child 9280 8adb36dcebab
equal deleted inserted replaced
9273:35e0224ea8f1 9274:42b67e65f1c2
   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);