(svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map
--- a/disaster_cmd.c Fri Aug 11 03:07:46 2006 +0000
+++ b/disaster_cmd.c Fri Aug 11 09:42:12 2006 +0000
@@ -116,7 +116,6 @@
static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z)
{
Vehicle *u;
- int yt;
BeginVehicleMove(v);
v->x_pos = x;
@@ -129,11 +128,14 @@
EndVehicleMove(v);
if ( (u=v->next) != NULL) {
+ int safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE);
+ int safe_y = clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
BeginVehicleMove(u);
u->x_pos = x;
- u->y_pos = yt = y - 1 - (max(z - GetSlopeZ(x, y-1), 0) >> 3);
- u->z_pos = GetSlopeZ(x,yt);
+ u->y_pos = y - 1 - (max(z - GetSlopeZ(safe_x, safe_y), 0) >> 3);
+ safe_y = clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
+ u->z_pos = GetSlopeZ(safe_x, safe_y);
u->direction = v->direction;
DisasterVehicleUpdateImage(u);