From 32e1fd55c551dedba2d8fabd8462ddb0b88a04d0 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 23 Aug 2008 22:31:36 +0000 Subject: (svn r14147) -Codechange: Allow passing 'const Vehicle *' to GetNextUnit() and GetPrevUnit(). --- src/train.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/train.h') 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(); -- cgit v1.2.3-54-g00ecf