summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-23 22:31:36 +0000
committerfrosch <frosch@openttd.org>2008-08-23 22:31:36 +0000
commit464899f9adbd0bb8ba1a261fe953487f5a52db31 (patch)
tree2bbc3955a70889234eee9d94e85af970e20be3e3 /src
parent07c20252c3614e6758943817811277e8e6e7c95b (diff)
downloadopenttd-464899f9adbd0bb8ba1a261fe953487f5a52db31.tar.xz
(svn r14147) -Codechange: Allow passing 'const Vehicle *' to GetNextUnit() and GetPrevUnit().
Diffstat (limited to 'src')
-rw-r--r--src/train.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/train.h b/src/train.h
index 22ed95b04..5e57bdb2d 100644
--- a/src/train.h
+++ b/src/train.h
@@ -265,26 +265,26 @@ static inline Vehicle *GetPrevVehicle(const Vehicle *w)
* @param v Vehicle.
* @return Next vehicle in the consist.
*/
-static inline Vehicle *GetNextUnit(Vehicle *v)
+static inline Vehicle *GetNextUnit(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- v = GetNextVehicle(v);
- if (v != NULL && IsRearDualheaded(v)) v = GetNextVehicle(v);
+ Vehicle *w = GetNextVehicle(v);
+ if (w != NULL && IsRearDualheaded(w)) w = GetNextVehicle(w);
- return v;
+ return w;
}
/** Get the previous real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
* @param v Vehicle.
* @return Previous vehicle in the consist.
*/
-static inline Vehicle *GetPrevUnit(Vehicle *v)
+static inline Vehicle *GetPrevUnit(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- v = GetPrevVehicle(v);
- if (v != NULL && IsRearDualheaded(v)) v = GetPrevVehicle(v);
+ Vehicle *w = GetPrevVehicle(v);
+ if (w != NULL && IsRearDualheaded(w)) w = GetPrevVehicle(w);
- return v;
+ return w;
}
void ConvertOldMultiheadToNew();