summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-09-05 10:33:42 +0000
committerbjarni <bjarni@openttd.org>2007-09-05 10:33:42 +0000
commit128e71cde957545fc4229097432f2bbc0a3115fa (patch)
tree9c5f0b9c4f22f47f718b1ae11e95f12766c8a843 /src/train.h
parent7cd2aeb1c9a9dbb9918c2a309e353723e0f329da (diff)
downloadopenttd-128e71cde957545fc4229097432f2bbc0a3115fa.tar.xz
(svn r11046) -Codechange: added function to get the next movable (non-articulated, non-read end of dualheaded engine) vehicle in a train
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);