diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 95f8f459b862c6a0253d699b0c89715040bcb1a6..fc5287a4dacc8708686611304a0a76afaa10706c 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
e_log, e_msg, ENet, Classes, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
const
- NET_PROTOCOL_VER = 173;
+ NET_PROTOCOL_VER = 174;
NET_MAXCLIENTS = 24;
NET_CHANS = 11;
NET_CLIENT = 2;
NET_BUFSIZE = $FFFF;
+ NET_PING_PORT = $DF2D;
NET_EVERYONE = -1;
NetPongForwarded: Boolean = False;
NetIGDControl: AnsiString;
NetIGDService: TURLStr;
- NetPortThread: TThreadID = 0;
{$ENDIF}
+ NetPortThread: TThreadID = 0;
+
NetDumpFile: TStream;
function g_Net_Init(): Boolean;
if NetPongSock <> ENET_SOCKET_NULL then
begin
NetPongAddr.host := IPAddr;
- NetPongAddr.port := Port + 1;
+ NetPongAddr.port := NET_PING_PORT;
if enet_socket_bind(NetPongSock, @NetPongAddr) < 0 then
begin
enet_socket_destroy(NetPongSock);
NetOut.Clear();
NetOut.Write(Byte(Ord('D')));
NetOut.Write(Byte(Ord('F')));
+ NetOut.Write(NetPort);
NetOut.Write(ClTime);
g_Net_Slist_WriteInfo();
NPl := 0;
Result := 0;
if NetUseMaster then
- begin
g_Net_Slist_Check;
- g_Net_Host_CheckPings;
- end;
+ g_Net_Host_CheckPings;
while (enet_host_service(NetHost, @NetEvent, 0) > 0) do
begin
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
OuterLoop := False;
end;
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
break;
end;
Result := msgStream;
NetPongForwarded := False;
NetPortForwarded := 0;
- DevList := upnpDiscover(1000, nil, nil, 0, 0, Addr(Err));
+ DevList := upnpDiscover(1000, nil, nil, 0, 0, 2, Addr(Err));
if DevList = nil then
begin
conwritefln('port forwarding failed: upnpDiscover() failed: %d', [Err]);
if ForwardPongPort then
begin
- StrPort := IntToStr(NetPort + 1);
+ StrPort := IntToStr(NET_PING_PORT);
I := UPNP_AddPortMapping(
Urls.controlURL, Addr(data.first.servicetype[1]),
PChar(StrPort), PChar(StrPort), Addr(LanAddr[0]), PChar('D2DF'),