mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-04 12:33:55 -07:00
[Game] Move state fields out of CardItem (#6904)
* [Game] Move state fields out of CardItem Took 1 hour 2 minutes * Move stuff into .cpp Took 14 minutes * Signals pass changed values as params Took 2 minutes * Comments. Took 23 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
021a9f8383
commit
7a5b2e9f0e
5 changed files with 274 additions and 75 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "../zones/card_zone_logic.h"
|
||||
#include "abstract_card_item.h"
|
||||
#include "card_state.h"
|
||||
|
||||
#include <libcockatrice/network/server/remote/game/server_card.h>
|
||||
|
||||
|
|
@ -27,16 +28,10 @@ class CardItem : public AbstractCardItem
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
CardZoneLogic *zone;
|
||||
bool attacking;
|
||||
QMap<int, int> counters;
|
||||
QString annotation;
|
||||
QString pt;
|
||||
bool destroyOnZoneChange;
|
||||
bool doesntUntap;
|
||||
CardState *state;
|
||||
|
||||
QPoint gridPoint;
|
||||
CardDragItem *dragItem;
|
||||
CardItem *attachedTo;
|
||||
QList<CardItem *> attachedCards;
|
||||
|
||||
void prepareDelete();
|
||||
|
|
@ -62,7 +57,7 @@ public:
|
|||
void retranslateUi();
|
||||
[[nodiscard]] CardZoneLogic *getZone() const
|
||||
{
|
||||
return zone;
|
||||
return state->getZone();
|
||||
}
|
||||
void setZone(CardZoneLogic *_zone);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
|
|
@ -88,40 +83,40 @@ public:
|
|||
}
|
||||
[[nodiscard]] bool getAttacking() const
|
||||
{
|
||||
return attacking;
|
||||
return state->getAttacking();
|
||||
}
|
||||
void setAttacking(bool _attacking);
|
||||
[[nodiscard]] const QMap<int, int> &getCounters() const
|
||||
{
|
||||
return counters;
|
||||
return state->getCounters();
|
||||
}
|
||||
void setCounter(int _id, int _value);
|
||||
[[nodiscard]] QString getAnnotation() const
|
||||
{
|
||||
return annotation;
|
||||
return state->getAnnotation();
|
||||
}
|
||||
void setAnnotation(const QString &_annotation);
|
||||
[[nodiscard]] bool getDoesntUntap() const
|
||||
{
|
||||
return doesntUntap;
|
||||
return state->getDoesntUntap();
|
||||
}
|
||||
void setDoesntUntap(bool _doesntUntap);
|
||||
[[nodiscard]] QString getPT() const
|
||||
{
|
||||
return pt;
|
||||
return state->getPT();
|
||||
}
|
||||
void setPT(const QString &_pt);
|
||||
[[nodiscard]] bool getDestroyOnZoneChange() const
|
||||
{
|
||||
return destroyOnZoneChange;
|
||||
return state->getDestroyOnZoneChange();
|
||||
}
|
||||
void setDestroyOnZoneChange(bool _destroy)
|
||||
{
|
||||
destroyOnZoneChange = _destroy;
|
||||
state->setDestroyOnZoneChange(_destroy);
|
||||
}
|
||||
[[nodiscard]] CardItem *getAttachedTo() const
|
||||
{
|
||||
return attachedTo;
|
||||
return state->getAttachedTo();
|
||||
}
|
||||
void setAttachedTo(CardItem *_attachedTo);
|
||||
void addAttachedCard(CardItem *card)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue