mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 18:43:26 -08:00
[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:
parent
5d0d466930
commit
65e9f1b370
33 changed files with 232 additions and 159 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#include "table_zone_logic.h"
|
||||
|
||||
#include "../../game_graphics/board/card_item.h"
|
||||
#include "../board/card_list.h"
|
||||
#include "../board/card_state.h"
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
|
||||
#include <QPoint>
|
||||
|
|
@ -19,7 +19,7 @@ TableZoneLogic::TableZoneLogic(PlayerLogic *_player,
|
|||
{
|
||||
}
|
||||
|
||||
void TableZoneLogic::addCardImpl(CardItem *card, int _x, int _y)
|
||||
void TableZoneLogic::addCardImpl(CardState *card, int _x, int _y)
|
||||
{
|
||||
cards.append(card);
|
||||
if (!card->getFaceDown() && card->getPT().isEmpty()) {
|
||||
|
|
@ -31,9 +31,9 @@ void TableZoneLogic::addCardImpl(CardItem *card, int _x, int _y)
|
|||
card->setGridPoint(QPoint(_x, _y));
|
||||
}
|
||||
|
||||
CardItem *TableZoneLogic::takeCard(int position, int cardId, bool toNewZone)
|
||||
CardState *TableZoneLogic::takeCard(int position, int cardId, bool toNewZone)
|
||||
{
|
||||
CardItem *result = CardZoneLogic::takeCard(position, cardId);
|
||||
CardState *result = CardZoneLogic::takeCard(position, cardId);
|
||||
|
||||
if (toNewZone) {
|
||||
emit contentSizeChanged();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue