mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-28 05:33:46 -08:00
nextTurn cleanup -> fixed the bug that the game would begin with active player 0 even if there is no player 0
This commit is contained in:
@@ -952,18 +952,7 @@ ResponseCode Server_ProtocolHandler::cmdNextTurn(Command_NextTurn * /*cmd*/, Com
|
||||
if (!game->getGameStarted())
|
||||
return RespGameNotStarted;
|
||||
|
||||
const QMap<int, Server_Player *> &players = game->getPlayers();
|
||||
const QList<int> keys = players.keys();
|
||||
|
||||
int activePlayer = game->getActivePlayer();
|
||||
int listPos = keys.indexOf(activePlayer);
|
||||
do {
|
||||
++listPos;
|
||||
if (listPos == keys.size())
|
||||
listPos = 0;
|
||||
} while (players.value(keys[listPos])->getSpectator());
|
||||
|
||||
game->setActivePlayer(keys[listPos]);
|
||||
game->nextTurn();
|
||||
return RespOk;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user