implement lobby assignment at login

This commit is contained in:
Martin Michelsen
2026-04-26 09:28:10 -07:00
parent 7f68d41bac
commit 80391df8b7
6 changed files with 77 additions and 26 deletions
+9 -3
View File
@@ -314,7 +314,13 @@ asio::awaitable<void> start_login_server_procedure(shared_ptr<Client> c) {
s->ep3_tournament_index->link_client(c);
}
if (s->welcome_message.empty() ||
if (c->preferred_lobby_id >= 0) {
s->add_client_to_available_lobby(c, true);
if (c->require_lobby()->is_game()) {
c->set_flag(Client::Flag::LOADING);
c->log.info_f("LOADING flag set");
}
} else if (s->welcome_message.empty() ||
c->check_flag(Client::Flag::NO_D6) ||
!c->check_flag(Client::Flag::AT_WELCOME_MESSAGE)) {
c->clear_flag(Client::Flag::AT_WELCOME_MESSAGE);
@@ -2527,7 +2533,7 @@ static asio::awaitable<void> on_10_main_menu(shared_ptr<Client> c, uint32_t item
co_await send_get_player_info(c);
}
if (!c->lobby.lock()) {
s->add_client_to_available_lobby(c);
s->add_client_to_available_lobby(c, false);
}
break;
}
@@ -3093,7 +3099,7 @@ static asio::awaitable<void> on_84(shared_ptr<Client> c, Channel::Message& msg)
// If the client isn't in any lobby, then they just left a game. Add them to the lobby they requested, but fall
// back to another lobby if it's full.
c->preferred_lobby_id = cmd.item_id;
s->add_client_to_available_lobby(c);
s->add_client_to_available_lobby(c, false);
} else {
// If the client already is in a lobby, then they're using the lobby teleporter; add them to the lobby they