mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-07 05:53:59 -07:00
[DeckEditor] Fix double-faced cards not importing correctly
This commit is contained in:
parent
b36ab66583
commit
cffac367ec
1 changed files with 20 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#include "deck_list.h"
|
||||
|
||||
#include "../../../libcockatrice_card/libcockatrice/card/database/card_database.h"
|
||||
#include "../../../libcockatrice_card/libcockatrice/card/database/card_database_manager.h"
|
||||
#include "deck_list_memento.h"
|
||||
#include "tree/abstract_deck_list_node.h"
|
||||
#include "tree/deck_list_card_node.h"
|
||||
|
|
@ -194,6 +196,21 @@ bool DeckList::saveToFile_Native(QIODevice *device) const
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resolves the complete display name of a card.
|
||||
* @param cardName Base name.
|
||||
* @return Full display name, or the cardName unchanged if a display name is not found.
|
||||
*/
|
||||
static QString getCompleteCardName(const QString &cardName)
|
||||
{
|
||||
ExactCard temp = CardDatabaseManager::query()->guessCard({cardName});
|
||||
if (temp) {
|
||||
return temp.getName();
|
||||
}
|
||||
|
||||
return cardName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the decklist and loads in a new deck from text
|
||||
*
|
||||
|
|
@ -376,6 +393,9 @@ bool DeckList::loadFromStream_Plain(QTextStream &in, bool preserveMetadata)
|
|||
cardName.replace(diff.key(), diff.value());
|
||||
}
|
||||
|
||||
// Resolve complete card name
|
||||
cardName = getCompleteCardName(cardName);
|
||||
|
||||
// Determine the zone (mainboard/sideboard)
|
||||
QString zoneName = sideboard ? DECK_ZONE_SIDE : DECK_ZONE_MAIN;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue