summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-28 19:37:24 +0000
committerrubidium <rubidium@openttd.org>2013-11-28 19:37:24 +0000
commitaa8f9e28a2d43f025d031af571efbd897630a7a5 (patch)
tree1286d7638143c2935db1495abd50f27cc9d9615c /src/aircraft_cmd.cpp
parentf6362ae29894a9c46c5024639e999c203547e83c (diff)
downloadopenttd-aa8f9e28a2d43f025d031af571efbd897630a7a5.tar.xz
(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
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
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;