(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
This commit is contained in:
27
src/train.h
27
src/train.h
@@ -247,6 +247,20 @@ static inline Vehicle *GetNextVehicle(const Vehicle *v)
|
||||
return v->Next();
|
||||
}
|
||||
|
||||
/** Get the previous real (non-articulated part) vehicle in the consist.
|
||||
* @param w Vehicle.
|
||||
* @return Previous vehicle in the consist.
|
||||
*/
|
||||
static inline Vehicle *GetPrevVehicle(const Vehicle *w)
|
||||
{
|
||||
assert(w->type == VEH_TRAIN);
|
||||
|
||||
Vehicle *v = w->Previous();
|
||||
while (v != NULL && IsArticulatedPart(v)) v = v->Previous();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
/** 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.
|
||||
@@ -260,6 +274,19 @@ static inline Vehicle *GetNextUnit(Vehicle *v)
|
||||
return v;
|
||||
}
|
||||
|
||||
/** 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)
|
||||
{
|
||||
assert(v->type == VEH_TRAIN);
|
||||
v = GetPrevVehicle(v);
|
||||
if (v != NULL && IsRearDualheaded(v)) v = GetPrevVehicle(v);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void ConvertOldMultiheadToNew();
|
||||
void ConnectMultiheadedTrains();
|
||||
|
||||
|
Reference in New Issue
Block a user