[Refactor] Retype card containers and zone logic onto CardState (#7434)

* [Refactor] Retype card containers and zone logic onto CardState

* [Game] Restore attach bookkeeping via CardItem and repaint on state change

* [Refactor] Give custom zones a hidden graphics owner

Custom PileZoneLogic zones had no CardZone, so moving a card into one
left the CardItem drawn at its old spot. Create a hidden PileZone in
onCustomZoneAdded so cards are reparented and hidden.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-31 18:44:14 +01:00 • committed by GitHub
parent 5d0d466930
commit 65e9f1b370
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 232 additions and 159 deletions

View file

@ -1,7 +1,7 @@
#include "pile_zone_logic.h"
#include "../../game_graphics/board/card_item.h"
#include "../board/card_list.h"
#include "../board/card_state.h"
class PlayerLogic;
class QObject;
@ -16,9 +16,9 @@ PileZoneLogic::PileZoneLogic(PlayerLogic *_player,
{
}
void PileZoneLogic::addCardImpl(CardItem *card, int x, int /*y*/)
void PileZoneLogic::addCardImpl(CardState *card, int x, int /*y*/)
{
connect(card->getState(), &CardState::cardPixmapUpdated, this, &PileZoneLogic::callUpdate);
connect(card, &CardState::cardPixmapUpdated, this, &PileZoneLogic::callUpdate);
// if x is negative set it to add at end
if (x < 0 || x >= cards.size()) {
x = cards.size();
@ -32,5 +32,5 @@ void PileZoneLogic::addCardImpl(CardItem *card, int x, int /*y*/)
cards.at(x + 1)->setCardRef({});
}
}
card->resetState();
card->resetState(false);
}