[Game] Refactor: add selectedCards method to GameScene (#6859)

This commit is contained in:
RickyRister 2026-05-09 17:03:48 -07:00 committed by GitHub
parent 7814204fe2
commit 9c53dad4b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 58 deletions

View file

@ -309,19 +309,10 @@ void Player::clearCounters()
void Player::incrementAllCardCounters()
{
QList<CardItem *> cardsToUpdate;
auto selectedItems = getGameScene()->selectedItems();
if (!selectedItems.isEmpty()) {
// If cards are selected, only update those
for (const auto &item : selectedItems) {
auto *card = static_cast<CardItem *>(item);
cardsToUpdate.append(card);
}
} else {
auto cardsToUpdate = getGameScene()->selectedCards();
if (cardsToUpdate.isEmpty()) {
// If no cards selected, update all cards on table
const CardList &tableCards = getTableZone()->getCards();
cardsToUpdate = tableCards;
cardsToUpdate = static_cast<QList<CardItem *>>(getTableZone()->getCards());
}
QList<const ::google::protobuf::Message *> commandList;