(svn r14747) -Codechange: remove DeleteVehicleChain in favour of the vehicle destructor as that was already doing the same for a few vehicle types.
This commit is contained in:
@@ -671,13 +671,6 @@ void Vehicle::PreDestructor()
|
||||
this->cargo.Truncate(0);
|
||||
DeleteVehicleOrders(this);
|
||||
|
||||
/* 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();
|
||||
}
|
||||
|
||||
extern void StopGlobalFollowVehicle(const Vehicle *v);
|
||||
StopGlobalFollowVehicle(this);
|
||||
}
|
||||
@@ -688,7 +681,15 @@ Vehicle::~Vehicle()
|
||||
|
||||
if (CleaningPool()) return;
|
||||
|
||||
/* sometimes, eg. for disaster vehicles, when company bankrupts, when removing crashed/flooded vehicles,
|
||||
* it may happen that vehicle chain is deleted when visible */
|
||||
if (!(this->vehstatus & VS_HIDDEN)) MarkSingleVehicleDirty(this);
|
||||
|
||||
Vehicle *v = this->Next();
|
||||
this->SetNext(NULL);
|
||||
|
||||
delete v;
|
||||
|
||||
UpdateVehiclePosHash(this, INVALID_COORD, 0);
|
||||
this->next_hash = NULL;
|
||||
this->next_new_hash = NULL;
|
||||
@@ -698,24 +699,6 @@ Vehicle::~Vehicle()
|
||||
new (this) InvalidVehicle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all vehicles in a chain.
|
||||
* @param v The first vehicle in the chain.
|
||||
*/
|
||||
void DeleteVehicleChain(Vehicle *v)
|
||||
{
|
||||
assert(v->First() == v);
|
||||
|
||||
do {
|
||||
Vehicle *u = v;
|
||||
/* sometimes, eg. for disaster vehicles, when company bankrupts, when removing crashed/flooded vehicles,
|
||||
* it may happen that vehicle chain is deleted when visible */
|
||||
if (!(v->vehstatus & VS_HIDDEN)) MarkSingleVehicleDirty(v);
|
||||
v = v->Next();
|
||||
delete u;
|
||||
} while (v != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of vehicles that should check for autoreplace this tick.
|
||||
* Mapping of vehicle -> leave depot immediatelly after autoreplace.
|
||||
|
Reference in New Issue
Block a user