From c5ac61c797e4f5098720b4f02b56f51ddfd6c824 Mon Sep 17 00:00:00 2001 From: tritoch Date: Tue, 30 May 2017 01:19:11 -0500 Subject: [PATCH] Colorless for color filter (#2737) * Colorless for color filter Add 'colorless' as an option for color filter in deck editor / card list. * Remove empty quote check Empty quote does not work here. Add 'none' as optional string instead. * Add C to colorless filters --- cockatrice/src/filtertree.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cockatrice/src/filtertree.cpp b/cockatrice/src/filtertree.cpp index b02564bd..d41ac505 100644 --- a/cockatrice/src/filtertree.cpp +++ b/cockatrice/src/filtertree.cpp @@ -177,9 +177,16 @@ bool FilterItem::acceptColor(const CardInfo *info) const converted_term.replace(QString("white"), QString("w"), Qt::CaseInsensitive); converted_term.replace(QString("wht"), QString("w"), Qt::CaseInsensitive); converted_term.replace(QString(" "), QString(""), Qt::CaseInsensitive); + + if (converted_term.toLower() == "none" || converted_term.toLower() == "colorless" || converted_term.toLower() == "c") { + if (info->getColors().length() < 1) { + return true; + } + } /* This is a tricky part, if the filter has multiple colors in it, like UGW, then we should match all of them to the card's colors */ + match_count = 0; for (it = converted_term.begin(); it != converted_term.end(); it++) { for (i = info->getColors().constBegin(); i != info->getColors().constEnd(); i++)