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"));
|
||||
|
||||
bool atLeastOneGoodRelationFound = false;
|
||||
QList<CardRelation *> relatedCards = info->getAllRelatedCards();
|
||||
for (const CardRelation *cardRelation : relatedCards) {
|
||||
CardInfoPtr relatedCard = CardDatabaseManager::getInstance()->getCard(cardRelation->getName());
|
||||
if (relatedCard != nullptr) {
|
||||
atLeastOneGoodRelationFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto relatedCardExists = [](const CardRelation *cardRelation) {
|
||||
return CardDatabaseManager::getInstance()->getCard(cardRelation->getName()) != nullptr;
|
||||
};
|
||||
|
||||
bool atLeastOneGoodRelationFound = std::any_of(relatedCards.begin(), relatedCards.end(), relatedCardExists);
|
||||
|
||||
if (!atLeastOneGoodRelationFound) {
|
||||
viewRelatedCards->setEnabled(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue