mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
create getZoneNodes method
This commit is contained in:
parent
81a7b87fef
commit
ff410c756b
2 changed files with 17 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue