mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Add method to increment all counters on cards on table
This commit is contained in:
parent
62c02e3fce
commit
1d20f0391a
2 changed files with 19 additions and 0 deletions
|
|
@ -3038,6 +3038,24 @@ void Player::clearCounters()
|
||||||
counters.clear();
|
counters.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::incrementAllCardCountersOnTable()
|
||||||
|
{
|
||||||
|
// Get all cards on the table
|
||||||
|
const CardList &tableCards = table->getCards();
|
||||||
|
|
||||||
|
for (CardItem *card : tableCards) {
|
||||||
|
// Get all counters on this card
|
||||||
|
const QMap<int, int> &cardCounters = card->getCounters();
|
||||||
|
|
||||||
|
// Increment each existing counter by 1
|
||||||
|
for (auto it = cardCounters.begin(); it != cardCounters.end(); ++it) {
|
||||||
|
int counterId = it.key();
|
||||||
|
int currentValue = it.value();
|
||||||
|
card->setCounter(counterId, currentValue + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArrowItem *Player::addArrow(const ServerInfo_Arrow &arrow)
|
ArrowItem *Player::addArrow(const ServerInfo_Arrow &arrow)
|
||||||
{
|
{
|
||||||
const QMap<int, Player *> &playerList = game->getPlayers();
|
const QMap<int, Player *> &playerList = game->getPlayers();
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,7 @@ public:
|
||||||
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 incrementAllCardCountersOnTable();
|
||||||
|
|
||||||
ArrowItem *addArrow(const ServerInfo_Arrow &arrow);
|
ArrowItem *addArrow(const ServerInfo_Arrow &arrow);
|
||||||
ArrowItem *addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color);
|
ArrowItem *addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue