mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
[Refactor] Untangle card_info.cpp and split into individual files. (#6202)
* Untangle the card_info.cpp mess and split into individual files. Took 53 minutes * Auto-lint was disabled and my pre-commit hook didn't fire. Oh well. Took 3 minutes * Fix oracle. Took 35 seconds * Lint! Took 20 seconds * Fix tests. Took 3 minutes * CMakeLists.txt: The reason why I have to disable auto-lint. Took 2 minutes * dbconverter. Took 3 minutes * Oracle again. Took 3 minutes * dbconverter again. Took 3 minutes * dbconverter again again. Took 2 minutes * More fixes. Took 4 minutes Took 21 seconds * Everything needs everything. Took 3 minutes * Everything means everything. Took 4 minutes * All the tests. Took 4 minutes * I hate everything about this. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
835e4af3e4
commit
89a8d0f6b8
30 changed files with 743 additions and 516 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "card_database.h"
|
||||
|
||||
#include "../card/card_relation.h"
|
||||
#include "../picture_loader/picture_loader.h"
|
||||
#include "../settings/cache_settings.h"
|
||||
#include "parser/cockatrice_xml_3.h"
|
||||
|
|
@ -144,9 +145,9 @@ CardSetPtr CardDatabase::getSet(const QString &setName)
|
|||
}
|
||||
}
|
||||
|
||||
SetList CardDatabase::getSetList() const
|
||||
CardSetList CardDatabase::getSetList() const
|
||||
{
|
||||
SetList result;
|
||||
CardSetList result;
|
||||
for (auto set : sets.values()) {
|
||||
result << set;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef CARDDATABASE_H
|
||||
#define CARDDATABASE_H
|
||||
|
||||
#include "../card/card_set_list.h"
|
||||
#include "../card/exact_card.h"
|
||||
#include "../common/card_ref.h"
|
||||
#include "card_database_loader.h"
|
||||
|
|
@ -68,7 +69,7 @@ public:
|
|||
return cards;
|
||||
}
|
||||
CardSetPtr getSet(const QString &setName);
|
||||
SetList getSetList() const;
|
||||
CardSetList getSetList() const;
|
||||
LoadStatus getLoadStatus() const
|
||||
{
|
||||
return loadStatus;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#include "cockatrice_xml_3.h"
|
||||
|
||||
#include "../../card/card_relation.h"
|
||||
#include "../../card/card_relation_type.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
|
@ -232,7 +235,7 @@ void CockatriceXml3Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
_sets[setName].append(setInfo);
|
||||
// related cards
|
||||
} else if (xmlName == "related" || xmlName == "reverse-related") {
|
||||
CardRelation::AttachType attach = CardRelation::DoesNotAttach;
|
||||
CardRelationType attach = CardRelationType::DoesNotAttach;
|
||||
bool exclude = false;
|
||||
bool variable = false;
|
||||
int count = 1;
|
||||
|
|
@ -254,7 +257,7 @@ void CockatriceXml3Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
}
|
||||
|
||||
if (attrs.hasAttribute("attach")) {
|
||||
attach = CardRelation::AttachTo;
|
||||
attach = CardRelationType::AttachTo;
|
||||
}
|
||||
|
||||
if (attrs.hasAttribute("exclude")) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "cockatrice_xml_4.h"
|
||||
|
||||
#include "../../card/card_relation.h"
|
||||
#include "../../settings/cache_settings.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -205,7 +206,7 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
}
|
||||
// related cards
|
||||
} else if (xmlName == "related" || xmlName == "reverse-related") {
|
||||
CardRelation::AttachType attachType = CardRelation::DoesNotAttach;
|
||||
CardRelationType attachType = CardRelationType::DoesNotAttach;
|
||||
bool exclude = false;
|
||||
bool variable = false;
|
||||
bool persistent = false;
|
||||
|
|
@ -228,8 +229,8 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
}
|
||||
|
||||
if (attrs.hasAttribute("attach")) {
|
||||
attachType = attrs.value("attach").toString() == "transform" ? CardRelation::TransformInto
|
||||
: CardRelation::AttachTo;
|
||||
attachType = attrs.value("attach").toString() == "transform" ? CardRelationType::TransformInto
|
||||
: CardRelationType::AttachTo;
|
||||
}
|
||||
|
||||
if (attrs.hasAttribute("exclude")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue