Process initial lobby config while still at the loading screen

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.
This commit is contained in:
Charles Dang 2020-12-07 03:09:47 +11:00
parent b3964c1e5f
commit f875d80de4

View file

@ -399,12 +399,17 @@ public:
: 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);
}
});
}
}
@ -422,11 +427,6 @@ public:
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();
@ -461,8 +461,6 @@ private:
std::unique_ptr<wesnothd_connection> connection;
config lobby_config;
mp::lobby_info lobby_info;
};