(svn r10020) -Fix [FS#824]: GetNextVehicle() is invalid for anything that isn't a train.

This commit is contained in:
maedhros 2007-06-02 09:11:06 +00:00
parent 06084e0a63
commit 8f361393dd
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}