mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
remove helpers
This commit is contained in:
parent
2b690f8c87
commit
81a7b87fef
2 changed files with 11 additions and 32 deletions
|
|
@ -523,43 +523,24 @@ void DeckList::cleanList(bool preserveMetadata)
|
||||||
refreshDeckHash();
|
refreshDeckHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckList::getCardListHelper(InnerDecklistNode *item, QSet<QString> &result)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < item->size(); ++i) {
|
|
||||||
auto *node = dynamic_cast<DecklistCardNode *>(item->at(i));
|
|
||||||
|
|
||||||
if (node) {
|
|
||||||
result.insert(node->getName());
|
|
||||||
} else {
|
|
||||||
getCardListHelper(dynamic_cast<InnerDecklistNode *>(item->at(i)), result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeckList::getCardRefListHelper(InnerDecklistNode *item, QList<CardRef> &result)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < item->size(); ++i) {
|
|
||||||
auto *node = dynamic_cast<DecklistCardNode *>(item->at(i));
|
|
||||||
|
|
||||||
if (node) {
|
|
||||||
result.append(node->toCardRef());
|
|
||||||
} else {
|
|
||||||
getCardRefListHelper(dynamic_cast<InnerDecklistNode *>(item->at(i)), result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DeckList::getCardList() const
|
QStringList DeckList::getCardList() const
|
||||||
{
|
{
|
||||||
QSet<QString> result;
|
auto nodes = getCardNodes();
|
||||||
getCardListHelper(root, result);
|
|
||||||
return result.values();
|
QStringList result;
|
||||||
|
std::transform(nodes.cbegin(), nodes.cend(), std::back_inserter(result), [](auto node) { return node->getName(); });
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<CardRef> DeckList::getCardRefList() const
|
QList<CardRef> DeckList::getCardRefList() const
|
||||||
{
|
{
|
||||||
|
auto nodes = getCardNodes();
|
||||||
|
|
||||||
QList<CardRef> result;
|
QList<CardRef> result;
|
||||||
getCardRefListHelper(root, result);
|
std::transform(nodes.cbegin(), nodes.cend(), std::back_inserter(result),
|
||||||
|
[](auto node) { return node->toCardRef(); });
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,6 @@ private:
|
||||||
mutable QString cachedDeckHash;
|
mutable QString cachedDeckHash;
|
||||||
|
|
||||||
// Helpers for traversing the tree
|
// Helpers for traversing the tree
|
||||||
static void getCardListHelper(InnerDecklistNode *node, QSet<QString> &result);
|
|
||||||
static void getCardRefListHelper(InnerDecklistNode *item, QList<CardRef> &result);
|
|
||||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue