Remove isView flag from CardZone (#5728)

* Remove `isView` flag from CardZone

This flag is used for two purposes:

 1. It is used as a check for casting to a zone to a `ZoneViewZone`;

 2. Non-view zones are added to the player's zones on construction

This patch removes the `isView` flag and instead:

 1. We directly cast zones to `ZoneViewZone` using a dynamic (qobject)
    cast and use the result of the cast instead of the `isView` flag to
    detect if we are a view zone or not;

 2. The player records its own zones when they are created, simplifying
    control flow.

* Review
This commit is contained in:
Basile Clement 2025-04-27 01:55:54 +02:00 • committed by GitHub
parent 6fd1e9a4c4
commit 1409dcc2e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 30 additions and 47 deletions

View file

@ -35,7 +35,6 @@ protected:
QAction *doubleClickAction;
bool hasCardAttr;
bool isShufflable;
bool isView;
bool alwaysRevealTopCard;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
@ -65,8 +64,7 @@ public:
bool _hasCardAttr,
bool _isShufflable,
bool _contentsKnown,
QGraphicsItem *parent = nullptr,
bool _isView = false);
QGraphicsItem *parent = nullptr);
void retranslateUi();
void clearContents();
bool getHasCardAttr() const
@ -115,10 +113,6 @@ public:
}
virtual void reorganizeCards() = 0;
virtual QPointF closestGridPoint(const QPointF &point);
bool getIsView() const
{
return isView;
}
bool getAlwaysRevealTopCard() const
{
return alwaysRevealTopCard;