mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Cache correct providerId cards on deck load (#5668)
* Implement new method for DeckList to return cardlist with providerId, a new carddatabase method to fetch a cardlist with name and providerId and changed PictureLoader to use providerId versions of cards for caching. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
7ff43f15fc
commit
3620664a9f
7 changed files with 41 additions and 5 deletions
|
|
@ -825,6 +825,19 @@ void DeckList::getCardListHelper(InnerDecklistNode *item, QSet<QString> &result)
|
|||
}
|
||||
}
|
||||
|
||||
void DeckList::getCardListWithProviderIdHelper(InnerDecklistNode *item, QMap<QString, QString> &result) const
|
||||
{
|
||||
for (int i = 0; i < item->size(); ++i) {
|
||||
auto *node = dynamic_cast<DecklistCardNode *>(item->at(i));
|
||||
|
||||
if (node) {
|
||||
result.insert(node->getName(), node->getCardProviderId());
|
||||
} else {
|
||||
getCardListWithProviderIdHelper(dynamic_cast<InnerDecklistNode *>(item->at(i)), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList DeckList::getCardList() const
|
||||
{
|
||||
QSet<QString> result;
|
||||
|
|
@ -832,6 +845,13 @@ QStringList DeckList::getCardList() const
|
|||
return result.values();
|
||||
}
|
||||
|
||||
QMap<QString, QString> DeckList::getCardListWithProviderId() const
|
||||
{
|
||||
QMap<QString, QString> result;
|
||||
getCardListWithProviderIdHelper(root, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int DeckList::getSideboardSize() const
|
||||
{
|
||||
int size = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue