diff options
author | maedhros <maedhros@openttd.org> | 2007-06-02 09:11:06 +0000 |
---|---|---|
committer | maedhros <maedhros@openttd.org> | 2007-06-02 09:11:06 +0000 |
commit | fb5072b82440435c1e16eb14f9087bf849d7eb4e (patch) | |
tree | 8678c073dba5d9f177f55cb67813b6e68a63723e /src | |
parent | 7660db1716bf40527449289e3014cd8874fac85a (diff) | |
download | openttd-fb5072b82440435c1e16eb14f9087bf849d7eb4e.tar.xz |
(svn r10020) -Fix [FS#824]: GetNextVehicle() is invalid for anything that isn't a train.
Diffstat (limited to 'src')
-rw-r--r-- | src/vehicle.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 298bcfcaf..d6c46e5e5 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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); } |