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