Multiple bg images zone (#4005)

This commit is contained in:
fdipilla 2020-08-23 16:55:53 -03:00 committed by GitHub
parent 964207d04f
commit b0c7b9078d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 9 deletions

View file

@ -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;
}