X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=6db427ff5333ec44191426f5346ee4c32258df1e;hb=d643b3820fbeb5d3c8a731dbdad2785047cb3bb2;hp=8dec027785859377910914d56630c8a05aeeadd9;hpb=5eb97ccbaffc671f05dd73bf0548c1666414017e;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 8dec0277..6db427ff 100644 --- a/src/init.c +++ b/src/init.c @@ -5051,6 +5051,9 @@ void Execute_Command(char *command) { Error(ERR_EXIT_HELP, "unrecognized command '%s'", command); } + + /* disable networking if any valid command was recognized */ + options.network = setup.network_mode = FALSE; } static void InitSetup() @@ -5087,7 +5090,6 @@ static void InitPlayerInfo() } local_player->connected_locally = TRUE; - local_player->connected_network = TRUE; } static void InitArtworkInfo() @@ -5487,6 +5489,8 @@ static void InitLevelInfo() if (leveldir_current == NULL) leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); } + + SetLevelSetInfo(leveldir_current->identifier, level_nr); } static void InitLevelArtworkInfo() @@ -5616,17 +5620,28 @@ void InitNetworkSettings() void InitNetworkServer() { - if (!network.enabled) + if (!network.enabled || network.connected) return; -#if defined(NETWORK_AVALIABLE) + LimitScreenUpdates(FALSE); + if (!ConnectToServer(network.server_host, network.server_port)) - Error(ERR_EXIT, "cannot connect to network game server"); + { + network.enabled = FALSE; - SendToServer_PlayerName(setup.player_name); - SendToServer_ProtocolVersion(); - SendToServer_NrWanted(setup.network_player_nr + 1); -#endif + setup.network_mode = FALSE; + } + else + { + SendToServer_ProtocolVersion(); + SendToServer_PlayerName(setup.player_name); + 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) @@ -6089,6 +6104,8 @@ void OpenAll() return; } + InitNetworkServer(); + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); @@ -6101,8 +6118,6 @@ void OpenAll() DrawMainMenu(); - InitNetworkServer(); - #if 0 Error(ERR_DEBUG, "::: SDL_GetBasePath() == '%s'", SDL_GetBasePath());