From 040d9d15a3579c644abe9d475666da514944ba32 Mon Sep 17 00:00:00 2001 From: sylvanbasilisk Date: Thu, 24 Apr 2014 19:49:50 +0000 Subject: [PATCH] bug fix: move isEnabled test out of acceptCardAttr in the case of AND'ed filter terms, returning true from acceptCardAttr will be equivalent to ignoring the disabled term, but in the case of OR'ed terms, returning true will incorrectly cause all cards to be accepted. the fix is to test for whether the term is enabled before calling acceptCardAttr and continue if disabled. --- cockatrice/src/filtertree.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/filtertree.cpp b/cockatrice/src/filtertree.cpp index e1dc3101..4c28028b 100644 --- a/cockatrice/src/filtertree.cpp +++ b/cockatrice/src/filtertree.cpp @@ -112,9 +112,12 @@ bool FilterItemList::testTypeAnd(const CardInfo *info, CardFilter::Attr attr) co { QList::const_iterator i; - for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) + for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) { + if (!(*i)->isEnabled()) + continue; if (!(*i)->acceptCardAttr(info, attr)) return false; + } return true; } @@ -129,9 +132,12 @@ bool FilterItemList::testTypeOr(const CardInfo *info, CardFilter::Attr attr) con { QList::const_iterator i; - for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) + for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) { + if (!(*i)->isEnabled()) + continue; if ((*i)->acceptCardAttr(info, attr)) return true; + } return false; } @@ -197,9 +203,6 @@ bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) con { bool status; - if (!isEnabled()) - return true; - switch (attr) { case CardFilter::AttrName: status = acceptName(info);