summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-10-11 12:35:16 +0000
committerrubidium <rubidium@openttd.org>2009-10-11 12:35:16 +0000
commit8f090ec4a86171b3987b78900a8ea0457c7c092c (patch)
tree1a8d3c7e49e05c8b2b14d9cbaaa5abf56ab0b86c
parent321139782d167f183fa12fa7cded4ee65d9ed23f (diff)
downloadopenttd-8f090ec4a86171b3987b78900a8ea0457c7c092c.tar.xz
(svn r17762) -Fix [FS#3259]: don't let aircraft drive a while over the grass when landing at high altitude airports
-rw-r--r--src/aircraft_cmd.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c5a596da3..6ad01d4c6 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1133,19 +1133,21 @@ static bool AircraftController(Aircraft *v)
continue;
}
- uint curz = GetSlopeZ(x, y) + 1;
+ uint curz = GetSlopeZ(x + amd->x, y + amd->y) + 1;
- if (curz > z) {
- z++;
- } else {
- int t = max(1U, dist - 4);
+ /* We're not flying below our destination, right? */
+ assert(curz <= z);
+ int t = max(1U, dist - 4);
+ int delta = z - curz;
+ /* Only start lowering when we're sufficiently close for a 1:1 glide */
+ if (delta >= t) {
z -= ((z - curz) + t - 1) / t;
- if (z < curz) z = curz;
}
+ if (z < curz) z = curz;
}
- /* We've landed. Decrase speed when we're reaching end of runway. */
+ /* We've landed. Decrease speed when we're reaching end of runway. */
if (amd->flag & AMED_BRAKE) {
uint curz = GetSlopeZ(x, y) + 1;