From aa8f9e28a2d43f025d031af571efbd897630a7a5 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 28 Nov 2013 19:37:24 +0000 Subject: (svn r26134) -Fix [FS#5820]: aircraft crashing near the map's border due to a lack of airports could trigger an assertion in most builds --- src/aircraft_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index e5dea8b75..ee89fbf0d 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1032,7 +1032,7 @@ static bool HandleCrashedAircraft(Aircraft *v) /* make aircraft crash down to the ground */ if (v->crashed_counter < 500 && st == NULL && ((v->crashed_counter % 3) == 0) ) { - int z = GetSlopePixelZ(v->x_pos, v->y_pos); + 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) { v->crashed_counter = 500; -- cgit v1.2.3-54-g00ecf