mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
remove priority fallback ternary from CardSet model
This commit is contained in:
parent
0d4d21b8ae
commit
006476b4c6
2 changed files with 5 additions and 3 deletions
|
|
@ -214,15 +214,17 @@ void SetList::defaultSort()
|
|||
QDate distantPast = QDate(1970, 1, 1);
|
||||
QDate aDate = a->getReleaseDate().isValid() ? a->getReleaseDate() : distantPast;
|
||||
QDate bDate = b->getReleaseDate().isValid() ? b->getReleaseDate() : distantPast;
|
||||
CardSet::Priority aPriority = a->getPriority() ? a->getPriority() : CardSet::PriorityFallback;
|
||||
CardSet::Priority bPriority = b->getPriority() ? b->getPriority() : CardSet::PriorityFallback;
|
||||
|
||||
// Sort by priority, then by release date, then by short name
|
||||
if (a->getPriority() == b->getPriority()) {
|
||||
if (aPriority == bPriority) {
|
||||
if (aDate.daysTo(bDate) == 0) {
|
||||
return a->getShortName().compare(b->getShortName()) < 0;
|
||||
}
|
||||
return aDate.daysTo(bDate) < 0;
|
||||
}
|
||||
return a->getPriority() < b->getPriority();
|
||||
return aPriority < bPriority;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public:
|
|||
}
|
||||
Priority getPriority() const
|
||||
{
|
||||
return priority ? priority : PriorityFallback;
|
||||
return priority;
|
||||
}
|
||||
void setLongName(const QString &_longName)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue