mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-15 06:52:15 -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();
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue