inline mainCardTypes list and make the method static

This commit is contained in:
RickyRister 2025-04-20 21:47:53 -07:00
parent ac6b3b5909
commit b75c88d6c7
2 changed files with 5 additions and 5 deletions

View file

@ -85,13 +85,16 @@ bool OracleImporter::readSetsFromByteArray(const QByteArray &data)
return true;
}
QString OracleImporter::getMainCardType(const QStringList &typeList)
static QString getMainCardType(const QStringList &typeList)
{
if (typeList.isEmpty()) {
return {};
}
for (const auto &type : mainCardTypes) {
static const QStringList typePriority = {"Planeswalker", "Creature", "Land", "Sorcery",
"Instant", "Artifact", "Enchantment"};
for (const auto &type : typePriority) {
if (typeList.contains(type)) {
return type;
}

View file

@ -121,8 +121,6 @@ class OracleImporter : public QObject
{
Q_OBJECT
private:
const QStringList mainCardTypes = {"Planeswalker", "Creature", "Land", "Sorcery",
"Instant", "Artifact", "Enchantment"};
static const QRegularExpression formatRegex;
/**
@ -137,7 +135,6 @@ private:
QList<SetToDownload> allSets;
QString getMainCardType(const QStringList &typeList);
CardInfoPtr addCard(QString name,
QString text,
bool isToken,