mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Merge branch 'master' of ssh://cockatrice.de/home/cockgit/cockatrice
Conflicts: common/server_game.cpp
This commit is contained in:
commit
135fed79ca
3 changed files with 19 additions and 13 deletions
|
|
@ -138,7 +138,8 @@ void Server_Game::startGameIfReady()
|
|||
query.exec();
|
||||
}
|
||||
*/
|
||||
setActivePlayer(players.keys().first());
|
||||
activePlayer = -1;
|
||||
nextTurn();
|
||||
}
|
||||
|
||||
void Server_Game::stopGameIfFinished()
|
||||
|
|
@ -254,6 +255,21 @@ void Server_Game::setActivePhase(int _activePhase)
|
|||
sendGameEvent(new Event_SetActivePhase(-1, activePhase));
|
||||
}
|
||||
|
||||
void Server_Game::nextTurn()
|
||||
{
|
||||
const QList<int> keys = players.keys();
|
||||
int listPos = -1;
|
||||
if (activePlayer != -1)
|
||||
listPos = keys.indexOf(activePlayer);
|
||||
do {
|
||||
++listPos;
|
||||
if (listPos == keys.size())
|
||||
listPos = 0;
|
||||
} while (players.value(keys[listPos])->getSpectator());
|
||||
|
||||
setActivePlayer(keys[listPos]);
|
||||
}
|
||||
|
||||
QList<ServerInfo_Player *> Server_Game::getGameState(Server_Player *playerWhosAsking) const
|
||||
{
|
||||
QList<ServerInfo_Player *> result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue