X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=1d3085c5c4b9bb47c0fe5f191ea3664b29fd8f7c;hb=5ef9148d1f605af02e872264519eda261a3e88ca;hp=ffb825943520cec7a3ddf10f7b3b21622e62527f;hpb=534881ab3184952023d05c6aa739bc7fcf8da82a;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index ffb82594..1d3085c5 100644 --- a/src/init.c +++ b/src/init.c @@ -5087,7 +5087,6 @@ static void InitPlayerInfo() } local_player->connected_locally = TRUE; - local_player->connected_network = TRUE; } static void InitArtworkInfo() @@ -5616,15 +5615,28 @@ void InitNetworkSettings() void InitNetworkServer() { - if (!network.enabled) + if (!network.enabled || network.connected) return; + LimitScreenUpdates(FALSE); + if (!ConnectToServer(network.server_host, network.server_port)) - Error(ERR_EXIT, "cannot connect to network game server"); + { + network.enabled = FALSE; + + setup.network_mode = FALSE; + } + else + { + SendToServer_PlayerName(setup.player_name); + SendToServer_ProtocolVersion(); + SendToServer_NrWanted(setup.network_player_nr + 1); - SendToServer_PlayerName(setup.player_name); - SendToServer_ProtocolVersion(); - SendToServer_NrWanted(setup.network_player_nr + 1); + network.connected = TRUE; + } + + /* short time to recognize result of network initialization */ + Delay_WithScreenUpdates(1000); } static boolean CheckArtworkConfigForCustomElements(char *filename) @@ -6087,6 +6099,8 @@ void OpenAll() return; } + InitNetworkServer(); + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); @@ -6099,8 +6113,6 @@ void OpenAll() DrawMainMenu(); - InitNetworkServer(); - #if 0 Error(ERR_DEBUG, "::: SDL_GetBasePath() == '%s'", SDL_GetBasePath());