Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
ZoneViewZoneLogic Class Reference

#include <view_zone_logic.h>

Inheritance diagram for ZoneViewZoneLogic:
[legend]
Collaboration diagram for ZoneViewZoneLogic:
[legend]

Public Types

enum  CardAction { INITIALIZE , ADD_CARD , REMOVE_CARD }

Signals

void addToViews ()
void removeFromViews ()
void closeView ()
Signals inherited from CardZoneLogic
void cardAdded (CardItem *addedCard)
void cardCountChanged ()
void reorganizeCards ()
void updateGraphics ()
void setGraphicsVisibility (bool visible)
void retranslateUi ()

Public Member Functions

 ZoneViewZoneLogic (Player *_player, CardZoneLogic *_origZone, int _numberCards, bool _revealZone, bool _writeableRevealZone, bool _isReversed, QObject *parent=nullptr)
bool prepareAddCard (int x)
void removeCard (int position, bool toNewZone)
void updateCardIds (CardAction action)
int getNumberCards () const
bool getRevealZone () const
bool getWriteableRevealZone () const
void setWriteableRevealZone (bool _writeableRevealZone)
bool getIsReversed () const
CardZoneLogicgetOriginalZone () const
Public Member Functions inherited from CardZoneLogic
 CardZoneLogic (Player *_player, const QString &_name, bool _hasCardAttr, bool _isShufflable, bool _contentsKnown, QObject *parent=nullptr)
void addCard (CardItem *card, bool reorganize, int x, int y=-1)
CardItemgetCard (int cardId)
void removeCard (CardItem *card)
virtual CardItemtakeCard (int position, int cardId, bool canResize=true)
void rawInsertCard (CardItem *card, int index)
const CardListgetCards () const
void sortCards (const QList< CardList::SortOption > &options)
QString getName () const
QString getTranslatedName (bool theirOwn, GrammaticalCase gc) const
PlayergetPlayer () const
bool contentsKnown () const
QList< ZoneViewZone * > & getViews ()
void setAlwaysRevealTopCard (bool _alwaysRevealTopCard)
bool getAlwaysRevealTopCard () const
bool getHasCardAttr () const
bool getIsShufflable () const
void clearContents ()

Protected Member Functions

void addCardImpl (CardItem *card, int x, int y) override

Private Attributes

CardZoneLogicorigZone
int numberCards
bool revealZone
bool writeableRevealZone
bool isReversed

Additional Inherited Members

Public Slots inherited from CardZoneLogic
void moveAllToZone ()
Protected Attributes inherited from CardZoneLogic
Playerplayer
QString name
CardList cards
QList< ZoneViewZone * > views
bool hasCardAttr
bool isShufflable
bool alwaysRevealTopCard

Member Enumeration Documentation

◆ CardAction

Enumerator
INITIALIZE 
ADD_CARD 
REMOVE_CARD 

Constructor & Destructor Documentation

◆ ZoneViewZoneLogic()

ZoneViewZoneLogic::ZoneViewZoneLogic ( Player * _player,
CardZoneLogic * _origZone,
int _numberCards,
bool _revealZone,
bool _writeableRevealZone,
bool _isReversed,
QObject * parent = nullptr )
Parameters
_playerthe player that the cards are revealed to.
_origZonethe zone the cards were revealed from.
_revealZoneif false, the cards will be face down.
_writeableRevealZonewhether the player can interact with the revealed cards.
Here is the call graph for this function:

Member Function Documentation

◆ addCardImpl()

void ZoneViewZoneLogic::addCardImpl ( CardItem * card,
int x,
int y )
overrideprotectedvirtual

Make sure prepareAddCard() was called before calling addCard(). This method assumes we already checked that the card is being inserted into the visible portion

Implements CardZoneLogic.

Here is the call graph for this function:

◆ addToViews

void ZoneViewZoneLogic::addToViews ( )
signal
Here is the caller graph for this function:

◆ closeView

void ZoneViewZoneLogic::closeView ( )
signal
Here is the caller graph for this function:

◆ getIsReversed()

bool ZoneViewZoneLogic::getIsReversed ( ) const
inline

◆ getNumberCards()

int ZoneViewZoneLogic::getNumberCards ( ) const
inline

◆ getOriginalZone()

CardZoneLogic * ZoneViewZoneLogic::getOriginalZone ( ) const
inline
Here is the call graph for this function:

◆ getRevealZone()

bool ZoneViewZoneLogic::getRevealZone ( ) const
inline

◆ getWriteableRevealZone()

bool ZoneViewZoneLogic::getWriteableRevealZone ( ) const
inline

◆ prepareAddCard()

bool ZoneViewZoneLogic::prepareAddCard ( int x)

Checks if inserting a card at the given position requires an actual new card to be created and added to the view. Also does any cardId updates that would be required if a card is inserted in that position.

Note that this method can end up modifying the cardIds despite returning false. (for example, if the card is inserted into a hidden portion of the deck while the view is reversed)

Make sure to call this method once before calling addCard(), so that you skip creating a new CardItem and calling addCard() if it's not required.

Parameters
xThe position to insert the card at.
Returns
Whether to proceed with calling addCard.
Here is the call graph for this function:

◆ removeCard()

void ZoneViewZoneLogic::removeCard ( int position,
bool toNewZone )
Here is the call graph for this function:

◆ removeFromViews

void ZoneViewZoneLogic::removeFromViews ( )
signal
Here is the caller graph for this function:

◆ setWriteableRevealZone()

void ZoneViewZoneLogic::setWriteableRevealZone ( bool _writeableRevealZone)
Here is the call graph for this function:

◆ updateCardIds()

void ZoneViewZoneLogic::updateCardIds ( CardAction action)
Here is the caller graph for this function:

Member Data Documentation

◆ isReversed

bool ZoneViewZoneLogic::isReversed
private

◆ numberCards

int ZoneViewZoneLogic::numberCards
private

◆ origZone

CardZoneLogic* ZoneViewZoneLogic::origZone
private

◆ revealZone

bool ZoneViewZoneLogic::revealZone
private

◆ writeableRevealZone

bool ZoneViewZoneLogic::writeableRevealZone
private

The documentation for this class was generated from the following files: