From: Holger Schemel Date: Fri, 22 Jun 2018 19:29:50 +0000 (+0200) Subject: added setting network connection flag for network games X-Git-Tag: 4.1.1.0~102 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ced5b6e12d3dcc3e55bbe1ac858e7e5308cac69c;p=rocksndiamonds.git added setting network connection flag for network games --- diff --git a/src/init.c b/src/init.c index 9c9af0e9..7413cd52 100644 --- a/src/init.c +++ b/src/init.c @@ -5616,7 +5616,7 @@ void InitNetworkSettings() void InitNetworkServer() { - if (!network.enabled) + if (!network.enabled || network.connected) return; if (!ConnectToServer(network.server_host, network.server_port)) @@ -5625,12 +5625,16 @@ void InitNetworkServer() network.enabled = FALSE; + setup.network_mode = FALSE; + return; } SendToServer_PlayerName(setup.player_name); SendToServer_ProtocolVersion(); SendToServer_NrWanted(setup.network_player_nr + 1); + + network.connected = TRUE; } static boolean CheckArtworkConfigForCustomElements(char *filename) diff --git a/src/network.c b/src/network.c index 2bbdf6b1..55e43e12 100644 --- a/src/network.c +++ b/src/network.c @@ -704,9 +704,13 @@ static void HandleNetworkingDisconnect() SDLNet_TCP_DelSocket(rfds, sfd); SDLNet_TCP_Close(sfd); - network.enabled = FALSE; network_playing = FALSE; + network.enabled = FALSE; + network.connected = FALSE; + + setup.network_mode = FALSE; + for (i = 0; i < MAX_PLAYERS; i++) stored_player[i].connected_network = FALSE; }