mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
* fix bug introduced in #5267 * remove default args to prevent similar bugs in the future * add newInstance overload with default properties
This commit is contained in:
parent
dde2f8b9ad
commit
5bbc118920
3 changed files with 36 additions and 24 deletions
|
|
@ -252,6 +252,12 @@ CardInfo::~CardInfo()
|
||||||
PictureLoader::clearPixmapCache(smartThis);
|
PictureLoader::clearPixmapCache(smartThis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CardInfoPtr CardInfo::newInstance(const QString &_name)
|
||||||
|
{
|
||||||
|
return newInstance(_name, QString(), false, QVariantHash(), QList<CardRelation *>(), QList<CardRelation *>(),
|
||||||
|
CardInfoPerSetMap(), false, false, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
CardInfoPtr CardInfo::newInstance(const QString &_name,
|
CardInfoPtr CardInfo::newInstance(const QString &_name,
|
||||||
const QString &_text,
|
const QString &_text,
|
||||||
bool _isToken,
|
bool _isToken,
|
||||||
|
|
|
||||||
|
|
@ -202,17 +202,17 @@ private:
|
||||||
bool upsideDownArt;
|
bool upsideDownArt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CardInfo(const QString &_name = QString(),
|
explicit CardInfo(const QString &_name,
|
||||||
const QString &_text = QString(),
|
const QString &_text,
|
||||||
bool _isToken = false,
|
bool _isToken,
|
||||||
QVariantHash _properties = QVariantHash(),
|
QVariantHash _properties,
|
||||||
const QList<CardRelation *> &_relatedCards = QList<CardRelation *>(),
|
const QList<CardRelation *> &_relatedCards,
|
||||||
const QList<CardRelation *> &_reverseRelatedCards = QList<CardRelation *>(),
|
const QList<CardRelation *> &_reverseRelatedCards,
|
||||||
CardInfoPerSetMap _sets = CardInfoPerSetMap(),
|
CardInfoPerSetMap _sets,
|
||||||
bool _cipt = false,
|
bool _cipt,
|
||||||
bool _landscapeOrientation = false,
|
bool _landscapeOrientation,
|
||||||
int _tableRow = 0,
|
int _tableRow,
|
||||||
bool _upsideDownArt = false);
|
bool _upsideDownArt);
|
||||||
CardInfo(const CardInfo &other)
|
CardInfo(const CardInfo &other)
|
||||||
: QObject(other.parent()), name(other.name), simpleName(other.simpleName), pixmapCacheKey(other.pixmapCacheKey),
|
: QObject(other.parent()), name(other.name), simpleName(other.simpleName), pixmapCacheKey(other.pixmapCacheKey),
|
||||||
text(other.text), isToken(other.isToken), properties(other.properties), relatedCards(other.relatedCards),
|
text(other.text), isToken(other.isToken), properties(other.properties), relatedCards(other.relatedCards),
|
||||||
|
|
@ -223,17 +223,19 @@ public:
|
||||||
}
|
}
|
||||||
~CardInfo() override;
|
~CardInfo() override;
|
||||||
|
|
||||||
static CardInfoPtr newInstance(const QString &_name = QString(),
|
static CardInfoPtr newInstance(const QString &_name);
|
||||||
const QString &_text = QString(),
|
|
||||||
bool _isToken = false,
|
static CardInfoPtr newInstance(const QString &_name,
|
||||||
QVariantHash _properties = QVariantHash(),
|
const QString &_text,
|
||||||
const QList<CardRelation *> &_relatedCards = QList<CardRelation *>(),
|
bool _isToken,
|
||||||
const QList<CardRelation *> &_reverseRelatedCards = QList<CardRelation *>(),
|
QVariantHash _properties,
|
||||||
CardInfoPerSetMap _sets = CardInfoPerSetMap(),
|
const QList<CardRelation *> &_relatedCards,
|
||||||
bool _cipt = false,
|
const QList<CardRelation *> &_reverseRelatedCards,
|
||||||
bool _landscapeOrientation = false,
|
CardInfoPerSetMap _sets,
|
||||||
int _tableRow = 0,
|
bool _cipt,
|
||||||
bool _upsideDownArt = false);
|
bool _landscapeOrientation,
|
||||||
|
int _tableRow,
|
||||||
|
bool _upsideDownArt);
|
||||||
|
|
||||||
CardInfoPtr clone() const
|
CardInfoPtr clone() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
auto _sets = CardInfoPerSetMap();
|
auto _sets = CardInfoPerSetMap();
|
||||||
int tableRow = 0;
|
int tableRow = 0;
|
||||||
bool cipt = false;
|
bool cipt = false;
|
||||||
|
bool landscapeOrientation = false;
|
||||||
bool isToken = false;
|
bool isToken = false;
|
||||||
bool upsideDown = false;
|
bool upsideDown = false;
|
||||||
|
|
||||||
|
|
@ -165,6 +166,8 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
tableRow = xml.readElementText(QXmlStreamReader::IncludeChildElements).toInt();
|
tableRow = xml.readElementText(QXmlStreamReader::IncludeChildElements).toInt();
|
||||||
} else if (xmlName == "cipt") {
|
} else if (xmlName == "cipt") {
|
||||||
cipt = (xml.readElementText(QXmlStreamReader::IncludeChildElements) == "1");
|
cipt = (xml.readElementText(QXmlStreamReader::IncludeChildElements) == "1");
|
||||||
|
} else if (xmlName == "landscapeOrientation") {
|
||||||
|
landscapeOrientation = (xml.readElementText(QXmlStreamReader::IncludeChildElements) == "1");
|
||||||
} else if (xmlName == "upsidedown") {
|
} else if (xmlName == "upsidedown") {
|
||||||
upsideDown = (xml.readElementText(QXmlStreamReader::IncludeChildElements) == "1");
|
upsideDown = (xml.readElementText(QXmlStreamReader::IncludeChildElements) == "1");
|
||||||
// sets
|
// sets
|
||||||
|
|
@ -233,8 +236,9 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CardInfoPtr newCard = CardInfo::newInstance(name, text, isToken, properties, relatedCards,
|
CardInfoPtr newCard =
|
||||||
reverseRelatedCards, _sets, cipt, tableRow, upsideDown);
|
CardInfo::newInstance(name, text, isToken, properties, relatedCards, reverseRelatedCards, _sets, cipt,
|
||||||
|
landscapeOrientation, tableRow, upsideDown);
|
||||||
emit addCard(newCard);
|
emit addCard(newCard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue