diff options
author | tron <tron@openttd.org> | 2005-03-09 21:54:52 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-03-09 21:54:52 +0000 |
commit | e5121e70d0bc12ec82dba3ba6f114d5137b69fec (patch) | |
tree | b7d6d3d05d43fa0002c93d672cb00582a9e6e150 /vehicle.c | |
parent | 9bd079d4257e9d49bb22244edd2d103620bc8896 (diff) | |
download | openttd-e5121e70d0bc12ec82dba3ba6f114d5137b69fec.tar.xz |
(svn r1979) Const correctness
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -365,29 +365,28 @@ Vehicle *GetLastVehicleInChain(Vehicle *v) return v; } -Vehicle *GetPrevVehicleInChain(Vehicle *v) +Vehicle *GetPrevVehicleInChain(const Vehicle *v) { - Vehicle *org = v; + const Vehicle *org = v; FOR_ALL_VEHICLES(v) { if (v->type == VEH_Train && org == v->next) - return v; + return (Vehicle*)v; } return NULL; } -Vehicle *GetFirstVehicleInChain(Vehicle *v) +Vehicle *GetFirstVehicleInChain(const Vehicle *v) { - Vehicle *u; - while (true) { - u = v; + const Vehicle* u = v; + v = GetPrevVehicleInChain(v); /* If there is no such vehicle, 'v' == NULL and so 'u' is the first vehicle in chain */ if (v == NULL) - return u; + return (Vehicle*)u; } } |