make high client ID assignment optional

This commit is contained in:
Martin Michelsen
2022-05-29 12:43:57 -07:00
parent c9cdb21a8b
commit 78bb791c26
5 changed files with 12 additions and 4 deletions
+3 -3
View File
@@ -57,9 +57,9 @@ size_t Lobby::count_clients() const {
return ret;
}
void Lobby::add_client(shared_ptr<Client> c, bool reverse_indexes) {
void Lobby::add_client(shared_ptr<Client> c) {
ssize_t index;
if (reverse_indexes) {
if (c->prefer_high_lobby_client_id) {
for (index = max_clients - 1; index >= 0; index--) {
if (!this->clients[index].get()) {
this->clients[index] = c;
@@ -85,7 +85,7 @@ void Lobby::add_client(shared_ptr<Client> c, bool reverse_indexes) {
c->lobby_id = this->lobby_id;
// If there's no one else in the lobby, set the leader id as well
if (index == (max_clients - 1) * reverse_indexes) {
if (index == (max_clients - 1) * c->prefer_high_lobby_client_id) {
for (index = 0; index < max_clients; index++) {
if (this->clients[index].get() && this->clients[index] != c) {
break;