From: Holger Schemel Date: Tue, 3 Jul 2018 06:44:05 +0000 (+0200) Subject: added clearing network players from main menu screen if server disconnects X-Git-Tag: 4.1.1.0~89 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=882fd29e6ec1e0845a1d9903fc358760b95ab4d2;p=rocksndiamonds.git added clearing network players from main menu screen if server disconnects --- diff --git a/src/network.c b/src/network.c index 6f06d610..e703da0c 100644 --- a/src/network.c +++ b/src/network.c @@ -859,6 +859,9 @@ void HandleNetworking() else { Request(error_message, REQ_CONFIRM); + + if (game_status == GAME_MODE_MAIN) + ClearNetworkPlayers(); } } } diff --git a/src/tools.c b/src/tools.c index b0773082..ec52e93e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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) diff --git a/src/tools.h b/src/tools.h index 61541f37..a5e348a6 100644 --- a/src/tools.h +++ b/src/tools.h @@ -198,6 +198,7 @@ void DrawPreviewLevelInitial(void); void DrawPreviewLevelAnimation(void); void DrawNetworkPlayers(void); +void ClearNetworkPlayers(void); void WaitForEventToContinue(void); boolean Request(char *, unsigned int);