DEADSOFTWARE

network: fixed server pings
authorKetmar Dark <ketmar@ketmar.no-ip.org>
Mon, 18 Apr 2016 16:04:44 +0000 (19:04 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Mon, 18 Apr 2016 16:04:44 +0000 (19:04 +0300)
src/engine/e_fixedbuffer.pas
src/engine/e_graphics.pas
src/game/g_net.pas
src/game/g_netmsg.pas

index 3a450bbffe1cbdf9540a580619f6a33d531061f6..d0248a151de9734a73c6eddfe1e08b7dd5e5cc63 100644 (file)
@@ -36,6 +36,7 @@ procedure e_Buffer_Write(B: pTBuffer; V: LongWord); overload;
 procedure e_Buffer_Write(B: pTBuffer; V: ShortInt); overload;
 procedure e_Buffer_Write(B: pTBuffer; V: SmallInt); overload;
 procedure e_Buffer_Write(B: pTBuffer; V: LongInt); overload;
+procedure e_Buffer_Write(B: pTBuffer; V: Int64); overload;
 
 procedure e_Buffer_Write(B: pTBuffer; V: string); overload;
 
@@ -139,6 +140,10 @@ procedure e_Buffer_Write(B: pTBuffer; V: LongInt); overload;
 begin
   e_Buffer_Write_Generic(B, V, 4);
 end;
+procedure e_Buffer_Write(B: pTBuffer; V: Int64); overload;
+begin
+  e_Buffer_Write_Generic(B, V, 8);
+end;
 
 procedure e_Buffer_Write(B: pTBuffer; V: string); overload;
 var
index 42dee97a2a0673fb6e25237c29abaae5c35319c6..cdfe09bcfb31823a3e3718f933782951e94eea52 100644 (file)
@@ -1660,7 +1660,6 @@ var
   pixels, obuf, scln, ps, pd: PByte;
   obufsize: Integer;
   dlen: Cardinal;
-  tmp: Byte;
   i, res: Integer;
   sign: array [0..7] of Byte;
   hbuf: array [0..12] of Byte;
index 72cbb9a48d6a60d8a1bfe49fefcabe3920cba925..b8f957a32cfb32840360e0382db804f931611506 100644 (file)
@@ -7,7 +7,7 @@ uses
   e_log, e_fixedbuffer, ENet, ENetTypes, ENetPlatform, Classes;
 
 const
-  NET_PROTOCOL_VER = 164;
+  NET_PROTOCOL_VER = 165;
 
   NET_MAXCLIENTS = 24;
   NET_CHANS = 11;
@@ -424,14 +424,15 @@ procedure g_Net_Host_CheckPings();
 var
   ClAddr: ENetAddress;
   Buf: ENetBuffer;
-  Len, ClTime: Integer;
-  Ping: array [0..5] of Byte;
+  Len: Integer;
+  ClTime: Int64;
+  Ping: array [0..9] of Byte;
   NPl: Byte;
 begin
   if NetPongSock = ENET_SOCKET_NULL then Exit;
 
   Buf.data := Addr(Ping[0]);
-  Buf.dataLength := 6;
+  Buf.dataLength := 2+8;
 
   Ping[0] := 0;
 
@@ -440,7 +441,7 @@ begin
 
   if (Ping[0] = Ord('D')) and (Ping[1] = Ord('F')) then
   begin
-    ClTime := Integer(Addr(Ping[2])^);
+    ClTime := Int64(Addr(Ping[2])^);
 
     e_Buffer_Clear(@NetOut);
     e_Buffer_Write(@NetOut, Byte(Ord('D')));
index 90b25ff451db1fea4de035a82b96f1f353f1d19a..7889180c1ba6f47893e58916f3154f2efc5ad043 100644 (file)
@@ -6,7 +6,7 @@ interface
 uses g_net, g_triggers, Classes, SysUtils, md5;
 
 const
-  NET_PROTO_VERSION = 1;
+  NET_PROTO_VERSION = 2;
 
   NET_MSG_INFO   = 100;