Change CardInfo's PixmapCacheKey to be the UUID of the card in the preferred set after database loading has finished. Otherwise, and if no UUID of a preferred set is available, default to the card name. (#5158)

* Change CardInfo's PixmapCacheKey to be the UUID of the preferred set after database loading has finished. Otherwise, and if no UUID of a preferred set is available, default to the card name.

* Clean up some variable names, clarify preferred Set insertion for PictureLoader, use the new CardDatabaseManager.

* Code formatting.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2024-11-10 23:49:11 +01:00 committed by GitHub
parent 3c40cc4b7d
commit c54f47efbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 135 additions and 2 deletions

View file

@ -0,0 +1,24 @@
#ifndef SET_PRIORITY_COMPARATOR_H
#define SET_PRIORITY_COMPARATOR_H
#include "../game/cards/card_database.h"
class SetPriorityComparator
{
public:
/*
* Returns true if a has higher download priority than b
* Enabled sets have priority over disabled sets
* Both groups follow the user-defined order
*/
inline bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
{
if (a->getEnabled()) {
return !b->getEnabled() || a->getSortKey() < b->getSortKey();
} else {
return !b->getEnabled() && a->getSortKey() < b->getSortKey();
}
}
};
#endif // SET_PRIORITY_COMPARATOR_H