summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-12-09 08:37:15 +0000
committerrubidium <rubidium@openttd.org>2006-12-09 08:37:15 +0000
commit9a0917141b99cea7703e28af3c46cdbc86f23629 (patch)
tree4912d9129d2de32269aea4306e1132cf2a0877a8
parenta3bd9251ae4fd3ba03513dcdadfa89790a043656 (diff)
downloadopenttd-9a0917141b99cea7703e28af3c46cdbc86f23629.tar.xz
(svn r7448) -Fix (r5794): use the height of the edge of the map for effect vehicles that are outside the map.
-rw-r--r--vehicle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vehicle.c b/vehicle.c
index 9c657483c..89d2ed0a3 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1431,7 +1431,9 @@ Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type)
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type)
{
- return CreateEffectVehicle(x, y, GetSlopeZ(x, y) + z, type);
+ int safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE);
+ int safe_y = clamp(y, 0, MapMaxY() * TILE_SIZE);
+ return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type);
}
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type)