summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 78849b4)
raw | patch | inline | side by side (parent: 78849b4)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 4 Mar 2020 01:00:54 +0000 (04:00 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 4 Mar 2020 01:00:54 +0000 (04:00 +0300) |
src/game/g_netmaster.pas | patch | blob | history |
index fa3d1904c29be532f66056f96f9c38c6c9e11961..391d7729cf405f7e38ba25324f95318487e76af2 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
aliveCount: Integer;
hasUnanswered: Boolean;
stt, ct: Int64;
+ tmpsv: TNetServer;
begin
result := false;
SL := nil;
if InMsg.ReadChar() <> 'D' then continue;
if InMsg.ReadChar() <> 'F' then continue;
+ with tmpsv do
+ begin
+ Port := InMsg.ReadWord();
+ Ping := InMsg.ReadInt64();
+ Ping := GetTimerMS() - Ping;
+ Name := InMsg.ReadString();
+ Map := InMsg.ReadString();
+ GameMode := InMsg.ReadByte();
+ Players := InMsg.ReadByte();
+ MaxPlayers := InMsg.ReadByte();
+ Protocol := InMsg.ReadByte();
+ Password := InMsg.ReadByte() = 1;
+ LocalPl := InMsg.ReadByte();
+ Bots := InMsg.ReadWord();
+ PingAddr := SvAddr;
+ end;
+
FromSL := False;
for I := Low(SL) to High(SL) do
if (SL[I].PingAddr.host = SvAddr.host) and
- (SL[I].PingAddr.port = SvAddr.port) then
+ (SL[I].PingAddr.port = SvAddr.port) and
+ (SL[I].Port = tmpsv.Port) then
begin
- with SL[I] do
- begin
- Port := InMsg.ReadWord();
- Ping := InMsg.ReadInt64();
- Ping := GetTimerMS() - Ping;
- Name := InMsg.ReadString();
- Map := InMsg.ReadString();
- GameMode := InMsg.ReadByte();
- Players := InMsg.ReadByte();
- MaxPlayers := InMsg.ReadByte();
- Protocol := InMsg.ReadByte();
- Password := InMsg.ReadByte() = 1;
- LocalPl := InMsg.ReadByte();
- Bots := InMsg.ReadWord();
- end;
+ tmpsv.IP := SL[I].IP;
+ SL[I] := tmpsv;
FromSL := True;
Inc(Cnt);
break;
end;
+
if not FromSL then
- ProcessLocal();
+ begin
+ I := Length(SL);
+ SetLength(SL, I + 1);
+ tmpsv.IP := DecodeIPV4(SvAddr.host);
+ SL[I] := tmpsv;
+ end;
end;
InMsg.Free();
@@ -1778,7 +1790,7 @@ procedure g_Serverlist_GenerateTable (SL: TNetServerList; var ST: TNetServerTabl
var
i, j: Integer;
- function FindServerInTable(Name: AnsiString): Integer;
+ function FindServerInTable(Name: AnsiString; Port: Word): Integer;
var
i: Integer;
begin
begin
if Length(ST[i].Indices) = 0 then
continue;
- if SL[ST[i].Indices[0]].Name = Name then
+ if (SL[ST[i].Indices[0]].Name = Name) and (SL[ST[i].Indices[0]].Port = Port) then
begin
Result := i;
Exit;
ST := nil;
if SL = nil then
Exit;
+
for i := Low(SL) to High(SL) do
begin
- j := FindServerInTable(SL[i].Name);
+ j := FindServerInTable(SL[i].Name, SL[i].Port);
if j = -1 then
begin
j := Length(ST);