Fix rendering errors now. webgl
authorunc0rr
Wed, 03 Apr 2013 00:16:37 +0400
branchwebgl
changeset 8841 338f7c2bac2c
parent 8839 caa57115d7ea
child 8844 b216eccfb77a
Fix rendering errors now.
hedgewars/uIO.pas
hedgewars/uLandGraphics.pas
hedgewars/uUtils.pas
--- a/hedgewars/uIO.pas	Wed Apr 03 00:03:46 2013 +0400
+++ b/hedgewars/uIO.pas	Wed Apr 03 00:16:37 2013 +0400
@@ -222,7 +222,11 @@
 
 function isSyncedCommand(c: char): boolean;
 begin
-    isSyncedCommand:= (c in ['+', '#', 'L', 'l', 'R', 'r', 'U', 'u', 'D', 'd', 'Z', 'z', 'A', 'a', 'S', 'j', 'J', ',', 'c', 'N', 'p', 'P', 'w', 't', '1', '2', '3', '4', '5']) or ((c >= #128) and (c <= char(128 + cMaxSlotIndex)))
+    case c of
+        '+', '#', 'L', 'l', 'R', 'r', 'U', 'u', 'D', 'd', 'Z', 'z', 'A', 'a', 'S', 'j', 'J', ',', 'c', 'N', 'p', 'P', 'w', 't', '1', '2', '3', '4', '5': isSyncedCommand:= true;
+    else
+        isSyncedCommand:= ((c >= #128) and (c <= char(128 + cMaxSlotIndex)))
+    end
 end;
 
 procedure flushBuffer();
--- a/hedgewars/uLandGraphics.pas	Wed Apr 03 00:03:46 2013 +0400
+++ b/hedgewars/uLandGraphics.pas	Wed Apr 03 00:16:37 2013 +0400
@@ -94,14 +94,14 @@
 
 function isLandscapeEdge(weight:Longint):boolean; inline;
 begin
-result := (weight < 8) and (weight >= 2);
+isLandscapeEdge := (weight < 8) and (weight >= 2);
 end;
 
 function getPixelWeight(x, y:Longint): Longint;
 var
-    i, j:Longint;
+    i, j, r: Longint;
 begin
-result := 0;
+r := 0;
 for i := x - 1 to x + 1 do
     for j := y - 1 to y + 1 do
     begin
@@ -109,13 +109,13 @@
        (i > LAND_WIDTH - 1) or
        (j < 0) or
        (j > LAND_HEIGHT -1) then
-       begin
-       result := 9;
-       exit;
-       end;
+       exit(9);
+
     if Land[j, i] and lfLandMask and (not lfIce) = 0 then
-       result := result + 1;
+       inc(r)
     end;
+
+    getPixelWeight:= r
 end;
 
 
--- a/hedgewars/uUtils.pas	Wed Apr 03 00:03:46 2013 +0400
+++ b/hedgewars/uUtils.pas	Wed Apr 03 00:16:37 2013 +0400
@@ -481,8 +481,12 @@
     if (c < #32) or (c > #127) then
         r:= '#' + inttostr(byte(c))
         else
-        r:= c;
-            
+        begin
+        // some magic for pas2c
+        r[0]:= #1;
+        r[1]:= c;
+        end;
+
     sanitizeCharForLog:= r
 end;