diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index 4a83a9ae0..890080d63 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -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 &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 &playerList = game->getPlayers(); diff --git a/cockatrice/src/game/player/player.h b/cockatrice/src/game/player/player.h index 9062ac5b4..2445182b5 100644 --- a/cockatrice/src/game/player/player.h +++ b/cockatrice/src/game/player/player.h @@ -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);