make games and quests work on gc

This commit is contained in:
Martin Michelsen
2018-11-12 11:06:10 -08:00
parent 89fde4d25f
commit 02d43ce22b
13 changed files with 294 additions and 206 deletions
+8 -2
View File
@@ -22,7 +22,7 @@ Lobby::Lobby() : lobby_id(0), min_level(0), max_level(0xFFFFFFFF),
}
bool Lobby::is_game() const {
return (this->lobby_id < 0);
return this->flags & LobbyFlag::IsGame;
}
void Lobby::reassign_leader_on_client_departure_locked(size_t leaving_client_index) {
@@ -106,7 +106,13 @@ void Lobby::remove_client_locked(shared_ptr<Client> c) {
}
this->clients[c->lobby_client_id] = NULL;
c->lobby_id = 0;
// unassign the client's lobby if it matches the current lobby's id (it may
// not match if the client was already added to another lobby - this can
// happen during the lobby change procedure)
if (c->lobby_id == this->lobby_id) {
c->lobby_id = 0;
}
this->reassign_leader_on_client_departure_locked(c->lobby_client_id);
}