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
commit93be9a1c905b92f2f68c24d71eb718197b9ed7bc (patch)
tree97d5d88b46f5d66065c2961a6746d268b96a158f
parent72dc128915d937da9f8d22885b58b0903f37986a (diff)
downloadopenttd-93be9a1c905b92f2f68c24d71eb718197b9ed7bc.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);