mp: Reset authentication flag after disconnecting

Otherwise it's possible to join once as moderator so that the MP mod
options are enabled, disconnect, reconnect again as non-moderator, and
still see the MP mod options enabled.

Yay for ugly hacks.
This commit is contained in:
Ignacio R. Morelle 2015-06-01 23:39:27 -03:00
parent 68980114dc
commit a50252907a
3 changed files with 18 additions and 0 deletions

View file

@ -184,6 +184,11 @@ void parse_admin_authentication(const std::string& sender, const std::string& me
}
}
admin_authentication_reset::~admin_authentication_reset()
{
authenticated = false;
}
static void load_acquaintances() {
if(!acquaintances_initialized) {
acquaintances.clear();

View file

@ -41,6 +41,17 @@ class acquaintance;
bool is_authenticated();
void parse_admin_authentication(const std::string& sender, const std::string& message);
/**
* Used to reset is_authenticated flag after disconnecting.
*
* @todo FIXME: is_authenticated shouldn't be a preferences function. Also,
* the name is misleading.
*/
struct admin_authentication_reset
{
~admin_authentication_reset();
};
bool parse_should_show_lobby_join(const std::string& sender, const std::string& message);
int lobby_joins();
void _set_lobby_joins(int show);

View file

@ -880,6 +880,8 @@ void start_client(game_display& disp, const config& game_config,
game_state& state, const std::string& host)
{
DBG_MP << "starting client" << std::endl;
preferences::admin_authentication_reset r;
const network::manager net_manager(1,1);
gamechat.clear_history();