From 6239fe5a72b7b390429e02b8947e096d870c7dca Mon Sep 17 00:00:00 2001 From: Cameron McDonald Date: Fri, 16 Aug 2024 12:59:13 -0500 Subject: [PATCH] make defaultSort logic easier to follow --- cockatrice/src/game/cards/card_database.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/game/cards/card_database.cpp b/cockatrice/src/game/cards/card_database.cpp index 475634c9f..0d5529e72 100644 --- a/cockatrice/src/game/cards/card_database.cpp +++ b/cockatrice/src/game/cards/card_database.cpp @@ -218,13 +218,13 @@ void SetList::defaultSort() CardSet::Priority bPriority = b->getPriority() ? b->getPriority() : CardSet::PriorityFallback; // Sort by priority, then by release date, then by short name - if (aPriority == bPriority) { - if (aDate.daysTo(bDate) == 0) { - return a->getShortName().compare(b->getShortName()) < 0; - } + if (aPriority != bPriority) { + return aPriority < bPriority; + } + if (aDate.daysTo(bDate) != 0) { return aDate.daysTo(bDate) < 0; } - return aPriority < bPriority; + return a->getShortName().compare(b->getShortName()) < 0; }); }