mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 07:22:16 -07:00
Player holds the deck, emits deckChanged(), other elements player->getDeck() to respond to changes.
Took 37 minutes
This commit is contained in:
parent
57aa1abc69
commit
c344b40a71
8 changed files with 61 additions and 41 deletions
|
|
@ -32,7 +32,7 @@
|
|||
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, TabGame *_parent)
|
||||
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
||||
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
||||
dialogSemaphore(false)
|
||||
deck(nullptr), dialogSemaphore(false)
|
||||
{
|
||||
initializeZones();
|
||||
|
||||
|
|
@ -40,6 +40,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
playerMenu = new PlayerMenu(this);
|
||||
|
||||
connect(this, &Player::activeChanged, graphicsItem, &PlayerGraphicsItem::onPlayerActiveChanged);
|
||||
|
||||
connect(this, &Player::deckChanged, playerMenu, &PlayerMenu::enableOpenInDeckEditorAction);
|
||||
connect(this, &Player::deckChanged, playerMenu, &PlayerMenu::populatePredefinedTokensMenu);
|
||||
}
|
||||
|
||||
void Player::initializeZones()
|
||||
|
|
@ -240,6 +243,13 @@ void Player::deleteCard(CardItem *card)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::setDeck(const DeckLoader &_deck)
|
||||
{
|
||||
deck = new DeckLoader(_deck);
|
||||
|
||||
emit deckChanged();
|
||||
}
|
||||
|
||||
AbstractCounter *Player::addCounter(const ServerInfo_Counter &counter)
|
||||
{
|
||||
return addCounter(counter.id(), QString::fromStdString(counter.name()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue