fix meet user

This commit is contained in:
Martin Michelsen
2022-07-25 01:32:37 -07:00
parent df80933f40
commit 4c20097de7
7 changed files with 38 additions and 24 deletions
+7 -5
View File
@@ -52,14 +52,16 @@ ServerState::ServerState()
ep3_only_lobbies.end());
}
void ServerState::add_client_to_available_lobby(
shared_ptr<Client> c, shared_ptr<Lobby> preferred_lobby) {
void ServerState::add_client_to_available_lobby(shared_ptr<Client> c) {
shared_ptr<Lobby> added_to_lobby;
if (preferred_lobby) {
if (c->preferred_lobby_id >= 0) {
try {
preferred_lobby->add_client(c);
added_to_lobby = preferred_lobby;
auto l = this->find_lobby(c->preferred_lobby_id);
if (!l->is_game() && (l->flags & Lobby::Flag::PUBLIC)) {
l->add_client(c);
added_to_lobby = l;
}
} catch (const out_of_range&) { }
}