Merge branch 'master' into devel
This commit is contained in:
commit
10d958c4ce
4 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,8 @@
|
|||
#include <QNetworkRequest>
|
||||
#include <QDebug>
|
||||
|
||||
const int CardDatabase::versionNeeded = 2;
|
||||
|
||||
CardSet::CardSet(const QString &_shortName, const QString &_longName)
|
||||
: shortName(_shortName), longName(_longName)
|
||||
{
|
||||
|
@ -604,6 +606,8 @@ bool CardDatabase::loadFromFile(const QString &fileName)
|
|||
if (xml.readNext() == QXmlStreamReader::StartElement) {
|
||||
if (xml.name() != "cockatrice_carddatabase")
|
||||
return false;
|
||||
if (xml.attributes().value("version").toString().toInt() < versionNeeded)
|
||||
return false;
|
||||
while (!xml.atEnd()) {
|
||||
if (xml.readNext() == QXmlStreamReader::EndElement)
|
||||
break;
|
||||
|
@ -628,7 +632,7 @@ bool CardDatabase::saveToFile(const QString &fileName)
|
|||
xml.setAutoFormatting(true);
|
||||
xml.writeStartDocument();
|
||||
xml.writeStartElement("cockatrice_carddatabase");
|
||||
xml.writeAttribute("version", "1");
|
||||
xml.writeAttribute("version", QString::number(versionNeeded));
|
||||
|
||||
xml.writeStartElement("sets");
|
||||
QHashIterator<QString, CardSet *> setIterator(setHash);
|
||||
|
|
|
@ -165,6 +165,7 @@ protected:
|
|||
QThread *pictureLoaderThread;
|
||||
PictureLoader *pictureLoader;
|
||||
private:
|
||||
static const int versionNeeded;
|
||||
void loadCardsFromXml(QXmlStreamReader &xml);
|
||||
void loadSetsFromXml(QXmlStreamReader &xml);
|
||||
public:
|
||||
|
|
|
@ -33,6 +33,9 @@ CardItem::~CardItem()
|
|||
{
|
||||
prepareDelete();
|
||||
|
||||
if (scene())
|
||||
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||
|
||||
delete cardMenu;
|
||||
delete ptMenu;
|
||||
delete moveMenu;
|
||||
|
|
|
@ -92,7 +92,8 @@ CardInfo *OracleImporter::addCard(const QString &setName,
|
|||
if (cardName.contains("XX"))
|
||||
cardName.remove("XX");
|
||||
cardName = cardName.replace("Æ", "AE");
|
||||
|
||||
cardName = cardName.replace("’", "'");
|
||||
|
||||
CardInfo *card;
|
||||
if (cardHash.contains(cardName)) {
|
||||
card = cardHash.value(cardName);
|
||||
|
|
Loading…
Reference in a new issue