mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-10 04:16:43 -07:00
Refactor: Represent cardName + providerId with CardRef struct (#6039)
* card_ref.h * update CardDatabase signatures * make everything compile * rename methods * add docs * mark stuff const * set cardRef in CardItem * cleanup * fix build failure * Fix builds on mac --------- Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
parent
e05dad4267
commit
a9b3be33e0
61 changed files with 328 additions and 305 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "../cards/card_info.h"
|
||||
#include "arrow_target.h"
|
||||
#include "card_ref.h"
|
||||
|
||||
class Player;
|
||||
|
||||
|
|
@ -15,8 +16,7 @@ class AbstractCardItem : public ArrowTarget
|
|||
protected:
|
||||
CardInfoPtr info;
|
||||
int id;
|
||||
QString name;
|
||||
QString providerId;
|
||||
CardRef cardRef;
|
||||
bool tapped;
|
||||
bool facedown;
|
||||
int tapAngle;
|
||||
|
|
@ -34,7 +34,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void hovered(AbstractCardItem *card);
|
||||
void showCardInfoPopup(const QPoint &pos, const QString &cardName, const QString &providerId);
|
||||
void showCardInfoPopup(const QPoint &pos, const CardRef &cardRef);
|
||||
void deleteCardInfoPopup(QString cardName);
|
||||
void sigPixmapUpdated();
|
||||
void cardShiftClicked(QString cardName);
|
||||
|
|
@ -49,8 +49,7 @@ public:
|
|||
return Type;
|
||||
}
|
||||
explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
|
||||
const QString &_name = QString(),
|
||||
const QString &_providerId = QString(),
|
||||
const CardRef &cardRef = {},
|
||||
Player *_owner = nullptr,
|
||||
int _id = -1);
|
||||
~AbstractCardItem() override;
|
||||
|
|
@ -73,14 +72,17 @@ public:
|
|||
}
|
||||
QString getName() const
|
||||
{
|
||||
return name;
|
||||
return cardRef.name;
|
||||
}
|
||||
void setName(const QString &_name = QString());
|
||||
QString getProviderId() const
|
||||
{
|
||||
return providerId;
|
||||
return cardRef.providerId;
|
||||
}
|
||||
void setCardRef(const CardRef &_cardRef);
|
||||
CardRef getCardRef() const
|
||||
{
|
||||
return cardRef;
|
||||
}
|
||||
void setProviderId(const QString &_providerId = QString());
|
||||
qreal getRealZValue() const
|
||||
{
|
||||
return realZValue;
|
||||
|
|
@ -105,7 +107,7 @@ public:
|
|||
void processHoverEvent();
|
||||
void deleteCardInfoPopup()
|
||||
{
|
||||
emit deleteCardInfoPopup(name);
|
||||
emit deleteCardInfoPopup(cardRef.name);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue