mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
Added doc comment
This commit is contained in:
parent
de683434e4
commit
4386d6549f
1 changed files with 11 additions and 6 deletions
|
|
@ -359,10 +359,17 @@ bool FilterItem::acceptSubType(const CardInfoPtr &info) const
|
||||||
return subType.contains(term, Qt::CaseInsensitive);
|
return subType.contains(term, Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool matchesColor(const QString &convertedColorTerm, const QString &colors)
|
/**
|
||||||
|
* @brief Return true when every letter of the given term appears in the given colors string.
|
||||||
|
* If the term is equal to "c", then only return true if the color string is empty.
|
||||||
|
*
|
||||||
|
* @param term The letters which should be included, or "c"
|
||||||
|
* @param colors The string to check for letters in
|
||||||
|
*/
|
||||||
|
static bool matchesColor(const QString &term, const QString &colors)
|
||||||
{
|
{
|
||||||
// Colorless card filter
|
// Colorless card filter
|
||||||
if (convertedColorTerm == "c" && colors.length() < 1) {
|
if (term == "c" && colors.length() < 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,13 +378,13 @@ static bool matchesColor(const QString &convertedColorTerm, const QString &color
|
||||||
* then we should match all of them to the card's colors
|
* then we should match all of them to the card's colors
|
||||||
*/
|
*/
|
||||||
int match_count = 0;
|
int match_count = 0;
|
||||||
for (const QChar &color : convertedColorTerm) {
|
for (const QChar &color : term) {
|
||||||
if (colors.contains(color, Qt::CaseInsensitive)) {
|
if (colors.contains(color, Qt::CaseInsensitive)) {
|
||||||
match_count++;
|
match_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return match_count == convertedColorTerm.length();
|
return match_count == term.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterItem::acceptColor(const CardInfoPtr &info) const
|
bool FilterItem::acceptColor(const CardInfoPtr &info) const
|
||||||
|
|
@ -387,8 +394,6 @@ bool FilterItem::acceptColor(const CardInfoPtr &info) const
|
||||||
|
|
||||||
bool FilterItem::acceptColorIdentity(const CardInfoPtr &info) const
|
bool FilterItem::acceptColorIdentity(const CardInfoPtr &info) const
|
||||||
{
|
{
|
||||||
// if (info->getColorIdentity() == "")
|
|
||||||
// system(std::format("notify-send \"{}, {}\"", convertedColorTerm.toStdString(), info->getColorIdentity().toStdString()).c_str());
|
|
||||||
return matchesColor(convertedColorTerm, info->getColorIdentity());
|
return matchesColor(convertedColorTerm, info->getColorIdentity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue