(svn r10020) -Fix [FS#824]: GetNextVehicle() is invalid for anything that isn't a train.
This commit is contained in:
@@ -612,11 +612,20 @@ void DestroyVehicle(Vehicle *v)
|
||||
if (v->type == VEH_TRAIN && EngineHasArticPart(v)) DeleteVehicle(v->next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all vehicles in a chain.
|
||||
* @param v The first vehicle in the chain.
|
||||
*
|
||||
* @warning This function is not valid for any vehicle containing articulated
|
||||
* parts.
|
||||
*/
|
||||
void DeleteVehicleChain(Vehicle *v)
|
||||
{
|
||||
assert(v->type != VEH_TRAIN);
|
||||
|
||||
do {
|
||||
Vehicle *u = v;
|
||||
v = GetNextVehicle(v);
|
||||
v = v->next;
|
||||
DeleteVehicle(u);
|
||||
} while (v != NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user