summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-07-07 15:22:21 +0000
committerfrosch <frosch@openttd.org>2012-07-07 15:22:21 +0000
commite0cf1e3e946e4fe84eae582c388b64f1d247d008 (patch)
tree9a47ae8f924c499abf910de0d02ff14345ee8ec4 /src
parentc1dd0107c71270e8949ddefac41424b3dd79eca4 (diff)
downloadopenttd-e0cf1e3e946e4fe84eae582c388b64f1d247d008.tar.xz
(svn r24381) -Revert (r24380): RoadVehicle::IsInDepot was supposed to behave different to Train::IsInDepot.
Diffstat (limited to 'src')
-rw-r--r--src/roadveh.h2
-rw-r--r--src/roadveh_cmd.cpp9
2 files changed, 3 insertions, 8 deletions
diff --git a/src/roadveh.h b/src/roadveh.h
index 6205f4b55..6358cef7f 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -112,7 +112,7 @@ struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> {
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
Money GetRunningCost() const;
int GetDisplayImageWidth(Point *offset = NULL) const;
- bool IsInDepot() const;
+ bool IsInDepot() const { return this->state == RVSB_IN_DEPOT; }
bool IsStoppedInDepot() const;
bool Tick();
void OnNewDay();
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 2c06f7897..f29efb60a 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -308,15 +308,10 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
bool RoadVehicle::IsStoppedInDepot() const
{
- if (this->IsFrontEngine() && !(this->vehstatus & VS_STOPPED)) return false;
-
- return this->IsInDepot();
-}
-
-bool RoadVehicle::IsInDepot() const
-{
TileIndex tile = this->tile;
+
if (!IsRoadDepotTile(tile)) return false;
+ if (this->IsFrontEngine() && !(this->vehstatus & VS_STOPPED)) return false;
for (const RoadVehicle *v = this; v != NULL; v = v->Next()) {
if (v->state != RVSB_IN_DEPOT || v->tile != tile) return false;