From adc5363202629aa07c762f459d7e9f5bc78efa34 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 1 Jul 2009 22:22:01 +0000 Subject: (svn r16717) -Codechange: make IsFrontEngine() member of Train --- src/train.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/train.h') 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 { 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 { 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) -- cgit v1.2.3-54-g00ecf