diff --git a/src/roadveh.h b/src/roadveh.h index 6205f4b557..6358cef7f5 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; + 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 2c06f7897a..f29efb60aa 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -307,16 +307,11 @@ 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;