summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api/ai_vehicle.cpp')
-rw-r--r--src/ai/api/ai_vehicle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index f86eed7fd..b073c9612 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -425,3 +425,11 @@
Vehicle *v = ::Vehicle::Get(vehicle_id);
return v->orders.list != NULL && v->orders.list->GetNumVehicles() > 1;
}
+
+/* static */ int AIVehicle::GetReliability(VehicleID vehicle_id)
+{
+ if (!IsValidVehicle(vehicle_id)) return -1;
+
+ const Vehicle *v = ::Vehicle::Get(vehicle_id);
+ return v->reliability * 100 >> 16;
+}