summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-03-17 01:30:39 +0000
committeryexo <yexo@openttd.org>2009-03-17 01:30:39 +0000
commitcec700574982f04b11b798995a3e98642cb6790c (patch)
tree97d5d88b46f5d66065c2961a6746d268b96a158f
parentf7a7a1f1583aa96357e8b2b74ee396cb483536d9 (diff)
downloadopenttd-cec700574982f04b11b798995a3e98642cb6790c.tar.xz
(svn r15750) -Fix: The big ufo sometimes landed just outside the map. Instead of landing, just disappear (fly away) in those cases.
-rw-r--r--src/disaster_cmd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 2db744fb5..725cd914c 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -481,6 +481,12 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
return;
}
+ if (!IsValidTile(v->dest_tile)) {
+ /* Make sure we don't land outside the map. */
+ delete v;
+ return;
+ }
+
byte z = GetSlopeZ(v->x_pos, v->y_pos);
if (z < v->z_pos) {
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos - 1);