Skip to content

Commit

Permalink
Fix two reconnect bugs
Browse files Browse the repository at this point in the history
Fix two bugs related to the reconnect feature
introduced by commit

3b50b27 "Optional reconnect functionality"

1. Set the password to the stored one

Before, we have done the reconnect attempt with a
cleared password, so using the feature would only
work if you had an empty password.
Thanks to @orwell96 for reporting the bug.

2. Reset the reconnect_requested flag after its use

the_game only writes to the reconect_requested flag
if it sets it to true. It never sets it to false.
If the flag is not reset after its use, all "reset"s
to the main menu will look like the server had
requested a reconnect.
  • Loading branch information
est31 committed Mar 15, 2016
1 parent e0151d1 commit 2607b97
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/client/clientlauncher.cpp
Expand Up @@ -201,6 +201,9 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
bool game_has_run = launch_game(error_message, reconnect_requested,
game_params, cmd_args);

// Reset the reconnect_requested flag
reconnect_requested = false;

// If skip_main_menu, we only want to startup once
if (skip_main_menu && !first_loop)
break;
Expand Down Expand Up @@ -336,6 +339,7 @@ bool ClientLauncher::launch_game(std::string &error_message,
MainMenuData menudata;
menudata.address = address;
menudata.name = playername;
menudata.password = password;
menudata.port = itos(game_params.socket_port);
menudata.script_data.errormessage = error_message;
menudata.script_data.reconnect_requested = reconnect_requested;
Expand Down

0 comments on commit 2607b97

Please sign in to comment.