-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add player numbers to in game #2435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why the count isn't correct - the code looks right to me. I'd have to dig deeper. If I have time later tonight I'll clone the branch and try it out locally.
Also your editor is configured for tabs - please recheck all files for tabs->spaces
cockatrice/src/tab_game.cpp
Outdated
} | ||
playerListWidget->addPlayer(playerInfo); | ||
|
||
qDebug() << "eventJoin retranslate w/ count = " << playerCountInRoom; | ||
retranslateUi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think emitUserEvent
causes a retranslateUi to fire already - can you check?
cockatrice/src/tab_game.cpp
Outdated
@@ -420,6 +421,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client | |||
|
|||
this->installEventFilter(this); | |||
QTimer::singleShot(0, this, SLOT(loadLayout())); | |||
|
|||
playerCountInRoom = gameInfo.player_count(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs => spaces
cockatrice/src/tab_game.cpp
Outdated
|
||
cardInfoDock->setWindowTitle(tr("Card Info") + (cardInfoDock->isWindow() ? tabText : QString())); | ||
playerListDock->setWindowTitle(tr("Player List") + (playerListDock->isWindow() ? tabText : QString())); | ||
playerListDock->setWindowTitle(tr("Player List") + userCountInfo + (playerListDock->isWindow() ? tabText : QString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the number of players from the PlayerListWidget, just adding a method like:
int PlayerListWidget::getPlayersCount() { return players.size(); }
@ctrlaltca Can you take over this PR? I'm not sure how to get it to work properly as nothing I've done suffices to get the correct data. |
Please look https://github.com/ZeldaZach/Cockatrice/pull/3 |
This works as expected now. Thanks @ctrlaltca. Care to explain why your method works? |
The TabGame object already takes care of maintaining a list of the actual players and spectators. I just get the information from it when needed, instead of maintaining another counter and handling all the exceptions. |
Working now. It also just counts real players, no spectators! 👍 |
Fix #2417