mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refactor to use std
This commit is contained in:
parent
cc04dd012a
commit
6640239439
1 changed files with 6 additions and 8 deletions
|
|
@ -266,15 +266,13 @@ QMenu *CardInfoPictureWidget::createViewRelatedCardsMenu()
|
||||||
{
|
{
|
||||||
auto viewRelatedCards = new QMenu(tr("View related cards"));
|
auto viewRelatedCards = new QMenu(tr("View related cards"));
|
||||||
|
|
||||||
bool atLeastOneGoodRelationFound = false;
|
|
||||||
QList<CardRelation *> relatedCards = info->getAllRelatedCards();
|
QList<CardRelation *> relatedCards = info->getAllRelatedCards();
|
||||||
for (const CardRelation *cardRelation : relatedCards) {
|
|
||||||
CardInfoPtr relatedCard = CardDatabaseManager::getInstance()->getCard(cardRelation->getName());
|
auto relatedCardExists = [](const CardRelation *cardRelation) {
|
||||||
if (relatedCard != nullptr) {
|
return CardDatabaseManager::getInstance()->getCard(cardRelation->getName()) != nullptr;
|
||||||
atLeastOneGoodRelationFound = true;
|
};
|
||||||
break;
|
|
||||||
}
|
bool atLeastOneGoodRelationFound = std::any_of(relatedCards.begin(), relatedCards.end(), relatedCardExists);
|
||||||
}
|
|
||||||
|
|
||||||
if (!atLeastOneGoodRelationFound) {
|
if (!atLeastOneGoodRelationFound) {
|
||||||
viewRelatedCards->setEnabled(false);
|
viewRelatedCards->setEnabled(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue