mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
[Player] Stop reaching into graphics_item and emit signals instead for conceded and zoneId (#6912)
* [Player] Stop reaching into graphics_item and emit signals instead for conceded and zoneId Took 7 minutes Took 3 seconds * Add sameValue check. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
af2f888293
commit
9f1c225b7a
3 changed files with 7 additions and 3 deletions
|
|
@ -89,7 +89,6 @@ void Player::setConceded(bool _conceded)
|
|||
if (conceded != _conceded) {
|
||||
conceded = _conceded;
|
||||
|
||||
getGraphicsItem()->setVisible(!conceded);
|
||||
if (conceded) {
|
||||
clear();
|
||||
}
|
||||
|
|
@ -99,8 +98,10 @@ void Player::setConceded(bool _conceded)
|
|||
|
||||
void Player::setZoneId(int _zoneId)
|
||||
{
|
||||
zoneId = _zoneId;
|
||||
graphicsItem->getPlayerArea()->setPlayerZoneId(zoneId);
|
||||
if (zoneId != _zoneId) {
|
||||
zoneId = _zoneId;
|
||||
emit zoneIdChanged(zoneId);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::processPlayerInfo(const ServerInfo_Player &info)
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ signals:
|
|||
void newCardAdded(AbstractCardItem *card);
|
||||
void rearrangeCounters();
|
||||
void activeChanged(bool active);
|
||||
void zoneIdChanged(int zoneId);
|
||||
void concededChanged(int playerId, bool conceded);
|
||||
void clearCustomZonesMenu();
|
||||
void addViewCustomZoneActionToCustomZoneMenu(QString zoneName);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
|
|||
connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this,
|
||||
&PlayerGraphicsItem::rearrangeZones);
|
||||
connect(player, &Player::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
|
||||
connect(player, &Player::concededChanged, this, [this](int, bool c) { setVisible(!c); });
|
||||
connect(player, &Player::zoneIdChanged, this, [this](int id) { playerArea->setPlayerZoneId(id); });
|
||||
|
||||
playerArea = new PlayerArea(this);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue