diff options
author | frosch <frosch@openttd.org> | 2009-02-01 16:21:18 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-02-01 16:21:18 +0000 |
commit | 317220c2e4f9d0866553635872cae952616169dc (patch) | |
tree | 3e031958b4536d4964ee63d7681995cc7d84008a /src/ai/api | |
parent | c28c4c1986a9a25cbf67ed84c6ba3d51447bbb6f (diff) | |
download | openttd-317220c2e4f9d0866553635872cae952616169dc.tar.xz |
(svn r15307) -Fix: AIVehicle::GetCurrentSpeed() should also use km-ish/h instead of mph. (Documentation by Rubidium)
Diffstat (limited to 'src/ai/api')
-rw-r--r-- | src/ai/api/ai_bridge.hpp | 5 | ||||
-rw-r--r-- | src/ai/api/ai_engine.hpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_event_types.hpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_vehicle.hpp | 4 |
5 files changed, 14 insertions, 5 deletions
diff --git a/src/ai/api/ai_bridge.hpp b/src/ai/api/ai_bridge.hpp index 819242e79..a4bac67f7 100644 --- a/src/ai/api/ai_bridge.hpp +++ b/src/ai/api/ai_bridge.hpp @@ -60,10 +60,13 @@ public: static char *GetName(BridgeID bridge_id); /** - * Get the maximum speed of a bridge (in km/h). + * Get the maximum speed of a bridge. * @param bridge_id The bridge to get the maximum speed of. * @pre IsValidBridge(bridge_id). * @return The maximum speed the bridge has. + * @note The speed is in OpenTTD's internal speed unit. + * This is mph / 1.6, which is roughly km/h. + * To get km/h multiply this number by 1.00584. */ static int32 GetMaxSpeed(BridgeID bridge_id); diff --git a/src/ai/api/ai_engine.hpp b/src/ai/api/ai_engine.hpp index 7e49558a1..6fe865327 100644 --- a/src/ai/api/ai_engine.hpp +++ b/src/ai/api/ai_engine.hpp @@ -91,7 +91,9 @@ public: * @param engine_id The engine to get the maximum speed of. * @pre IsValidEngine(engine_id). * @return The maximum speed the engine has. - * @note The speed is in km/h. + * @note The speed is in OpenTTD's internal speed unit. + * This is mph / 1.6, which is roughly km/h. + * To get km/h multiply this number by 1.00584. */ static int32 GetMaxSpeed(EngineID engine_id); diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp index 75bef42a1..044892ab7 100644 --- a/src/ai/api/ai_event_types.hpp +++ b/src/ai/api/ai_event_types.hpp @@ -240,7 +240,9 @@ public: /** * Get the maximum speed of the offered engine. * @return The maximum speed the engine has. - * @note The speed is in km/h. + * @note The speed is in OpenTTD's internal speed unit. + * This is mph / 1.6, which is roughly km/h. + * To get km/h multiply this number by 1.00584. */ int32 GetMaxSpeed(); diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index 93732130b..081b7b739 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -278,7 +278,7 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->GetDisplaySpeed(); + return ::GetVehicle(vehicle_id)->GetDisplaySpeed() * 16 / 10; } /* static */ AIVehicle::VehicleState AIVehicle::GetState(VehicleID vehicle_id) diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp index f0be433da..961a451d3 100644 --- a/src/ai/api/ai_vehicle.hpp +++ b/src/ai/api/ai_vehicle.hpp @@ -205,7 +205,9 @@ public: * @param vehicle_id The vehicle to get the age of. * @pre IsValidVehicle(vehicle_id). * @return The current speed of the vehicle. - * @note Speed is in km/h. + * @note The speed is in OpenTTD's internal speed unit. + * This is mph / 1.6, which is roughly km/h. + * To get km/h multiply this number by 1.00584. */ static int32 GetCurrentSpeed(VehicleID vehicle_id); |