From ef9a87bf36f43a182216f86cc947c1e0a94d9de3 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 11 Jun 2018 13:03:37 +1100 Subject: [PATCH] Fixed MP admins being unable to observe private games (fixes #2851) This was due to the change in the MP initialization process wherein the lobby wouldn't show up until the initial gamelist was received. Since the admin auth message is sent after [join_game] and before the initial gamelist, and the chatbox widget handled parsing the auth message, the client was never marked as authenticated and therefor couldn't observe private games. This fixes that by adding auth parsing to the MP initialization process. Note this doesn't fix the issue of the auth confirmation not showing up in the lobby chat (issue #2920). I'll have to think of a way to fix that separately. --- changelog.md | 1 + src/game_initialization/multiplayer.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/changelog.md b/changelog.md index 18aeba519f41..dad417b786aa 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ * New attack animation for the Peasant. ### Miscellaneous and bug fixes * Added an advanced preference to enable experimental PRNG combat. + * Fixed MP admins being unable to observe private games. ## Version 1.14.3 ### AI diff --git a/src/game_initialization/multiplayer.cpp b/src/game_initialization/multiplayer.cpp index 5880773bad5c..f6301a83fbc3 100644 --- a/src/game_initialization/multiplayer.cpp +++ b/src/game_initialization/multiplayer.cpp @@ -176,6 +176,12 @@ std::pair open_connection(std::string host) throw wesnothd_rejected_client_error(error_message); } + // The only message we should get here is the admin authentication message. + // It's sent after [join_lobby] and before the initial gamelist. + if(const config& message = data.child("message")) { + preferences::parse_admin_authentication(message["sender"], message["message"]); + } + // Continue if we did not get a direction to login if(!data.has_child("mustlogin")) { continue;