hedgewars/GSHandlers.inc
branchicegun
changeset 8581 f3bc24ef756e
parent 8579 d18bc19d780a
child 8582 08679e8186a3
--- a/hedgewars/GSHandlers.inc	Mon Feb 25 20:45:13 2013 -0500
+++ b/hedgewars/GSHandlers.inc	Tue Feb 26 10:27:51 2013 +0200
@@ -5159,8 +5159,8 @@
 var
     i, j: Longint;
     weight: Longint;
-begin    
-
+    landRect : TSDL_RECT;
+begin
     for i := max(x - iceHalfSize, 0) to min(x + iceHalfSize, LAND_WIDTH-1) do
         begin
         for j := max(y - iceHalfSize, 0) to min(y + iceHalfSize, LAND_HEIGHT-1) do 
@@ -5181,7 +5181,11 @@
             end;
         end;
     SetAllHHToActive; 
-    UpdateLandTexture(x - iceHalfSize, iceSize, y - iceHalfSize, iceSize, true);
+    landRect.x := min(max(x - iceHalfSize, 0), LAND_WIDTH - 1);
+    landRect.y := min(max(y - iceHalfSize, 0), LAND_HEIGHT - 1);
+    landRect.w := min(iceSize, LAND_WIDTH - landRect.x - 1);
+    landRect.h := min(iceSize, LAND_HEIGHT - landRect.y - 1);
+    UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);
 end;