mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Helper to query deckList for DecklistCardNodes. (#6242)
* Helper to query deckList for DecklistCardNodes. Took 30 minutes Took 6 minutes Took 2 minutes * Fix unused. Took 3 minutes Took 1 minute * Convert string to string list. Took 2 minutes * Adjust to rebase. Took 2 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
f62e29f5d5
commit
ace4063371
11 changed files with 117 additions and 194 deletions
|
|
@ -563,6 +563,29 @@ QList<CardRef> DeckList::getCardRefList() const
|
|||
return result;
|
||||
}
|
||||
|
||||
QList<DecklistCardNode *> DeckList::getCardNodes(const QStringList &restrictToZones) const
|
||||
{
|
||||
QList<DecklistCardNode *> result;
|
||||
|
||||
for (auto *node : *root) {
|
||||
auto *zoneNode = dynamic_cast<InnerDecklistNode *>(node);
|
||||
if (zoneNode == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (!restrictToZones.isEmpty() && !restrictToZones.contains(node->getName())) {
|
||||
continue;
|
||||
}
|
||||
for (auto *cardNode : *zoneNode) {
|
||||
auto *cardCardNode = dynamic_cast<DecklistCardNode *>(cardNode);
|
||||
if (cardCardNode != nullptr) {
|
||||
result.append(cardCardNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int DeckList::getSideboardSize() const
|
||||
{
|
||||
int size = 0;
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ public:
|
|||
}
|
||||
QStringList getCardList() const;
|
||||
QList<CardRef> getCardRefList() const;
|
||||
QList<DecklistCardNode *> getCardNodes(const QStringList &restrictToZones = QStringList()) const;
|
||||
int getSideboardSize() const;
|
||||
InnerDecklistNode *getRoot() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue