diff options
author | yexo <yexo@openttd.org> | 2009-07-10 22:30:38 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-07-10 22:30:38 +0000 |
commit | b58001f6956c9fb825d5b00b125349b221a71cd8 (patch) | |
tree | 28ea35f156838ccf6047d0f75065b0a728e5abd3 /src/ai/api/ai_vehicle.cpp | |
parent | 4843b3c45d7dac3dc3bde82b8b4b0cfd3c5924e1 (diff) | |
download | openttd-b58001f6956c9fb825d5b00b125349b221a71cd8.tar.xz |
(svn r16790) -Add [NoAI]: AIVehicle::GetReliability to get the current reliability of vehicles
Diffstat (limited to 'src/ai/api/ai_vehicle.cpp')
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 8 |
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; +} |