mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r10020) -Fix [FS#824]: GetNextVehicle() is invalid for anything that isn't a train.
This commit is contained in:
parent
06084e0a63
commit
8f361393dd
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue