summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/train.h b/src/train.h
index d2cfa1268..db9e53c6a 100644
--- a/src/train.h
+++ b/src/train.h
@@ -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);