DEADSOFTWARE

net: do not hiccup when the game is in progress, and master server is not available
[d2df-sdl.git] / src / game / g_game.pas
index b89b03736ce7c8d0f7b62425729ff69d3a3e856b..2084d8876e43323c661c78b7f741a01567defe89 100644 (file)
@@ -2130,7 +2130,7 @@ begin
         begin
           if (NetMHost = nil) or (NetMPeer = nil) then
           begin
-            if not g_Net_Slist_Connect then g_Console_Add(_lc[I_NET_MSG_ERROR] + _lc[I_NET_SLIST_ERROR]);
+            g_Net_Slist_Connect(false); // non-blocking connection to the master
           end;
 
           g_Net_Slist_Update;
@@ -3666,13 +3666,20 @@ begin
 
   renderMapInternal(-c, -d, true);
 
-  if (gGameSettings.GameMode <> GM_SINGLE) and gPlayerIndicator then
-    if gPlayers[i] <> nil then
-      for i := 0 to High(gPlayers) do
-        if gPlayers[i] = p then gPlayers[i].DrawIndicator(_RGB(255, 255, 255))
-        else if (gPlayers[i].Team = p.Team) and (gPlayers[i].Team <> TEAM_NONE)
-        then
-          gPlayers[i].DrawIndicator(gPlayers[i].GetColor);
+  if (gGameSettings.GameMode <> GM_SINGLE) and (gPlayerIndicator > 0) then
+    case gPlayerIndicator of
+      1:
+        p.DrawIndicator(_RGB(255, 255, 255));
+
+      2:
+        for i := 0 to High(gPlayers) do
+          if gPlayers[i] <> nil then
+            if gPlayers[i] = p then p.DrawIndicator(_RGB(255, 255, 255))
+            else if (gPlayers[i].Team = p.Team) and (gPlayers[i].Team <> TEAM_NONE) then
+              if gPlayerIndicatorStyle = 1 then
+                gPlayers[i].DrawIndicator(_RGB(192, 192, 192))
+              else gPlayers[i].DrawIndicator(gPlayers[i].GetColor);
+    end;
 
   if p.FSpectator then
     e_TextureFontPrintEx(p.GameX + PLAYER_RECT_CX - 4,
@@ -4881,9 +4888,10 @@ begin
     if NetUseMaster then
     begin
       if (NetMHost = nil) or (NetMPeer = nil) then
-        if not g_Net_Slist_Connect then
-          g_Console_Add(_lc[I_NET_MSG_ERROR] + _lc[I_NET_SLIST_ERROR]);
-
+      begin
+        // let the connection be blocking here, why not?
+        g_Net_Slist_Connect();
+      end;
       g_Net_Slist_Update;
     end;
 
@@ -5494,9 +5502,7 @@ begin
       if g_Game_IsServer and g_Game_IsNet then
         if NetUseMaster then
         begin
-          if NetMPeer = nil then
-            if not g_Net_Slist_Connect() then
-              g_Console_Add(_lc[I_NET_MSG_ERROR] + _lc[I_NET_SLIST_ERROR]);
+          if NetMPeer = nil then g_Net_Slist_Connect();
           g_Net_Slist_Update();
         end
         else