mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
Multiple bg images zone (#4005)
This commit is contained in:
parent
964207d04f
commit
b0c7b9078d
6 changed files with 68 additions and 9 deletions
|
|
@ -804,6 +804,25 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
|
|||
gameMenu->insertMenu(playersSeparator, newPlayer->getPlayerMenu());
|
||||
|
||||
players.insert(playerId, newPlayer);
|
||||
|
||||
if (!spectators.contains(playerId)) {
|
||||
|
||||
// Loop for each player, the idea is to have one assigned zone for each non-spectator player
|
||||
for (int i = 1; i <= players.count(); ++i) {
|
||||
bool aPlayerHasThisZone = false;
|
||||
for (auto &player : players) {
|
||||
if (player->getZoneId() == i) {
|
||||
aPlayerHasThisZone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!aPlayerHasThisZone) {
|
||||
newPlayer->setZoneId(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit playerAdded(newPlayer);
|
||||
return newPlayer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue