create participant, move code

This commit is contained in:
ebbit1q 2025-09-18 12:02:09 +02:00
parent 74bbef53b2
commit 74b5241544
11 changed files with 1084 additions and 669 deletions

View file

@ -73,7 +73,7 @@ void Server_ProtocolHandler::prepareDestroy()
continue;
}
game->gameMutex.lock();
Server_Player *p = game->getPlayers().value(gameIterator.value().second);
Server_Player *p = game->getPlayer(gameIterator.value().second);
if (!p) {
game->gameMutex.unlock();
room->gamesLock.unlock();
@ -257,8 +257,8 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
}
QMutexLocker gameLocker(&game->gameMutex);
Server_Player *player = game->getPlayers().value(roomIdAndPlayerId.second);
if (!player)
auto *participant = game->getParticipants().value(roomIdAndPlayerId.second);
if (!participant)
return Response::RespNotInRoom;
resetIdleTimer();
@ -289,7 +289,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
}
}
Response::ResponseCode resp = player->processGameCommand(sc, rc, ges);
Response::ResponseCode resp = participant->processGameCommand(sc, rc, ges);
if (resp != Response::RespOk)
finalResponseCode = resp;