create getZoneNodes method

This commit is contained in:
RickyRister 2025-12-07 19:14:44 -08:00
parent 81a7b87fef
commit ff410c756b
2 changed files with 17 additions and 6 deletions

View file

@ -548,12 +548,9 @@ QList<DecklistCardNode *> DeckList::getCardNodes(const QStringList &restrictToZo
{
QList<DecklistCardNode *> result;
for (auto *node : *root) {
auto *zoneNode = dynamic_cast<InnerDecklistNode *>(node);
if (zoneNode == nullptr) {
continue;
}
if (!restrictToZones.isEmpty() && !restrictToZones.contains(node->getName())) {
auto zoneNodes = getZoneNodes();
for (auto *zoneNode : zoneNodes) {
if (!restrictToZones.isEmpty() && !restrictToZones.contains(zoneNode->getName())) {
continue;
}
for (auto *cardNode : *zoneNode) {
@ -567,6 +564,19 @@ QList<DecklistCardNode *> DeckList::getCardNodes(const QStringList &restrictToZo
return result;
}
QList<InnerDecklistNode *> DeckList::getZoneNodes() const
{
QList<InnerDecklistNode *> zones;
for (auto *node : *root) {
InnerDecklistNode *currentZone = dynamic_cast<InnerDecklistNode *>(node);
if (!currentZone)
continue;
zones.append(currentZone);
}
return zones;
}
int DeckList::getSideboardSize() const
{
int size = 0;

View file

@ -266,6 +266,7 @@ public:
QStringList getCardList() const;
QList<CardRef> getCardRefList() const;
QList<DecklistCardNode *> getCardNodes(const QStringList &restrictToZones = QStringList()) const;
QList<InnerDecklistNode *> getZoneNodes() const;
int getSideboardSize() const;
InnerDecklistNode *getRoot() const
{