Remove X and Y from the structure since those are misaligned in c code and I failed to do anything about that and they were the last cause of desyncs and only used in 4 places and I'm too lazy webgl
authorunc0rr
Wed, 08 Jan 2014 01:16:20 +0400
branchwebgl
changeset 9972 feb4b031b52e
parent 9970 88353250ad7d
child 9974 fb84e878111d
Remove X and Y from the structure since those are misaligned in c code and I failed to do anything about that and they were the last cause of desyncs and only used in 4 places and I'm too lazy
hedgewars/uIO.pas
--- a/hedgewars/uIO.pas	Wed Jan 08 00:31:30 2014 +0400
+++ b/hedgewars/uIO.pas	Wed Jan 08 01:16:20 2014 +0400
@@ -51,8 +51,7 @@
             loTime: Word;
             case byte of
             1: (len: byte;
-                cmd: Char;
-                X, Y: LongInt);
+                cmd: Char);
             2: (str: shortstring);
             end;
 
@@ -372,8 +371,8 @@
             AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
              end;
         'p': begin
-            x32:= SDLNet_Read32(@(headcmd^.X));
-            y32:= SDLNet_Read32(@(headcmd^.Y));
+            x32:= SDLNet_Read32(@(headcmd^.str[2]));
+            y32:= SDLNet_Read32(@(headcmd^.str[4]));
             doPut(x32, y32, false)
              end;
         'P': begin
@@ -382,8 +381,8 @@
             // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy;
             if CurrentTeam^.ExtDriven then
                begin
-               TargetCursorPoint.X:= LongInt(SDLNet_Read32(@(headcmd^.X))) + WorldDx;
-               TargetCursorPoint.Y:= cScreenHeight - LongInt(SDLNet_Read32(@(headcmd^.Y))) - WorldDy;
+               TargetCursorPoint.X:= LongInt(SDLNet_Read32(@(headcmd^.str[2]))) + WorldDx;
+               TargetCursorPoint.Y:= cScreenHeight - LongInt(SDLNet_Read32(@(headcmd^.str[4]))) - WorldDy;
                if not bShowAmmoMenu and autoCameraOn then
                     CursorPoint:= TargetCursorPoint
                end
@@ -393,7 +392,7 @@
         'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
         '1'..'5': ParseCommand('timer ' + headcmd^.cmd, true);
         else
-            if (headcmd^.cmd >= #128) and (headcmd^.cmd <= char(128 + cMaxSlotIndex)) then
+            if (byte(headcmd^.cmd) >= 128) and (byte(headcmd^.cmd) <= 128 + cMaxSlotIndex) then
                 ParseCommand('slot ' + char(byte(headcmd^.cmd) - 79), true)
                 else
                 OutError('Unexpected protocol command: ' + headcmd^.cmd, True)