# HG changeset patch
# User Urbertar@gmail.com
# Date 1361869209 -7200
# Node ID 08679e8186a3f31d0ace5607c00bef6df0ed9e47
# Parent  f3bc24ef756e5e59a7f880c0684b53317423ed8b
Don't calculate edges of map as edges of landscape

diff -r f3bc24ef756e -r 08679e8186a3 hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Tue Feb 26 10:27:51 2013 +0200
+++ b/hedgewars/GSHandlers.inc	Tue Feb 26 11:00:09 2013 +0200
@@ -5111,16 +5111,18 @@
     i, j:Longint;
 begin    
     result := 0;
-    for i := max(x - 1, 0) to min(x + 1, LAND_WIDTH-1) do
-    begin
-        for j := max(y - 1, 0) to min(y + 1, LAND_HEIGHT-1) do 
-        begin
-            if ((Land[j, i] and $FF00) = 0) then
-            begin
-                result := result + 1;
-            end;
+    for i := x - 1 to x + 1 do
+        for j := y - 1 to y + 1 do 
+        begin
+        if (i < 0) or 
+           (i > LAND_WIDTH - 1) or 
+           (j < 0) or 
+           (j > LAND_HEIGHT -1) or 
+           ((Land[j, i] and $FF00) = 0) then
+           begin
+           result := result + 1;
+           end;
         end;
-    end;
 end;