(svn r5888) -Fix: [autoreplace] if vehicles breakdowns and service are turned off, the vehicles failed to enter any depots

now they will quickly go to a depot if set to be replaced
	the tradeoff is that a vehicle set to be replaced and without a depot in the orders will forget about the orders and head for a depot. If the replace fails (lack of money), it will exit and try to head for the depot again
	also all vehicles of that type will rush to the depots at once, risking causing traffic jams. This is because there is no way to even it out like normal depot visits offers
	Tip: add a depot to the orders of all vehicles, set it to service only and it will always be skipped unless the vehicle is set to be replaced. This should help on the jam issue and if the replace fails, the vehicle will go though a whole round of the orders and make more money before trying again
pull/155/head
bjarni 18 years ago
parent 9fc837ad85
commit 1f2311413d

@ -98,12 +98,16 @@ void VehicleServiceInDepot(Vehicle *v)
bool VehicleNeedsService(const Vehicle *v)
{
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0)
return false;
if (v->vehstatus & VS_CRASHED)
return false; /* Crashed vehicles don't need service anymore */
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
if (EngineReplacementForPlayer(GetPlayer(v->owner), v->engine_type) != INVALID_ENGINE)
return true; /* Vehicles set for autoreplacing needs to go to a depot even if breakdowns are turned off */
else
return false;
}
return _patches.servint_ispercent ?
(v->reliability < GetEngine(v->engine_type)->reliability * (100 - v->service_interval) / 100) :
(v->date_of_last_service + v->service_interval < _date);

Loading…
Cancel
Save