Fix #45: don't send tokens to deckstats.

This commit is contained in:
arxanas 2014-06-30 01:18:05 -04:00
parent 4d6f46b06e
commit 7cbe410172
8 changed files with 105 additions and 47 deletions

View file

@ -117,6 +117,7 @@ public:
QString getName() const { return name; }
void setName(const QString &_name) { name = _name; }
float getPrice() const { return price; }
void setPrice(const float _price) { price = _price; }
};
@ -169,6 +170,28 @@ public:
InnerDecklistNode *getRoot() const { return root; }
DecklistCardNode *addCard(const QString &cardName, const QString &zoneName);
bool deleteNode(AbstractDecklistNode *node, InnerDecklistNode *rootNode = 0);
/**
* Calls a given function object for each card in the deck. It must
* take a InnerDecklistNode* as its first argument and a
* DecklistCardNode* as its second.
*/
template <typename Callback>
void forEachCard(Callback &callback) const {
// Support for this is only possible if the internal structure
// doesn't get more complicated.
for (int i = 0; i < root->size(); i++) {
const InnerDecklistNode *node =
dynamic_cast<InnerDecklistNode *>(root->at(i));
for (int j = 0; j < node->size(); j++) {
const DecklistCardNode *card =
dynamic_cast<DecklistCardNode *>(
node->at(j)
);
callback(node, card);
}
}
}
};
#endif