From c4ed8e9ec4998dfa18a94fc13028bfadcfe67982 Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 23 Jul 2006 17:17:43 +0000 Subject: (svn r5599) GetPrevVehicleInChain() may never fail to find a valid vehicle. Reflect this in the code --- vehicle.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'vehicle.c') diff --git a/vehicle.c b/vehicle.c index b9bca4bfb..70fe7e696 100644 --- a/vehicle.c +++ b/vehicle.c @@ -486,11 +486,9 @@ Vehicle *GetPrevVehicleInChain(const Vehicle *v) // Check to see if this is the first if (v == u) return NULL; - do { - if (u->next == v) return u; - } while ( ( u = u->next) != NULL); + for (; u->next != v; u = u->next) assert(u->next != NULL); - return NULL; + return u; } /** Finds the first vehicle in a chain. -- cgit v1.2.3-54-g00ecf