added clearing network players from main menu screen if server disconnects
[rocksndiamonds.git] / src / tools.c
index b0773082c16981783208ab5c7c815a2b2790ea6e..ec52e93e56816447bdf7d8d31c162c231f47f448 100644 (file)
@@ -3530,9 +3530,12 @@ static void DrawNetworkPlayer(int x, int y, int player_nr, int tile_size,
   DrawText(x + xoffset_text, y + yoffset_text, player_name, font_nr);
 }
 
-void DrawNetworkPlayers()
+void DrawNetworkPlayersExt(boolean force)
 {
-  if (!network.enabled || !network.connected)
+  if (game_status != GAME_MODE_MAIN)
+    return;
+
+  if (!network.connected && !force)
     return;
 
   int num_players = 0;
@@ -3564,7 +3567,8 @@ void DrawNetworkPlayers()
   /* first draw local network player ... */
   for (i = 0; i < MAX_PLAYERS; i++)
   {
-    if (stored_player[i].connected_locally)
+    if (stored_player[i].connected_network &&
+       stored_player[i].connected_locally)
     {
       char *player_name = getNetworkPlayerName(i + 1);
       int player_width = xoffset_text + getTextWidth(player_name, font_nr);
@@ -3593,6 +3597,16 @@ void DrawNetworkPlayers()
   }
 }
 
+void DrawNetworkPlayers()
+{
+  DrawNetworkPlayersExt(FALSE);
+}
+
+void ClearNetworkPlayers()
+{
+  DrawNetworkPlayersExt(TRUE);
+}
+
 inline static void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
                                           int graphic, int sync_frame,
                                           int mask_mode)