mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-04 04:23:55 -07:00
[DeckListModel] Refactor: Don't access underlying decklist for iteration (#6427)
* [DeckListModel] Refactor: Don't access underlying decklist for iteration * add docs * extract method
This commit is contained in:
parent
715ee1d6fe
commit
367507e054
7 changed files with 73 additions and 100 deletions
|
|
@ -306,19 +306,12 @@ int CardAmountWidget::countCardsInZone(const QString &deckZone)
|
|||
return -1;
|
||||
}
|
||||
|
||||
DeckList *decklist = deckModel->getDeckList();
|
||||
if (!decklist) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
QList<const DecklistCardNode *> cardsInDeck = decklist->getCardNodes({deckZone});
|
||||
QList<ExactCard> cards = deckModel->getCardsForZone(deckZone);
|
||||
|
||||
int count = 0;
|
||||
for (auto currentCard : cardsInDeck) {
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
if (currentCard->getCardProviderId() == rootCard.getPrinting().getProperty("uuid")) {
|
||||
count++;
|
||||
}
|
||||
for (auto currentCard : cards) {
|
||||
if (currentCard.getPrinting().getUuid() == rootCard.getPrinting().getProperty("uuid")) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue