src/train.h
changeset 9990 1e5841814b46
parent 9928 fa24e759e11d
equal deleted inserted replaced
9989:62e68bd41c90 9990:1e5841814b46
   263 
   263 
   264 /** Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
   264 /** Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
   265  * @param v Vehicle.
   265  * @param v Vehicle.
   266  * @return Next vehicle in the consist.
   266  * @return Next vehicle in the consist.
   267  */
   267  */
   268 static inline Vehicle *GetNextUnit(Vehicle *v)
   268 static inline Vehicle *GetNextUnit(const Vehicle *v)
   269 {
   269 {
   270 	assert(v->type == VEH_TRAIN);
   270 	assert(v->type == VEH_TRAIN);
   271 	v = GetNextVehicle(v);
   271 	Vehicle *w = GetNextVehicle(v);
   272 	if (v != NULL && IsRearDualheaded(v)) v = GetNextVehicle(v);
   272 	if (w != NULL && IsRearDualheaded(w)) w = GetNextVehicle(w);
   273 
   273 
   274 	return v;
   274 	return w;
   275 }
   275 }
   276 
   276 
   277 /** Get the previous real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
   277 /** Get the previous real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
   278  * @param v Vehicle.
   278  * @param v Vehicle.
   279  * @return Previous vehicle in the consist.
   279  * @return Previous vehicle in the consist.
   280  */
   280  */
   281 static inline Vehicle *GetPrevUnit(Vehicle *v)
   281 static inline Vehicle *GetPrevUnit(const Vehicle *v)
   282 {
   282 {
   283 	assert(v->type == VEH_TRAIN);
   283 	assert(v->type == VEH_TRAIN);
   284 	v = GetPrevVehicle(v);
   284 	Vehicle *w = GetPrevVehicle(v);
   285 	if (v != NULL && IsRearDualheaded(v)) v = GetPrevVehicle(v);
   285 	if (w != NULL && IsRearDualheaded(w)) w = GetPrevVehicle(w);
   286 
   286 
   287 	return v;
   287 	return w;
   288 }
   288 }
   289 
   289 
   290 void ConvertOldMultiheadToNew();
   290 void ConvertOldMultiheadToNew();
   291 void ConnectMultiheadedTrains();
   291 void ConnectMultiheadedTrains();
   292 
   292