mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52:15 -07:00
[CardInfo] Refactor: add getLegalityProp method (#6536)
This commit is contained in:
parent
39ddaa0c35
commit
2e1a0bec93
5 changed files with 20 additions and 9 deletions
|
|
@ -143,13 +143,12 @@ static void setupParserRules()
|
|||
search["FormatQuery"] = [](const peg::SemanticValues &sv) -> Filter {
|
||||
if (sv.choice() == 0) {
|
||||
const auto format = std::any_cast<QString>(sv[0]);
|
||||
return
|
||||
[=](const CardData &x) -> bool { return x->getProperty(QString("format-%1").arg(format)) == "legal"; };
|
||||
return [=](const CardData &x) -> bool { return x->getLegalityProp(format) == "legal"; };
|
||||
}
|
||||
|
||||
const auto format = std::any_cast<QString>(sv[1]);
|
||||
const auto legality = std::any_cast<QString>(sv[0]);
|
||||
return [=](const CardData &x) -> bool { return x->getProperty(QString("format-%1").arg(format)) == legality; };
|
||||
return [=](const CardData &x) -> bool { return x->getLegalityProp(format) == legality; };
|
||||
};
|
||||
search["Legality"] = [](const peg::SemanticValues &sv) -> QString {
|
||||
switch (tolower(std::string(sv.sv())[0])) {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ bool FilterItem::acceptCmc(const CardInfoPtr info) const
|
|||
|
||||
bool FilterItem::acceptFormat(const CardInfoPtr info) const
|
||||
{
|
||||
return info->getProperty(QString("format-%1").arg(term.toLower())) == "legal";
|
||||
return info->getLegalityProp(term.toLower()) == "legal";
|
||||
}
|
||||
|
||||
bool FilterItem::acceptLoyalty(const CardInfoPtr info) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue