Use getCards()

Took 4 minutes
This commit is contained in:
Lukas Brübach 2025-12-31 13:50:47 +01:00
parent 2c4920560c
commit 07a67e5854

View file

@ -19,27 +19,20 @@ void DeckListStatisticsAnalyzer::analyze()
{
clearData();
auto nodes = model->getDeckList()->getCardNodes();
QList<ExactCard> cards = model->getCards();
for (auto *node : nodes) {
CardInfoPtr info = CardDatabaseManager::query()->getCardInfo(node->getName());
if (!info) {
continue;
}
const int count = node->getNumber();
const int cmc = info->getCmc().toInt();
for (auto card : cards) {
auto info = card.getInfo();
const int cmc = info.getCmc().toInt();
// Convert once
QStringList types = info->getMainCardType().split(' ');
QStringList subtypes = info->getCardType().split('-').last().split(" ");
QString colors = info->getColors();
int power = info->getPowTough().split("/").first().toInt();
int toughness = info->getPowTough().split("/").last().toInt();
QStringList types = info.getMainCardType().split(' ');
QStringList subtypes = info.getCardType().split('-').last().split(" ");
QString colors = info.getColors();
int power = info.getPowTough().split("/").first().toInt();
int toughness = info.getPowTough().split("/").last().toInt();
// For each copy of card
for (int i = 0; i < count; ++i) {
// ---------------- Mana Curve ----------------
if (config.computeManaCurve) {
manaCurveMap[cmc]++;
@ -105,7 +98,6 @@ void DeckListStatisticsAnalyzer::analyze()
}
}
}
}
emit statsUpdated();
}