mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Reorganize method/variable definitions, remove unused ones.
Took 1 hour 8 minutes Took 24 seconds
This commit is contained in:
parent
f75389a52b
commit
9beb8e8245
3 changed files with 53 additions and 62 deletions
|
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, TabGame *_parent)
|
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, TabGame *_parent)
|
||||||
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
||||||
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), dialogSemaphore(false),
|
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
||||||
active(false)
|
dialogSemaphore(false)
|
||||||
{
|
{
|
||||||
initializeZones();
|
initializeZones();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ const int MAX_TOKENS_PER_DIALOG = 99;
|
||||||
class Player : public QObject
|
class Player : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openDeckEditor(const DeckLoader *deck);
|
void openDeckEditor(const DeckLoader *deck);
|
||||||
void newCardAdded(AbstractCardItem *card);
|
void newCardAdded(AbstractCardItem *card);
|
||||||
|
|
@ -74,9 +75,35 @@ public:
|
||||||
~Player() override;
|
~Player() override;
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
[[nodiscard]] PlayerInfo *getPlayerInfo() const
|
void initializeZones();
|
||||||
|
void updateZones();
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
void processPlayerInfo(const ServerInfo_Player &info);
|
||||||
|
void processCardAttachment(const ServerInfo_Player &info);
|
||||||
|
|
||||||
|
void addCard(CardItem *c);
|
||||||
|
void deleteCard(CardItem *c);
|
||||||
|
|
||||||
|
bool clearCardsToDelete();
|
||||||
|
|
||||||
|
bool getActive() const
|
||||||
{
|
{
|
||||||
return playerInfo;
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
TabGame *getGame() const
|
||||||
|
{
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameScene *getGameScene();
|
||||||
|
|
||||||
|
[[nodiscard]] PlayerGraphicsItem *getGraphicsItem();
|
||||||
|
|
||||||
|
[[nodiscard]] PlayerActions *getPlayerActions() const
|
||||||
|
{
|
||||||
|
return playerActions;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] PlayerEventHandler *getPlayerEventHandler() const
|
[[nodiscard]] PlayerEventHandler *getPlayerEventHandler() const
|
||||||
|
|
@ -84,19 +111,14 @@ public:
|
||||||
return playerEventHandler;
|
return playerEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] PlayerActions *getPlayerActions() const
|
[[nodiscard]] PlayerInfo *getPlayerInfo() const
|
||||||
{
|
{
|
||||||
return playerActions;
|
return playerInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
TabGame *getGame() const
|
[[nodiscard]] PlayerMenu *getPlayerMenu() const
|
||||||
{
|
{
|
||||||
return game;
|
return playerMenu;
|
||||||
}
|
|
||||||
|
|
||||||
const QMap<int, ArrowItem *> &getArrows() const
|
|
||||||
{
|
|
||||||
return arrows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> T *addZone(T *zone)
|
template <typename T> T *addZone(T *zone)
|
||||||
|
|
@ -105,16 +127,16 @@ public:
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMap<QString, CardZoneLogic *> &getZones() const
|
|
||||||
{
|
|
||||||
return zones;
|
|
||||||
}
|
|
||||||
|
|
||||||
CardZoneLogic *getZone(const QString zoneName)
|
CardZoneLogic *getZone(const QString zoneName)
|
||||||
{
|
{
|
||||||
return zones.value(zoneName);
|
return zones.value(zoneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QMap<QString, CardZoneLogic *> &getZones() const
|
||||||
|
{
|
||||||
|
return zones;
|
||||||
|
}
|
||||||
|
|
||||||
PileZoneLogic *getDeckZone()
|
PileZoneLogic *getDeckZone()
|
||||||
{
|
{
|
||||||
return qobject_cast<PileZoneLogic *>(zones.value("deck"));
|
return qobject_cast<PileZoneLogic *>(zones.value("deck"));
|
||||||
|
|
@ -150,43 +172,12 @@ public:
|
||||||
return qobject_cast<HandZoneLogic *>(zones.value("hand"));
|
return qobject_cast<HandZoneLogic *>(zones.value("hand"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateZones();
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
void initializeZones();
|
|
||||||
|
|
||||||
bool getActive() const
|
|
||||||
{
|
|
||||||
return active;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] PlayerGraphicsItem *getGraphicsItem();
|
|
||||||
|
|
||||||
GameScene *getGameScene();
|
|
||||||
|
|
||||||
PlayerMenu *getPlayerMenu() const
|
|
||||||
{
|
|
||||||
return playerMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDialogSemaphore(const bool _active)
|
|
||||||
{
|
|
||||||
dialogSemaphore = _active;
|
|
||||||
}
|
|
||||||
|
|
||||||
void processPlayerInfo(const ServerInfo_Player &info);
|
|
||||||
void processCardAttachment(const ServerInfo_Player &info);
|
|
||||||
|
|
||||||
void addCard(CardItem *c);
|
|
||||||
void deleteCard(CardItem *c);
|
|
||||||
|
|
||||||
bool clearCardsToDelete();
|
|
||||||
|
|
||||||
AbstractCounter *addCounter(const ServerInfo_Counter &counter);
|
AbstractCounter *addCounter(const ServerInfo_Counter &counter);
|
||||||
AbstractCounter *addCounter(int counterId, const QString &name, QColor color, int radius, int value);
|
AbstractCounter *addCounter(int counterId, const QString &name, QColor color, int radius, int value);
|
||||||
void delCounter(int counterId);
|
void delCounter(int counterId);
|
||||||
void clearCounters();
|
void clearCounters();
|
||||||
void incrementAllCardCounters();
|
void incrementAllCardCounters();
|
||||||
|
|
||||||
QMap<int, AbstractCounter *> getCounters()
|
QMap<int, AbstractCounter *> getCounters()
|
||||||
{
|
{
|
||||||
return counters;
|
return counters;
|
||||||
|
|
@ -198,8 +189,18 @@ public:
|
||||||
void removeArrow(ArrowItem *arrow);
|
void removeArrow(ArrowItem *arrow);
|
||||||
void clearArrows();
|
void clearArrows();
|
||||||
|
|
||||||
|
const QMap<int, ArrowItem *> &getArrows() const
|
||||||
|
{
|
||||||
|
return arrows;
|
||||||
|
}
|
||||||
|
|
||||||
void setGameStarted();
|
void setGameStarted();
|
||||||
|
|
||||||
|
void setDialogSemaphore(const bool _active)
|
||||||
|
{
|
||||||
|
dialogSemaphore = _active;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabGame *game;
|
TabGame *game;
|
||||||
PlayerInfo *playerInfo;
|
PlayerInfo *playerInfo;
|
||||||
|
|
@ -208,6 +209,8 @@ private:
|
||||||
PlayerMenu *playerMenu;
|
PlayerMenu *playerMenu;
|
||||||
PlayerGraphicsItem *graphicsItem;
|
PlayerGraphicsItem *graphicsItem;
|
||||||
|
|
||||||
|
bool active;
|
||||||
|
|
||||||
QMap<QString, CardZoneLogic *> zones;
|
QMap<QString, CardZoneLogic *> zones;
|
||||||
QMap<int, AbstractCounter *> counters;
|
QMap<int, AbstractCounter *> counters;
|
||||||
QMap<int, ArrowItem *> arrows;
|
QMap<int, ArrowItem *> arrows;
|
||||||
|
|
@ -215,8 +218,6 @@ private:
|
||||||
bool dialogSemaphore;
|
bool dialogSemaphore;
|
||||||
QList<CardItem *> cardsToDelete;
|
QList<CardItem *> cardsToDelete;
|
||||||
|
|
||||||
bool active;
|
|
||||||
|
|
||||||
// void eventConnectionStateChanged(const Event_ConnectionStateChanged &event);
|
// void eventConnectionStateChanged(const Event_ConnectionStateChanged &event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,6 @@ public:
|
||||||
DeckLoader *deck;
|
DeckLoader *deck;
|
||||||
QStringList predefinedTokens;
|
QStringList predefinedTokens;
|
||||||
|
|
||||||
StackZone *stack;
|
|
||||||
TableZone *table;
|
|
||||||
HandZone *hand;
|
|
||||||
PlayerTarget *playerTarget;
|
|
||||||
|
|
||||||
PlayerTarget *getPlayerTarget() const
|
|
||||||
{
|
|
||||||
return playerTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getZoneId() const
|
int getZoneId() const
|
||||||
{
|
{
|
||||||
return zoneId;
|
return zoneId;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue