commit
fe7b976b79
6 changed files with 24 additions and 20 deletions
|
@ -751,7 +751,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
||||||
else if (xml.name() == "manacost")
|
else if (xml.name() == "manacost")
|
||||||
manacost = xml.readElementText();
|
manacost = xml.readElementText();
|
||||||
else if (xml.name() == "cmc")
|
else if (xml.name() == "cmc")
|
||||||
cmc = xml.readElementText().toInt();
|
cmc = xml.readElementText();
|
||||||
else if (xml.name() == "type")
|
else if (xml.name() == "type")
|
||||||
type = xml.readElementText();
|
type = xml.readElementText();
|
||||||
else if (xml.name() == "pt")
|
else if (xml.name() == "pt")
|
||||||
|
|
|
@ -31,6 +31,8 @@ const char *CardFilter::attrName(Attr a)
|
||||||
return "set";
|
return "set";
|
||||||
case AttrManaCost:
|
case AttrManaCost:
|
||||||
return "mana cost";
|
return "mana cost";
|
||||||
|
case AttrCmc:
|
||||||
|
return "cmc";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
AttrText,
|
AttrText,
|
||||||
AttrSet,
|
AttrSet,
|
||||||
AttrManaCost,
|
AttrManaCost,
|
||||||
|
AttrCmc,
|
||||||
AttrEnd
|
AttrEnd
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -199,34 +199,31 @@ bool FilterItem::acceptManaCost(const CardInfo *info) const
|
||||||
return (info->getManaCost() == term);
|
return (info->getManaCost() == term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FilterItem::acceptCmc(const CardInfo *info) const
|
||||||
|
{
|
||||||
|
return (info->getCmc() == term);
|
||||||
|
}
|
||||||
|
|
||||||
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
|
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
|
||||||
{
|
{
|
||||||
bool status;
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case CardFilter::AttrName:
|
case CardFilter::AttrName:
|
||||||
status = acceptName(info);
|
return acceptName(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrType:
|
case CardFilter::AttrType:
|
||||||
status = acceptType(info);
|
return acceptType(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrColor:
|
case CardFilter::AttrColor:
|
||||||
status = acceptColor(info);
|
return acceptColor(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrText:
|
case CardFilter::AttrText:
|
||||||
status = acceptText(info);
|
return acceptText(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrSet:
|
case CardFilter::AttrSet:
|
||||||
status = acceptSet(info);
|
return acceptSet(info);
|
||||||
break;
|
|
||||||
case CardFilter::AttrManaCost:
|
case CardFilter::AttrManaCost:
|
||||||
status = acceptManaCost(info);
|
return acceptManaCost(info);
|
||||||
break;
|
case CardFilter::AttrCmc:
|
||||||
|
return acceptCmc(info);
|
||||||
default:
|
default:
|
||||||
status = true; /* ignore this attribute */
|
return true; /* ignore this attribute */
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need to define these here to make QT happy, otherwise
|
/* need to define these here to make QT happy, otherwise
|
||||||
|
|
|
@ -117,6 +117,7 @@ public:
|
||||||
bool acceptText(const CardInfo *info) const;
|
bool acceptText(const CardInfo *info) const;
|
||||||
bool acceptSet(const CardInfo *info) const;
|
bool acceptSet(const CardInfo *info) const;
|
||||||
bool acceptManaCost(const CardInfo *info) const;
|
bool acceptManaCost(const CardInfo *info) const;
|
||||||
|
bool acceptCmc(const CardInfo *info) const;
|
||||||
bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const;
|
bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
// add first card's data
|
// add first card's data
|
||||||
cardName = card1->contains("name") ? card1->value("name").toString() : QString("");
|
cardName = card1->contains("name") ? card1->value("name").toString() : QString("");
|
||||||
cardCost = card1->contains("manaCost") ? card1->value("manaCost").toString() : QString("");
|
cardCost = card1->contains("manaCost") ? card1->value("manaCost").toString() : QString("");
|
||||||
|
cmc = card1->contains("cmc") ? card1->value("cmc").toString() : QString("");
|
||||||
cardType = card1->contains("type") ? card1->value("type").toString() : QString("");
|
cardType = card1->contains("type") ? card1->value("type").toString() : QString("");
|
||||||
cardPT = card1->contains("power") || card1->contains("toughness") ? card1->value("power").toString() + QString('/') + card1->value("toughness").toString() : QString("");
|
cardPT = card1->contains("power") || card1->contains("toughness") ? card1->value("power").toString() + QString('/') + card1->value("toughness").toString() : QString("");
|
||||||
cardText = card1->contains("text") ? card1->value("text").toString() : QString("");
|
cardText = card1->contains("text") ? card1->value("text").toString() : QString("");
|
||||||
|
@ -199,8 +200,10 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
|
||||||
cardPT += card2->contains("power") || card2->contains("toughness") ? QString(" // ") + card2->value("power").toString() + QString('/') + card2->value("toughness").toString() : QString("");
|
cardPT += card2->contains("power") || card2->contains("toughness") ? QString(" // ") + card2->value("power").toString() + QString('/') + card2->value("toughness").toString() : QString("");
|
||||||
cardText += card2->contains("text") ? QString("\n\n---\n\n") + card2->value("text").toString() : QString("");
|
cardText += card2->contains("text") ? QString("\n\n---\n\n") + card2->value("text").toString() : QString("");
|
||||||
} else {
|
} else {
|
||||||
// first card od a pair; enqueue for later merging
|
// first card of a pair; enqueue for later merging
|
||||||
splitCards.insert(cardId, map);
|
// Conditional on cardId because promo prints have no muid - see #640
|
||||||
|
if (cardId)
|
||||||
|
splitCards.insert(cardId, map);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue