fix: don't show conceded players, fix: compute multicolumn layout correctly when dealing with odd number of players
This commit is contained in:
parent
b001421cfe
commit
3ed26e11ae
4 changed files with 10 additions and 7 deletions
|
@ -64,7 +64,6 @@ void GameScene::rearrange()
|
|||
const int playersCount = playersPlaying.size();
|
||||
const int columns = playersCount < settingsCache->getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||
const int rows = ceil((qreal) playersCount / columns);
|
||||
|
||||
qreal sceneHeight = 0, sceneWidth = -playerAreaSpacing;
|
||||
QList<int> columnWidth;
|
||||
int firstPlayerOfColumn = firstPlayer;
|
||||
|
@ -72,7 +71,7 @@ void GameScene::rearrange()
|
|||
playersByColumn.append(QList<Player *>());
|
||||
columnWidth.append(0);
|
||||
qreal thisColumnHeight = -playerAreaSpacing;
|
||||
const int rowsInColumn = rows - (playersCount % columns);
|
||||
const int rowsInColumn = rows - (playersCount % columns) * col; // only correct for max. 2 cols
|
||||
for (int j = 0; j < rowsInColumn; ++j) {
|
||||
Player *player = playersPlaying[(firstPlayerOfColumn + j) % playersCount];
|
||||
if (col == 0)
|
||||
|
|
|
@ -1123,6 +1123,8 @@ void Player::processPlayerInfo(ServerInfo_Player *info)
|
|||
QList<ServerInfo_Arrow *> al = info->getArrowList();
|
||||
for (int i = 0; i < al.size(); ++i)
|
||||
addArrow(al.at(i));
|
||||
|
||||
setConceded(info->getProperties()->getConceded());
|
||||
}
|
||||
|
||||
void Player::processCardAttachment(ServerInfo_Player *info)
|
||||
|
|
|
@ -88,6 +88,8 @@ void PlayerListWidget::updatePlayerProperties(ServerInfo_PlayerProperties *prop)
|
|||
|
||||
player->setIcon(1, prop->getSpectator() ? spectatorIcon : playerIcon);
|
||||
player->setData(1, Qt::UserRole, !prop->getSpectator());
|
||||
player->setData(2, Qt::UserRole, prop->getConceded());
|
||||
player->setData(2, Qt::UserRole + 1, prop->getReadyStart());
|
||||
player->setIcon(2, gameStarted ? (prop->getConceded() ? concededIcon : QIcon()) : (prop->getReadyStart() ? readyIcon : notReadyIcon));
|
||||
player->setData(3, Qt::UserRole, prop->getUserInfo()->getUserLevel());
|
||||
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, prop->getUserInfo()->getUserLevel())));
|
||||
|
@ -141,7 +143,7 @@ void PlayerListWidget::setGameStarted(bool _gameStarted)
|
|||
QMapIterator<int, QTreeWidgetItem *> i(players);
|
||||
while (i.hasNext()) {
|
||||
QTreeWidgetItem *twi = i.next().value();
|
||||
twi->setIcon(2, gameStarted ? QIcon() : notReadyIcon);
|
||||
twi->setIcon(2, gameStarted ? (twi->data(2, Qt::UserRole).toBool() ? concededIcon : QIcon()) : (twi->data(2, Qt::UserRole + 1).toBool() ? readyIcon : notReadyIcon));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -498,10 +498,6 @@ void TabGame::startGame()
|
|||
}
|
||||
mainLayout->removeItem(deckViewContainerLayout);
|
||||
|
||||
QMapIterator<int, Player *> playerIterator(players);
|
||||
while (playerIterator.hasNext())
|
||||
playerIterator.next().value()->setConceded(false);
|
||||
|
||||
playerListWidget->setGameStarted(true);
|
||||
started = true;
|
||||
static_cast<GameScene *>(gameView->scene())->rearrange();
|
||||
|
@ -514,6 +510,10 @@ void TabGame::stopGame()
|
|||
currentPhase = -1;
|
||||
activePlayer = -1;
|
||||
|
||||
QMapIterator<int, Player *> playerIterator(players);
|
||||
while (playerIterator.hasNext())
|
||||
playerIterator.next().value()->setConceded(false);
|
||||
|
||||
QMapIterator<int, DeckViewContainer *> i(deckViewContainers);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
|
Loading…
Reference in a new issue