Changeset - r9990:11fe53c71e1b
[Not reviewed]
master
0 1 0
frosch - 16 years ago 2008-08-23 22:31:36
frosch@openttd.org
(svn r14147) -Codechange: Allow passing 'const Vehicle *' to GetNextUnit() and GetPrevUnit().
1 file changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/train.h
Show inline comments
 
@@ -265,26 +265,26 @@ static inline Vehicle *GetPrevVehicle(co
 
 * @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();
0 comments (0 inline, 0 general)