1
0
Fork 0

(svn r14147) -Codechange: Allow passing 'const Vehicle *' to GetNextUnit() and GetPrevUnit().

release/0.7
frosch 2008-08-23 22:31:36 +00:00
parent 200f405706
commit 32e1fd55c5
1 changed files with 8 additions and 8 deletions

View File

@ -265,26 +265,26 @@ static inline Vehicle *GetPrevVehicle(const Vehicle *w)
* @param v Vehicle. * @param v Vehicle.
* @return Next vehicle in the consist. * @return Next vehicle in the consist.
*/ */
static inline Vehicle *GetNextUnit(Vehicle *v) static inline Vehicle *GetNextUnit(const Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
v = GetNextVehicle(v); Vehicle *w = GetNextVehicle(v);
if (v != NULL && IsRearDualheaded(v)) v = 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. /** Get the previous real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
* @param v Vehicle. * @param v Vehicle.
* @return Previous vehicle in the consist. * @return Previous vehicle in the consist.
*/ */
static inline Vehicle *GetPrevUnit(Vehicle *v) static inline Vehicle *GetPrevUnit(const Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
v = GetPrevVehicle(v); Vehicle *w = GetPrevVehicle(v);
if (v != NULL && IsRearDualheaded(v)) v = GetPrevVehicle(v); if (w != NULL && IsRearDualheaded(w)) w = GetPrevVehicle(w);
return v; return w;
} }
void ConvertOldMultiheadToNew(); void ConvertOldMultiheadToNew();