Skip to content

Commit

Permalink
Process initial lobby config while still at the loading screen
Browse files Browse the repository at this point in the history
It's only intended to be used once, so no need to keep it around. Additionally, regardless of whether it's
processed here or in run_lobby_loop, it's no more up-to-date than at the point it was fetched.
  • Loading branch information
Vultraz committed Dec 6, 2020
1 parent b3964c1 commit f875d80
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/game_initialization/multiplayer.cpp
Expand Up @@ -399,12 +399,17 @@ class mp_manager
: game_config(&game_config_manager::get()->game_config())
, state(state)
, connection(nullptr)
, lobby_config()
, lobby_info(::installed_addons())
{
if(!host.empty()) {
gui2::dialogs::loading_screen::display([&]() {
config lobby_config;
std::tie(connection, lobby_config) = open_connection(host);

// Seed initial data
if(!lobby_config.empty()) {
lobby_info.process_gamelist(lobby_config);
}
});
}
}
Expand All @@ -422,11 +427,6 @@ class mp_manager
return;
}

// Seed initial data
if(!lobby_config.empty()) {
lobby_info.process_gamelist(lobby_config);
}

// A return of false means a config reload was requested, so do that and then loop.
while(!enter_lobby_mode()) {
game_config_manager* gcm = game_config_manager::get();
Expand Down Expand Up @@ -461,8 +461,6 @@ class mp_manager

std::unique_ptr<wesnothd_connection> connection;

config lobby_config;

mp::lobby_info lobby_info;
};

Expand Down

0 comments on commit f875d80

Please sign in to comment.