From 7cd2aeb1c9a9dbb9918c2a309e353723e0f329da Mon Sep 17 00:00:00 2001 From: bjarni Date: Wed, 5 Sep 2007 10:15:23 +0000 Subject: (svn r11045) -Codechange: added a function to tell if a vehicle is the rear part of a dualheaded train engine --- src/train.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/train.h') 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. -- cgit v1.2.3-54-g00ecf