From 270b957618b9e4543ceb584e81402891275b9bce Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Fri, 19 Sep 2025 03:20:39 +0200 Subject: [PATCH] fix regressions --- common/server/game/server_abstract_participant.cpp | 3 ++- common/server/game/server_abstract_participant.h | 2 +- common/server/server_protocolhandler.cpp | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/server/game/server_abstract_participant.cpp b/common/server/game/server_abstract_participant.cpp index 6412ad7ca..9583dcc78 100644 --- a/common/server/game/server_abstract_participant.cpp +++ b/common/server/game/server_abstract_participant.cpp @@ -605,7 +605,8 @@ void Server_AbstractParticipant::setUserInterface(Server_AbstractUserInterface * void Server_AbstractParticipant::disconnectClient() { - if (!(userInfo->user_level() & ServerInfo_User::IsRegistered) || spectator) { + bool IsRegistered = userInfo->user_level() & ServerInfo_User::IsRegistered; + if (!IsRegistered || spectator) { game->removeParticipant(this, Event_Leave::USER_DISCONNECTED); } else { setUserInterface(nullptr); diff --git a/common/server/game/server_abstract_participant.h b/common/server/game/server_abstract_participant.h index 895fd26e7..41017003c 100644 --- a/common/server/game/server_abstract_participant.h +++ b/common/server/game/server_abstract_participant.h @@ -63,7 +63,7 @@ protected: int playerId; bool spectator; bool judge; - void getPlayerProperties(ServerInfo_PlayerProperties &result); + virtual void getPlayerProperties(ServerInfo_PlayerProperties &result); mutable QMutex playerMutex; public: diff --git a/common/server/server_protocolhandler.cpp b/common/server/server_protocolhandler.cpp index b6261a903..c06ee7624 100644 --- a/common/server/server_protocolhandler.cpp +++ b/common/server/server_protocolhandler.cpp @@ -73,14 +73,14 @@ void Server_ProtocolHandler::prepareDestroy() continue; } game->gameMutex.lock(); - Server_Player *p = game->getPlayer(gameIterator.value().second); - if (!p) { + auto *participant = game->getParticipants().value(gameIterator.value().second); + if (!participant) { game->gameMutex.unlock(); room->gamesLock.unlock(); continue; } - p->disconnectClient(); + participant->disconnectClient(); game->gameMutex.unlock(); room->gamesLock.unlock();