From bd49d7f62886832d9d3b4bf0169269315fe7262f Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Mon, 18 Apr 2016 19:04:44 +0300 Subject: [PATCH] network: fixed server pings --- src/engine/e_fixedbuffer.pas | 5 +++++ src/engine/e_graphics.pas | 1 - src/game/g_net.pas | 11 ++++++----- src/game/g_netmsg.pas | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/engine/e_fixedbuffer.pas b/src/engine/e_fixedbuffer.pas index 3a450bb..d0248a1 100644 --- a/src/engine/e_fixedbuffer.pas +++ b/src/engine/e_fixedbuffer.pas @@ -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 diff --git a/src/engine/e_graphics.pas b/src/engine/e_graphics.pas index 42dee97..cdfe09b 100644 --- a/src/engine/e_graphics.pas +++ b/src/engine/e_graphics.pas @@ -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; diff --git a/src/game/g_net.pas b/src/game/g_net.pas index 72cbb9a..b8f957a 100644 --- a/src/game/g_net.pas +++ b/src/game/g_net.pas @@ -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'))); diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 90b25ff..7889180 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -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; -- 2.29.2