From c1dd0107c71270e8949ddefac41424b3dd79eca4 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 7 Jul 2012 12:48:53 +0000 Subject: (svn r24380) -Fix [FS#5188]: RoadVehicle::IsInDepot did not check all articulated parts. --- src/roadveh.h | 2 +- src/roadveh_cmd.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/roadveh.h b/src/roadveh.h index 6358cef7f..6205f4b55 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -112,7 +112,7 @@ struct RoadVehicle FINAL : public GroundVehicle { int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; } Money GetRunningCost() const; int GetDisplayImageWidth(Point *offset = NULL) const; - bool IsInDepot() const { return this->state == RVSB_IN_DEPOT; } + bool IsInDepot() const; bool IsStoppedInDepot() const; bool Tick(); void OnNewDay(); diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index f29efb60a..2c06f7897 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -308,10 +308,15 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin bool RoadVehicle::IsStoppedInDepot() const { - TileIndex tile = this->tile; + 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; -- cgit v1.2.3-54-g00ecf