search function couldn't find colorless cards: fixed
This commit is contained in:
parent
f9b0b4b170
commit
0b98d90337
2 changed files with 6 additions and 3 deletions
|
@ -511,8 +511,11 @@ QStringList CardDatabase::getAllColors() const
|
||||||
QHashIterator<QString, CardInfo *> cardIterator(cardHash);
|
QHashIterator<QString, CardInfo *> cardIterator(cardHash);
|
||||||
while (cardIterator.hasNext()) {
|
while (cardIterator.hasNext()) {
|
||||||
const QStringList &cardColors = cardIterator.next().value()->getColors();
|
const QStringList &cardColors = cardIterator.next().value()->getColors();
|
||||||
for (int i = 0; i < cardColors.size(); ++i)
|
if (cardColors.isEmpty())
|
||||||
colors.insert(cardColors[i]);
|
colors.insert("X");
|
||||||
|
else
|
||||||
|
for (int i = 0; i < cardColors.size(); ++i)
|
||||||
|
colors.insert(cardColors[i]);
|
||||||
}
|
}
|
||||||
return colors.toList();
|
return colors.toList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ bool CardDatabaseDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!cardColors.isEmpty())
|
if (!cardColors.isEmpty())
|
||||||
if (QSet<QString>::fromList(info->getColors()).intersect(cardColors).isEmpty())
|
if (QSet<QString>::fromList(info->getColors()).intersect(cardColors).isEmpty() && !(info->getColors().isEmpty() && cardColors.contains("X")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!cardTypes.isEmpty())
|
if (!cardTypes.isEmpty())
|
||||||
|
|
Loading…
Reference in a new issue