From b58001f6956c9fb825d5b00b125349b221a71cd8 Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 10 Jul 2009 22:30:38 +0000 Subject: (svn r16790) -Add [NoAI]: AIVehicle::GetReliability to get the current reliability of vehicles --- src/ai/api/ai_vehicle.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ai/api/ai_vehicle.cpp') 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; +} -- cgit v1.2.3-54-g00ecf