(svn r11046) -Codechange: added function to get the next movable (non-articulated, non-read end of dualheaded engine) vehicle in a train

This commit is contained in:
bjarni
2007-09-05 10:33:42 +00:00
parent 7cdf6d1cbe
commit f7d1c125b1
2 changed files with 14 additions and 2 deletions

View File

@@ -248,6 +248,19 @@ static inline Vehicle *GetNextVehicle(const Vehicle *v)
return v->Next();
}
/** Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist.
* @param v Vehicle.
* @return Next vehicle in the consist.
*/
static inline Vehicle *GetNextUnit(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
v = GetNextVehicle(v);
if (v != NULL && IsRearDualheaded(v)) v = v->Next();
return v;
}
void ConvertOldMultiheadToNew();
void ConnectMultiheadedTrains();
uint CountArticulatedParts(EngineID engine_type);