(svn r24384) -Fix [FS#5188-ish]: Make IsInDepot() functions behave consistent across vehicle types and add IsChainInDepot instead, if that is what shall be checked.

This commit is contained in:
frosch
2012-07-07 15:39:46 +00:00
parent ff95e3edaf
commit 358a2bd6ed
14 changed files with 55 additions and 63 deletions

View File

@@ -306,19 +306,6 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
return CommandCost();
}
bool RoadVehicle::IsStoppedInDepot() 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;
}
return true;
}
static FindDepotData FindClosestRoadDepot(const RoadVehicle *v, int max_distance)
{
if (IsRoadDepotTile(v->tile)) return FindDepotData(v->tile, 0);
@@ -1582,7 +1569,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
{
/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
if (Company::Get(v->owner)->settings.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
if (v->IsInDepot()) {
if (v->IsChainInDepot()) {
VehicleServiceInDepot(v);
return;
}