mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
Move stuff into .cpp
Took 14 minutes
This commit is contained in:
parent
db72f56473
commit
d757cb9124
2 changed files with 124 additions and 99 deletions
|
|
@ -1 +1,111 @@
|
||||||
#include "card_state.h"
|
#include "card_state.h"
|
||||||
|
|
||||||
|
void CardState::resetState(bool keepAnnotations)
|
||||||
|
{
|
||||||
|
attacking = false;
|
||||||
|
counters.clear();
|
||||||
|
pt.clear();
|
||||||
|
if (!keepAnnotations) {
|
||||||
|
annotation.clear();
|
||||||
|
}
|
||||||
|
attachedTo = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setZone(CardZoneLogic *_zone)
|
||||||
|
{
|
||||||
|
if (zone == _zone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
zone = _zone;
|
||||||
|
emit zoneChanged(zone);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAttacking(bool v)
|
||||||
|
{
|
||||||
|
if (attacking == v) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
attacking = v;
|
||||||
|
emit attackingChanged(v);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::insertCounter(int id, int value)
|
||||||
|
{
|
||||||
|
counters.insert(id, value);
|
||||||
|
|
||||||
|
emit countersChanged();
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setCounter(int id, int value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
counters[id] = value;
|
||||||
|
} else {
|
||||||
|
counters.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit countersChanged();
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::clearCounters()
|
||||||
|
{
|
||||||
|
counters.clear();
|
||||||
|
emit countersChanged();
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAnnotation(const QString &a)
|
||||||
|
{
|
||||||
|
if (annotation == a) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
annotation = a;
|
||||||
|
emit annotationChanged();
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setPT(const QString &v)
|
||||||
|
{
|
||||||
|
if (pt == v) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pt = v;
|
||||||
|
emit ptChanged();
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setDoesntUntap(bool v)
|
||||||
|
{
|
||||||
|
if (doesntUntap == v) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
doesntUntap = v;
|
||||||
|
emit doesntUntapChanged(v);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setDestroyOnZoneChange(bool v)
|
||||||
|
{
|
||||||
|
if (destroyOnZoneChange == v) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
destroyOnZoneChange = v;
|
||||||
|
emit destroyOnZoneChangeChanged(v);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardState::setAttachedTo(CardItem *c)
|
||||||
|
{
|
||||||
|
if (attachedTo == c) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
attachedTo = c;
|
||||||
|
emit attachedToChanged(c);
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
@ -38,151 +38,66 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetState(bool keepAnnotations)
|
void resetState(bool keepAnnotations);
|
||||||
{
|
|
||||||
attacking = false;
|
|
||||||
counters.clear();
|
|
||||||
pt.clear();
|
|
||||||
if (!keepAnnotations) {
|
|
||||||
annotation.clear();
|
|
||||||
}
|
|
||||||
attachedTo = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CardZoneLogic *getZone() const
|
CardZoneLogic *getZone() const
|
||||||
{
|
{
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setZone(CardZoneLogic *_zone)
|
void setZone(CardZoneLogic *_zone);
|
||||||
{
|
|
||||||
if (zone == _zone) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
zone = _zone;
|
|
||||||
emit zoneChanged(zone);
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getAttacking() const
|
bool getAttacking() const
|
||||||
{
|
{
|
||||||
return attacking;
|
return attacking;
|
||||||
}
|
}
|
||||||
void setAttacking(bool v)
|
void setAttacking(bool v);
|
||||||
{
|
|
||||||
if (attacking == v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
attacking = v;
|
|
||||||
emit attackingChanged(v);
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QMap<int, int> &getCounters() const
|
const QMap<int, int> &getCounters() const
|
||||||
{
|
{
|
||||||
return counters;
|
return counters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertCounter(int id, int value)
|
void insertCounter(int id, int value);
|
||||||
{
|
|
||||||
counters.insert(id, value);
|
|
||||||
|
|
||||||
emit countersChanged();
|
void setCounter(int id, int value);
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCounter(int id, int value)
|
void clearCounters();
|
||||||
{
|
|
||||||
if (value) {
|
|
||||||
counters[id] = value;
|
|
||||||
} else {
|
|
||||||
counters.remove(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit countersChanged();
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearCounters()
|
|
||||||
{
|
|
||||||
counters.clear();
|
|
||||||
emit countersChanged();
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getAnnotation() const
|
QString getAnnotation() const
|
||||||
{
|
{
|
||||||
return annotation;
|
return annotation;
|
||||||
}
|
}
|
||||||
void setAnnotation(const QString &a)
|
|
||||||
{
|
void setAnnotation(const QString &a);
|
||||||
if (annotation == a) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
annotation = a;
|
|
||||||
emit annotationChanged();
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getPT() const
|
QString getPT() const
|
||||||
{
|
{
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
void setPT(const QString &v)
|
|
||||||
{
|
void setPT(const QString &v);
|
||||||
if (pt == v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pt = v;
|
|
||||||
emit ptChanged();
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getDoesntUntap() const
|
bool getDoesntUntap() const
|
||||||
{
|
{
|
||||||
return doesntUntap;
|
return doesntUntap;
|
||||||
}
|
}
|
||||||
void setDoesntUntap(bool v)
|
|
||||||
{
|
void setDoesntUntap(bool v);
|
||||||
if (doesntUntap == v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
doesntUntap = v;
|
|
||||||
emit doesntUntapChanged(v);
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getDestroyOnZoneChange() const
|
bool getDestroyOnZoneChange() const
|
||||||
{
|
{
|
||||||
return destroyOnZoneChange;
|
return destroyOnZoneChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDestroyOnZoneChange(bool v)
|
void setDestroyOnZoneChange(bool v);
|
||||||
{
|
|
||||||
if (destroyOnZoneChange == v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
destroyOnZoneChange = v;
|
|
||||||
emit destroyOnZoneChangeChanged(v);
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
CardItem *getAttachedTo() const
|
CardItem *getAttachedTo() const
|
||||||
{
|
{
|
||||||
return attachedTo;
|
return attachedTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAttachedTo(CardItem *c)
|
void setAttachedTo(CardItem *c);
|
||||||
{
|
|
||||||
if (attachedTo == c) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
attachedTo = c;
|
|
||||||
emit attachedToChanged(c);
|
|
||||||
emit stateChanged();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COCKATRICE_CARD_STATE_H
|
#endif // COCKATRICE_CARD_STATE_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue