From bdb64325fd3eff1fdb61e189fcf3d901007a28fd Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 11 Aug 2006 09:42:12 +0000 Subject: (svn r5841) -Fix r5794: use the height of the edge of the map for shadows of disasters that are outside the map --- disaster_cmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/disaster_cmd.c b/disaster_cmd.c index 27ca9e29d..f34b1446f 100644 --- a/disaster_cmd.c +++ b/disaster_cmd.c @@ -116,7 +116,6 @@ static void DeleteDisasterVeh(Vehicle *v) 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 @@ static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z) 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); -- cgit v1.2.3-70-g09d2