# HG changeset patch # User frosch # Date 2012-07-07 12:48:53 # Node ID aa67387a98c0d8c6bd1ffb6f178de39008ef6fe3 # Parent 167f32fa23a5b008d390cc753e8e41a68658721d (svn r24380) -Fix [FS#5188]: RoadVehicle::IsInDepot did not check all articulated parts. diff --git a/src/roadveh.h b/src/roadveh.h --- a/src/roadveh.h +++ b/src/roadveh.h @@ -112,7 +112,7 @@ struct RoadVehicle FINAL : public Ground 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 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -308,10 +308,15 @@ CommandCost CmdBuildRoadVehicle(TileInde 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;