summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-03-22 21:27:13 +0000
committerfrosch <frosch@openttd.org>2013-03-22 21:27:13 +0000
commit30f601d685196464cb86b32f2f3f2b13019f0735 (patch)
treec5a2834af593e935abc6c6426861a5f1b2edc66f /src/aircraft_cmd.cpp
parent9eab26a1a1bdccb4da54f598e861f029aa72f41f (diff)
downloadopenttd-30f601d685196464cb86b32f2f3f2b13019f0735.tar.xz
(svn r25115) -Fix (r8973) [FS#5492-ish]: [NewGRF] Acceleration of NewGRF aircraft was too fast, while acceleration of default aircraft was way too slow. I.e. choose wisely who to let write the software for your orbiter.
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index cad674a20..71d8d3bb2 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -598,7 +598,14 @@ enum AircraftSpeedLimits {
*/
static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, bool hard_limit = true)
{
- uint spd = v->acceleration * 16;
+ /**
+ * 'acceleration' has the unit 3/8 mph/tick. This function is called twice per tick.
+ * So the speed amount we need to accelerate is:
+ * acceleration * 3 / 16 mph = acceleration * 3 / 16 * 16 / 10 km-ish/h
+ * = acceleration * 3 / 10 * 256 * (km-ish/h / 256)
+ * ~ acceleration * 77 (km-ish/h / 256)
+ */
+ uint spd = v->acceleration * 77;
byte t;
/* Adjust speed limits by plane speed factor to prevent taxiing