Add method to increment all counters on cards on table

This commit is contained in:
Paul Carroll 2025-07-29 14:49:28 -04:00
parent 62c02e3fce
commit 1d20f0391a
2 changed files with 19 additions and 0 deletions

View file

@ -3038,6 +3038,24 @@ void Player::clearCounters()
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)
{
const QMap<int, Player *> &playerList = game->getPlayers();

View file

@ -420,6 +420,7 @@ public:
AbstractCounter *addCounter(int counterId, const QString &name, QColor color, int radius, int value);
void delCounter(int counterId);
void clearCounters();
void incrementAllCardCountersOnTable();
ArrowItem *addArrow(const ServerInfo_Arrow &arrow);
ArrowItem *addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color);