X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_res_downloader.pas;h=78b0b2803ddccde223d34b5705f9def7191d5b63;hb=6a8baf759e33dfda3cf8d9062b6989cfd090a695;hp=0bc531b481d3d18d9c4bd4a153ada3eac0130b2e;hpb=1bddfaf7b6421f1659a6f211dfdb1dfaef5d5173;p=d2df-sdl.git diff --git a/src/game/g_res_downloader.pas b/src/game/g_res_downloader.pas index 0bc531b..78b0b28 100644 --- a/src/game/g_res_downloader.pas +++ b/src/game/g_res_downloader.pas @@ -25,7 +25,7 @@ function g_Res_DownloadWAD(const FileName: string): string; implementation -uses g_language, sfs, utils, wadreader; +uses g_language, sfs, utils, wadreader, g_game; const DOWNLOAD_DIR = 'downloads'; @@ -132,6 +132,7 @@ begin SetLength(mapData.ExternalResources, 0); g_Console_Add(Format(_lc[I_NET_MAP_DL], [FileName])); e_WriteLog('Downloading map `' + FileName + '` from server', TMsgType.Notify); + g_Game_SetLoadingText(FileName + '...', 0, False); MC_SEND_MapRequest(); msgStream := g_Net_Wait_Event(NET_MSG_MAP_RESPONSE); @@ -139,7 +140,8 @@ begin begin mapData := MapDataFromMsgStream(msgStream); msgStream.Free; - end; + end else + mapData.FileSize := 0; for i := 0 to High(mapData.ExternalResources) do begin @@ -151,9 +153,13 @@ begin [mapData.ExternalResources[i].Name])); e_WriteLog('Downloading Wad `' + mapData.ExternalResources[i].Name + '` from server', TMsgType.Notify); + g_Game_SetLoadingText(mapData.ExternalResources[i].Name + '...', 0, False); MC_SEND_ResRequest(mapData.ExternalResources[i].Name); msgStream := g_Net_Wait_Event(NET_MSG_RES_RESPONSE); + if msgStream = nil then + continue; + resData := ResDataFromMsgStream(msgStream); resStream := createDiskFile(GameDir+'/wads/'+mapData.ExternalResources[i].Name); @@ -166,6 +172,8 @@ begin end; Result := SaveWAD(MapsDir, ExtractFileName(FileName), mapData.FileData); + if mapData.FileSize = 0 then + DeleteFile(Result); end; end.