mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -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;
|
QList<DecklistCardNode *> result;
|
||||||
|
|
||||||
for (auto *node : *root) {
|
auto zoneNodes = getZoneNodes();
|
||||||
auto *zoneNode = dynamic_cast<InnerDecklistNode *>(node);
|
for (auto *zoneNode : zoneNodes) {
|
||||||
if (zoneNode == nullptr) {
|
if (!restrictToZones.isEmpty() && !restrictToZones.contains(zoneNode->getName())) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!restrictToZones.isEmpty() && !restrictToZones.contains(node->getName())) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (auto *cardNode : *zoneNode) {
|
for (auto *cardNode : *zoneNode) {
|
||||||
|
|
@ -567,6 +564,19 @@ QList<DecklistCardNode *> DeckList::getCardNodes(const QStringList &restrictToZo
|
||||||
return result;
|
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 DeckList::getSideboardSize() const
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,7 @@ public:
|
||||||
QStringList getCardList() const;
|
QStringList getCardList() const;
|
||||||
QList<CardRef> getCardRefList() const;
|
QList<CardRef> getCardRefList() const;
|
||||||
QList<DecklistCardNode *> getCardNodes(const QStringList &restrictToZones = QStringList()) const;
|
QList<DecklistCardNode *> getCardNodes(const QStringList &restrictToZones = QStringList()) const;
|
||||||
|
QList<InnerDecklistNode *> getZoneNodes() const;
|
||||||
int getSideboardSize() const;
|
int getSideboardSize() const;
|
||||||
InnerDecklistNode *getRoot() const
|
InnerDecklistNode *getRoot() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue