diff options
author | tron <tron@openttd.org> | 2006-07-23 17:17:43 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-07-23 17:17:43 +0000 |
commit | c4ed8e9ec4998dfa18a94fc13028bfadcfe67982 (patch) | |
tree | e71d6ae5c8d0bf41d69bc5b03b7510e8b3638c58 | |
parent | 79e1f4eea0a959eee53a79385b16bd5e75936853 (diff) | |
download | openttd-c4ed8e9ec4998dfa18a94fc13028bfadcfe67982.tar.xz |
(svn r5599) GetPrevVehicleInChain() may never fail to find a valid vehicle. Reflect this in the code
-rw-r--r-- | vehicle.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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. |