Mercurial > hg > openttd
changeset 4165:26fda05b430b draft
(svn r5599) GetPrevVehicleInChain() may never fail to find a valid vehicle. Reflect this in the code
author | tron <tron@openttd.org> |
---|---|
date | Sun, 23 Jul 2006 17:17:43 +0000 |
parents | 00aef976ba6f |
children | f3d78465eef4 |
files | vehicle.c |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/vehicle.c +++ b/vehicle.c @@ -486,11 +486,9 @@ // 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); - - return NULL; + for (; u->next != v; u = u->next) assert(u->next != NULL); + + return u; } /** Finds the first vehicle in a chain.