summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-14 15:03:01 +0000
committerbjarni <bjarni@openttd.org>2006-08-14 15:03:01 +0000
commit1f2311413d0a7ea271494d8659b6249c58f6d817 (patch)
treedb9a4d7e000a53060c18449ade4610a791d321ec /vehicle.c
parent9fc837ad85e06b4f99014990537cf91b95474a3d (diff)
downloadopenttd-1f2311413d0a7ea271494d8659b6249c58f6d817.tar.xz
(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
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vehicle.c b/vehicle.c
index 9dcdc29be..b61805dc9 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -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);