mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -08:00
[Refactor] Give graphics zones a card item cache and own card placement (#7427)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
4879ddbd0f
commit
47c90cda10
18 changed files with 111 additions and 74 deletions
|
|
@ -18,13 +18,12 @@ PileZoneLogic::PileZoneLogic(PlayerLogic *_player,
|
|||
|
||||
void PileZoneLogic::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||
{
|
||||
connect(card, &CardItem::sigPixmapUpdated, this, &PileZoneLogic::callUpdate);
|
||||
connect(card->getState(), &CardState::cardPixmapUpdated, this, &PileZoneLogic::callUpdate);
|
||||
// if x is negative set it to add at end
|
||||
if (x < 0 || x >= cards.size()) {
|
||||
x = cards.size();
|
||||
}
|
||||
cards.insert(x, card);
|
||||
card->setPos(0, 0);
|
||||
if (!contentsKnown()) {
|
||||
card->setCardRef({});
|
||||
card->setId(-1);
|
||||
|
|
@ -33,6 +32,5 @@ void PileZoneLogic::addCardImpl(CardItem *card, int x, int /*y*/)
|
|||
cards.at(x + 1)->setCardRef({});
|
||||
}
|
||||
}
|
||||
card->setVisible(false);
|
||||
card->resetState();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue