summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-01 22:22:01 +0000
committersmatz <smatz@openttd.org>2009-07-01 22:22:01 +0000
commitadc5363202629aa07c762f459d7e9f5bc78efa34 (patch)
treeb0c087f513113051159d435af05d823798b2ee67 /src/train.h
parent15990079ce2bb53446305c5b61c7a620cd58b2dc (diff)
downloadopenttd-adc5363202629aa07c762f459d7e9f5bc78efa34.tar.xz
(svn r16717) -Codechange: make IsFrontEngine() member of Train
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/train.h b/src/train.h
index b52b52396..21e1995ea 100644
--- a/src/train.h
+++ b/src/train.h
@@ -51,17 +51,6 @@ enum TrainSubtype {
TS_MULTIHEADED = 5, ///< Engine is a multiheaded
};
-
-/** Check if a vehicle is front engine
- * @param v vehicle to check
- * @return Returns true if vehicle is a front engine
- */
-static inline bool IsFrontEngine(const Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- return HasBit(v->subtype, TS_FRONT);
-}
-
/** Set front engine state
* @param v vehicle to change
*/
@@ -324,7 +313,7 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> {
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_INC : EXPENSES_TRAIN_RUN; }
void PlayLeaveStationSound() const;
- bool IsPrimaryVehicle() const { return IsFrontEngine(this); }
+ bool IsPrimaryVehicle() const { return this->IsFrontEngine(); }
SpriteID GetImage(Direction direction) const;
int GetDisplaySpeed() const { return this->tcache.last_speed; }
int GetDisplayMaxSpeed() const { return this->tcache.cached_max_speed; }
@@ -336,6 +325,13 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> {
Trackdir GetVehicleTrackdir() const;
TileIndex GetOrderStationLocation(StationID station);
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
+
+ /**
+ * Check if a vehicle is front engine
+ * @param v vehicle to check
+ * @return Returns true if vehicle is a front engine
+ */
+ FORCEINLINE bool IsFrontEngine() const { return HasBit(this->subtype, TS_FRONT); }
};
#define FOR_ALL_TRAINS(var) FOR_ALL_VEHICLES_OF_TYPE(Train, var)