summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8f5d5b7)
raw | patch | inline | side by side (parent: 8f5d5b7)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 11 Oct 2019 21:09:23 +0000 (00:09 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 12 Oct 2019 15:54:12 +0000 (18:54 +0300) |
we could restart downloading with the new map hash instead, but meh...
anyway, aborting is better than trying to download some obsolete crap.
anyway, aborting is better than trying to download some obsolete crap.
src/game/g_game.pas | patch | blob | history | |
src/game/g_net.pas | patch | blob | history | |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_res_downloader.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index babcb8e2cd3e7f2a19b28a00218cc5d3ea107416..46251bb7d3e2684ec69a340f2ad415de97f6f821 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
begin
if (NetEvent.kind = ENET_EVENT_TYPE_RECEIVE) then
begin
+ if (NetEvent.channelID = NET_CHAN_DOWNLOAD_EX) then
+ begin
+ // ignore all download packets, they're processed by separate code
+ enet_packet_destroy(NetEvent.packet);
+ continue;
+ end;
Ptr := NetEvent.packet^.data;
if not InMsg.Init(Ptr, NetEvent.packet^.dataLength, True) then
+ begin
+ enet_packet_destroy(NetEvent.packet);
continue;
+ end;
InMsg.ReadLongWord(); // skip size
MID := InMsg.ReadByte();
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 60d91c110a118bfe840059d4ffd01035a84ee95c..82f4632a28c22fefd344cdca1e406d3f547534e0 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
NetDumpFile: TStream;
+ g_Res_received_map_start: Boolean = false; // set if we received "map change" event
+
+
function g_Net_Init(): Boolean;
procedure g_Net_Cleanup();
procedure g_Net_Free();
case NetEvent.kind of
ENET_EVENT_TYPE_RECEIVE:
begin
+ if (NetEvent.channelID = NET_CHAN_DOWNLOAD_EX) then continue; // ignore all download packets, they're processed by separate code
if NetDump then g_Net_DumpRecvBuffer(NetEvent.packet^.data, NetEvent.packet^.dataLength);
g_Net_Client_HandlePacket(NetEvent.packet, g_Net_ClientMsgHandler);
end;
case NetEvent.kind of
ENET_EVENT_TYPE_RECEIVE:
begin
+ if (NetEvent.channelID = NET_CHAN_DOWNLOAD_EX) then continue; // ignore all download packets, they're processed by separate code
if NetDump then g_Net_DumpRecvBuffer(NetEvent.packet^.data, NetEvent.packet^.dataLength);
g_Net_Client_HandlePacket(NetEvent.packet, g_Net_ClientLightMsgHandler);
end;
if (ev.channelID <> NET_CHAN_DOWNLOAD_EX) then
begin
//e_LogWritefln('g_Net_Wait_MapInfo: skip message from non-transfer channel', []);
+ freePacket := false;
+ g_Net_Client_HandlePacket(ev.packet, g_Net_ClientLightMsgHandler);
+ if (g_Res_received_map_start) then begin result := -666; exit; end;
end
else
begin
if (ev.channelID <> NET_CHAN_DOWNLOAD_EX) then
begin
//e_LogWriteln('g_Net_Wait_Event: skip message from non-transfer channel');
+ freePacket := false;
+ g_Net_Client_HandlePacket(ev.packet, g_Net_ClientLightMsgHandler);
+ if (g_Res_received_map_start) then begin result := -666; exit; end;
end
else
begin
if (ev.channelID <> NET_CHAN_DOWNLOAD_EX) then
begin
//e_LogWritefln('g_Net_Wait_Event: skip message from non-transfer channel', []);
+ freePacket := false;
+ g_Net_Client_HandlePacket(ev.packet, g_Net_ClientLightMsgHandler);
+ if (g_Res_received_map_start) then begin result := -666; exit; end;
end
else
begin
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 2541dfd37de2abcb9969a41fb9dace000ab37f71..0483bea1651608dc407895e67f6125f568f932f1 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
case EvType of
NET_EV_MAPSTART:
begin
+ g_Res_received_map_start := true;
gGameOn := False;
g_Game_ClearLoading();
g_Game_StopAllSounds(True);
NET_EV_MAPEND:
begin
+ g_Res_received_map_start := true;
gMissionFailed := EvNum <> 0;
gExit := EXIT_ENDLEVELCUSTOM;
end;
index a092437993d1601f774deb9235ff1ac037916e7d..ed1ea3bdf3feb7c77de12529d99b0b146c67d94b 100644 (file)
//result := g_Res_SearchResWad(true{asMap}, mapHash);
result := '';
g_Res_ClearReplacementWads();
+ g_Res_received_map_start := false;
try
CreateDir(GameDir+'/maps/downloads');