summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-09-05 10:15:23 +0000
committerbjarni <bjarni@openttd.org>2007-09-05 10:15:23 +0000
commit7cdf6d1cbe83bb28f56819abc40092f4d865c5ac (patch)
tree4c5c8c63ea8fbb514fa7bd1574862c409bf2efdc /src/train.h
parent1028e2dc91d16bbaf837c74736968e52e3984f99 (diff)
downloadopenttd-7cdf6d1cbe83bb28f56819abc40092f4d865c5ac.tar.xz
(svn r11045) -Codechange: added a function to tell if a vehicle is the rear part of a dualheaded train engine
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/train.h b/src/train.h
index 55ef18663..d2cfa1268 100644
--- a/src/train.h
+++ b/src/train.h
@@ -225,6 +225,16 @@ static inline Vehicle *GetLastEnginePart(Vehicle *v)
return v;
}
+/** Tell if we are dealing with the rear end of a multiheaded engine.
+ * @param v Vehicle.
+ * @return True if the engine is the rear part of a dualheaded engine.
+ */
+static inline bool IsRearDualheaded(const Vehicle *v)
+{
+ assert(v->type == VEH_TRAIN);
+ return (IsMultiheaded(v) && !IsTrainEngine(v));
+}
+
/** Get the next real (non-articulated part) vehicle in the consist.
* @param v Vehicle.
* @return Next vehicle in the consist.