DEADSOFTWARE

game: create/refresh hash databases only when the game is going to conntect to any...
[d2df-sdl.git] / src / game / g_game.pas
index ae66faad7854babd93cd1115ccfa83903def765a..2b827412980e5292b5ecd3db459292af8ed0c734 100644 (file)
@@ -4610,6 +4610,10 @@ begin
   NetState := NET_STATE_AUTH;
 
   g_Game_SetLoadingText(_lc[I_LOAD_CONNECT], 0, False);
+
+  // create (or update) map/resource databases
+  g_Res_CreateDatabases(true);
+
 // Ñòàðòóåì êëèåíò
   if not g_Net_Connect(Addr, Port) then
   begin
@@ -4675,6 +4679,7 @@ begin
               NetState := NET_STATE_NONE;
               Exit;
             end;
+            e_LogWritefln('using downloaded map wad [%s] for [%s]`', [newResPath, WadName], TMsgType.Notify);
           end;
           newResPath := ExtractRelativePath(MapsDir, newResPath);
 
@@ -4824,7 +4829,7 @@ begin
       end
       else
       begin
-        gWADHash := MD5File(nws);
+        if (g_Game_IsNet) then gWADHash := MD5File(nws);
         //writeln('********: nws=', nws, ' : Map=', Map, ' : nw=', NewWAD, ' : resname=', ResName);
         g_Game_LoadWAD(NewWAD);
       end;
@@ -5010,7 +5015,7 @@ end;
 
 procedure g_Game_ClientWAD(NewWAD: String; const WHash: TMD5Digest);
 var
-  gWAD: String;
+  gWAD, xwad: String;
 begin
   if not g_Game_IsClient then Exit;
   //e_LogWritefln('*** g_Game_ClientWAD: `%s`', [NewWAD]);
@@ -5023,7 +5028,9 @@ begin
     Exit;
   end;
 
-  NewWAD := ExtractRelativePath(MapsDir, gWAD);
+  xwad := ExtractRelativePath(MapsDir, gWAD);
+  e_LogWritefln('using downloaded client map wad [%s] for [%s]`', [xwad, NewWAD], TMsgType.Notify);
+  NewWAD := xwad;
   g_Game_LoadWAD(NewWAD);
 
   {