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 | 8f361393ddd26f2f1a08a108bb74c6bbfc6cab56 (patch) | |
tree | 8678c073dba5d9f177f55cb67813b6e68a63723e | |
parent | 06084e0a63a78bb1844916ddf59e5d8c174da380 (diff) | |
download | openttd-8f361393ddd26f2f1a08a108bb74c6bbfc6cab56.tar.xz |
(svn r10020) -Fix [FS#824]: GetNextVehicle() is invalid for anything that isn't a train.
-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); } |