From a407d53d1b2a329a5ae747ea83d4652427cc6c8a Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 29 Aug 2007 21:49:08 +0000 Subject: (svn r11001) -Codechange: unify the way to determine whether a vehicle is in a depot. --- src/train.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/train.h') diff --git a/src/train.h b/src/train.h index 5befad626..1983b99ff 100644 --- a/src/train.h +++ b/src/train.h @@ -248,6 +248,9 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2); byte FreightWagonMult(CargoID cargo); +int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped); +int CheckTrainStoppedInDepot(const Vehicle *v); + /** * This class 'wraps' Vehicle; you do not actually instantiate this class. * You create a Vehicle using AllocateVehicle, so it is added to the pool @@ -275,6 +278,8 @@ struct Train : public Vehicle { int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; } int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; } Money GetRunningCost() const; + bool IsInDepot() const { return CheckTrainInDepot(this, false) != -1; } + bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; } void Tick(); }; -- cgit v1.2.3-54-g00ecf