index a1b9b6feda29f39b78307cbedc888586d0b81529..1f7ddf1e787877483b48dce108eaa7ddd01de0bc 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
unit g_netmaster;
interface
Port: Word;
Map: string;
Players, MaxPlayers, LocalPl, Bots: Byte;
- Ping: Integer;
+ Ping: Int64;
GameMode: Byte;
Password: Boolean;
PingAddr: ENetAddress;
uses
SysUtils, e_fixedbuffer, e_input, e_graphics, e_log, g_window, g_net, g_console,
- g_map, g_game, g_sound, g_textures, g_gui, g_menu, g_options, g_language, WADEDITOR,
+ g_map, g_game, g_sound, g_textures, g_gui, g_menu, g_options, g_language, wadreader,
ENetPlatform;
var
slFetched: Boolean = False;
slDirPressed: Boolean = False;
-function GetTimerMS(): Integer;
+function GetTimerMS(): Int64;
begin
- Result := GetTimer() div 1000;
+ Result := GetTimer() {div 1000};
end;
procedure PingServer(var S: TNetServer; Sock: ENetSocket);
var
Buf: ENetBuffer;
- Ping: array [0..5] of Byte;
- ClTime: Integer;
+ Ping: array [0..9] of Byte;
+ ClTime: Int64;
begin
ClTime := GetTimerMS();
Buf.data := Addr(Ping[0]);
- Buf.dataLength := 6;
+ Buf.dataLength := 2+8;
Ping[0] := Ord('D');
Ping[1] := Ord('F');
- LongInt(Addr(Ping[2])^) := ClTime;
+ Int64(Addr(Ping[2])^) := ClTime;
enet_socket_send(Sock, Addr(S.PingAddr), @Buf, 1);
end;
Cnt: Byte;
P: pENetPacket;
MID: Byte;
- I, T, RX: Integer;
+ I, RX: Integer;
+ T: Int64;
Sock: ENetSocket;
Buf: ENetBuffer;
SvAddr: ENetAddress;
Cnt := e_Raw_Read_Byte(NetMEvent.packet^.data);
e_WriteLog('Retrieved ' + IntToStr(Cnt) + ' server(s).', MSG_NOTIFY);
g_Console_Add(_lc[I_NET_MSG] + Format(_lc[I_NET_SLIST_RETRIEVED], [Cnt]), True);
+ //writeln('BOO!');
if Cnt > 0 then
begin
begin
with SL[I] do
begin
- Ping := e_Buffer_Read_LongInt(@NetIn);
+ Ping := e_Buffer_Read_Int64(@NetIn);
Ping := GetTimerMS() - Ping;
Name := e_Buffer_Read_String(@NetIn);
Map := e_Buffer_Read_String(@NetIn);
Wad, Map: string;
Cli: Byte;
begin
- g_ProcessResourceStr(gMapInfo.Map, @Wad, nil, @Map);
- Wad := ExtractFileName(Wad);
+ Wad := g_ExtractWadNameNoPath(gMapInfo.Map);
+ Map := g_ExtractFileName(gMapInfo.Map);
e_Buffer_Write(@NetOut, NetServerName);