From 9b830e9eb26b16266f723f5af3ae3013c4122f4c Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 5 Apr 2024 19:16:22 +0100 Subject: [PATCH] Fix: Aircraft crash counter was too low to reach ground. (#12425) Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low. Instead reset the counter until the aircraft reaches the ground, then continue the timer. (cherry picked from commit 83da886093bc953d6db0292dbf152097c3791d5a) --- src/aircraft_cmd.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index c36f9f781b..6658d74d54 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1269,9 +1269,11 @@ static bool HandleCrashedAircraft(Aircraft *v) if (v->crashed_counter < 500 && st == nullptr && ((v->crashed_counter % 3) == 0) ) { int z = GetSlopePixelZ(Clamp(v->x_pos, 0, MapMaxX() * TILE_SIZE), Clamp(v->y_pos, 0, MapMaxY() * TILE_SIZE)); v->z_pos -= 1; - if (v->z_pos == z) { + if (v->z_pos <= z) { v->crashed_counter = 500; - v->z_pos++; + v->z_pos = z + 1; + } else { + v->crashed_counter = 0; } SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos); }