summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-27 13:31:26 +0000
committersmatz <smatz@openttd.org>2009-08-27 13:31:26 +0000
commit100ae8efcc592ec44f0cc161e0045fb84b67c45e (patch)
tree79e23872457025fcbbc5f0a92e071c53d687ec7b /src/ai/api
parent984efae368da7a7a7e5090820ef31c9c3a678670 (diff)
downloadopenttd-100ae8efcc592ec44f0cc161e0045fb84b67c45e.tar.xz
(svn r17292) -Codechange: use unified ToPercent() function to convert fract numbers to percents
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_engine.cpp2
-rw-r--r--src/ai/api/ai_vehicle.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp
index d25f522e1..a3f5c39cd 100644
--- a/src/ai/api/ai_engine.cpp
+++ b/src/ai/api/ai_engine.cpp
@@ -99,7 +99,7 @@
if (!IsValidEngine(engine_id)) return -1;
if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
- return (::Engine::Get(engine_id)->reliability * 100 >> 16);
+ return ::ToPercent16(::Engine::Get(engine_id)->reliability);
}
/* static */ int32 AIEngine::GetMaxSpeed(EngineID engine_id)
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index e15062daa..acf1a3bd8 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -438,5 +438,5 @@
if (!IsValidVehicle(vehicle_id)) return -1;
const Vehicle *v = ::Vehicle::Get(vehicle_id);
- return v->reliability * 100 >> 16;
+ return ::ToPercent16(v->reliability);
}