(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.

This commit is contained in:
frosch
2008-08-16 14:02:20 +00:00
parent 56459cab81
commit f7826f8a37
10 changed files with 550 additions and 21 deletions

View File

@@ -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();