summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-12-11 10:17:10 +0000
committertron <tron@openttd.org>2004-12-11 10:17:10 +0000
commit0ba5123cef72c427c010f9ce8bcb6003e1de72bd (patch)
treed480e20495e9f20ac7e66ff407aa48a08fcb4321 /vehicle.c
parent5a3ef18c94cabc855b956a2bbcd6a7ed91ea2b2e (diff)
downloadopenttd-0ba5123cef72c427c010f9ce8bcb6003e1de72bd.tar.xz
(svn r1015) MFM r789
Replaced the slightly misleading SERVICE_INTERVAL by a function VehicleNeedsService()
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index 145d22561..55bb3a186 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -22,6 +22,13 @@ void VehicleServiceInDepot(Vehicle *v)
v->reliability = _engines[v->engine_type].reliability;
}
+bool VehicleNeedsService(const Vehicle *v)
+{
+ return _patches.servint_ispercent ?
+ (v->reliability < _engines[v->engine_type].reliability * (100 - v->service_interval) / 100) :
+ (v->date_of_last_service + v->service_interval < _date);
+}
+
Order UnpackOldOrder(uint16 packed)
{
Order order;