mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Refactor: Represent cardName + providerId with CardRef struct (#6039)
* card_ref.h * update CardDatabase signatures * make everything compile * rename methods * add docs * mark stuff const * set cardRef in CardItem * cleanup * fix build failure * Fix builds on mac --------- Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
parent
e05dad4267
commit
a9b3be33e0
61 changed files with 328 additions and 305 deletions
|
|
@ -66,7 +66,7 @@ void DeckListModel::rebuildTree()
|
|||
continue;
|
||||
}
|
||||
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(currentCard->getName());
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCardInfo(currentCard->getName());
|
||||
QString groupCriteria = getGroupCriteriaForCard(info);
|
||||
|
||||
auto *groupNode = dynamic_cast<InnerDecklistNode *>(node->findChild(groupCriteria));
|
||||
|
|
@ -337,7 +337,7 @@ DecklistModelCardNode *DeckListModel::findCardNode(const QString &cardName,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(cardName);
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCardInfo(cardName);
|
||||
if (!info) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -375,8 +375,7 @@ QModelIndex DeckListModel::addCard(const QString &cardName,
|
|||
const QString &zoneName,
|
||||
bool abAddAnyway)
|
||||
{
|
||||
CardInfoPtr cardInfo =
|
||||
CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, printingInfo.getProperty("uuid"));
|
||||
CardInfoPtr cardInfo = CardDatabaseManager::getInstance()->getCard({cardName, printingInfo.getProperty("uuid")});
|
||||
|
||||
if (cardInfo == nullptr) {
|
||||
if (abAddAnyway) {
|
||||
|
|
@ -559,8 +558,7 @@ QList<CardInfoPtr> DeckListModel::getCardsAsCardInfoPtrs() const
|
|||
if (!currentCard)
|
||||
continue;
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCardByNameAndProviderId(
|
||||
currentCard->getName(), currentCard->getCardProviderId());
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef());
|
||||
if (info) {
|
||||
cards.append(info);
|
||||
} else {
|
||||
|
|
@ -593,8 +591,7 @@ QList<CardInfoPtr> DeckListModel::getCardsAsCardInfoPtrsForZone(QString zoneName
|
|||
if (!currentCard)
|
||||
continue;
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCardByNameAndProviderId(
|
||||
currentCard->getName(), currentCard->getCardProviderId());
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef());
|
||||
if (info) {
|
||||
cards.append(info);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue