diff options
author | rubidium <rubidium@openttd.org> | 2007-08-29 21:49:08 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-08-29 21:49:08 +0000 |
commit | a407d53d1b2a329a5ae747ea83d4652427cc6c8a (patch) | |
tree | eb86df4a79dffa6270deda722c234ab9cb3c8964 /src/train.h | |
parent | a28d33b5dc89e47ae271b5dbdcc4f5e6f1784c6c (diff) | |
download | openttd-a407d53d1b2a329a5ae747ea83d4652427cc6c8a.tar.xz |
(svn r11001) -Codechange: unify the way to determine whether a vehicle is in a depot.
Diffstat (limited to 'src/train.h')
-rw-r--r-- | src/train.h | 5 |
1 files changed, 5 insertions, 0 deletions
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(); }; |