mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 12:03:25 -08:00
[CardDB] Drop the rebalanced-cards setting entirely (#7457)
* [CardDB] Drop rebalanced-card filtering from the v4 parser Rebalanced cards no longer exist, so the includeRebalancedCards preference has no data to filter. Always keep printings marked isRebalanced and remove the now-unused ICardPreferenceProvider plumbing from CockatriceXml4Parser and CardDatabaseLoader. The setting itself (CardsDisplaySettings, Manage Sets checkbox, Oracle attribute mapping) is removed in a follow-up. * [CardDB] Drop the rebalanced-cards setting entirely Rebalanced Alchemy cards no longer exist, so remove the includeRebalancedCards preference surface: the CardsDisplaySettings getter/setter/signal, the ICardPreferenceProvider and ICardsDisplaySettingsProvider methods, the Manage Sets checkbox, the legacy settings migration mapping, the isRebalanced attribute mapping in the Oracle importer, and the isRebalanced attribute in the v4 schema. Builds on #7448, which already stopped the v4 parser from filtering on the preference. * [CardDB] Drop the unused isOnlineOnly printing property The Arena-card detection switched from isOnlineOnly to isRebalanced in #5778, so nothing has read this printing property since; it only round-trips from the Oracle importer into cards.xml. Remove the importer mapping, the benchmark fixture field and the v4 schema attribute so regenerated databases stop carrying it. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
d0fc27e3a8
commit
95f02ac0a1
19 changed files with 17 additions and 95 deletions
|
|
@ -33,7 +33,7 @@ CardDatabase::CardDatabase(QObject *parent,
|
|||
qRegisterMetaType<CardDatabaseData>("CardDatabaseData");
|
||||
|
||||
// create loader and wire it up
|
||||
loader = new CardDatabaseLoader(this, this, pathProvider, prefs, setPriorityController);
|
||||
loader = new CardDatabaseLoader(this, this, pathProvider, setPriorityController);
|
||||
// re-emit loader signals (so other code doesn't need to know about internals)
|
||||
connect(loader, &CardDatabaseLoader::loadingFinished, this, &CardDatabase::cardDatabaseLoadingFinished);
|
||||
connect(loader, &CardDatabaseLoader::loadingFailed, this, &CardDatabase::cardDatabaseLoadingFailed);
|
||||
|
|
|
|||
|
|
@ -33,12 +33,11 @@ class ICardSetPriorityController;
|
|||
CardDatabaseLoader::CardDatabaseLoader(QObject *parent,
|
||||
CardDatabase *db,
|
||||
ICardDatabasePathProvider *_pathProvider,
|
||||
ICardPreferenceProvider *_preferenceProvider,
|
||||
ICardSetPriorityController *_priorityController)
|
||||
: QObject(parent), database(db), pathProvider(_pathProvider), priorityController(_priorityController)
|
||||
{
|
||||
// instantiate available parsers here
|
||||
availableParsers << new CockatriceXml4Parser(_preferenceProvider, _priorityController);
|
||||
availableParsers << new CockatriceXml4Parser(_priorityController);
|
||||
availableParsers << new CockatriceXml3Parser(_priorityController);
|
||||
|
||||
// The load path parses into a snapshot and never emits per-card signals;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <qtmetamacros.h>
|
||||
|
||||
class ICardDatabasePathProvider;
|
||||
class ICardPreferenceProvider;
|
||||
class ICardSetPriorityController;
|
||||
|
||||
// IWYU pragma: keep
|
||||
|
|
@ -59,12 +58,10 @@ public:
|
|||
* @param parent QObject parent.
|
||||
* @param db Pointer to the CardDatabase to populate (non-owning).
|
||||
* @param pathProvider Provider for card database file paths.
|
||||
* @param preferenceProvider Optional card preference provider for pinned printings.
|
||||
*/
|
||||
explicit CardDatabaseLoader(QObject *parent,
|
||||
CardDatabase *db,
|
||||
ICardDatabasePathProvider *pathProvider,
|
||||
ICardPreferenceProvider *preferenceProvider,
|
||||
ICardSetPriorityController *_priorityController);
|
||||
|
||||
/** @brief Destructor cleans up allocated parsers. */
|
||||
|
|
|
|||
|
|
@ -37,9 +37,8 @@ class ICardSetPriorityController;
|
|||
#define COCKATRICE_XML4_SCHEMALOCATION \
|
||||
"https://raw.githubusercontent.com/Cockatrice/Cockatrice/master/doc/carddatabase_v4/cards.xsd"
|
||||
|
||||
CockatriceXml4Parser::CockatriceXml4Parser(ICardPreferenceProvider *_cardPreferenceProvider,
|
||||
ICardSetPriorityController *_cardSetPriorityController)
|
||||
: ICardDatabaseParser(_cardSetPriorityController), cardPreferenceProvider(_cardPreferenceProvider)
|
||||
CockatriceXml4Parser::CockatriceXml4Parser(ICardSetPriorityController *_cardSetPriorityController)
|
||||
: ICardDatabaseParser(_cardSetPriorityController)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +283,6 @@ QHash<QString, QString> CockatriceXml4Parser::loadCardPropertiesFromXml(QXmlStre
|
|||
|
||||
void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
||||
{
|
||||
bool includeRebalancedCards = cardPreferenceProvider->getIncludeRebalancedCards();
|
||||
while (!xml.atEnd()) {
|
||||
if (xml.readNext() == QXmlStreamReader::EndElement) {
|
||||
break;
|
||||
|
|
@ -386,17 +384,7 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
|
|||
printingProps.insert(attrName, attr.value().toString());
|
||||
}
|
||||
PrintingInfo printingInfo(set, LazyPropertiesHash(printingProps));
|
||||
|
||||
// This is very much a hack and not the right place to
|
||||
// put this check, as it requires a reload of Cockatrice
|
||||
// to be apply.
|
||||
//
|
||||
// However, this is also true of the `set->getEnabled()`
|
||||
// check above (which is currently bugged as well), so
|
||||
// we'll fix both at the same time.
|
||||
if (includeRebalancedCards || printingInfo.getProperty("isRebalanced") != "true") {
|
||||
_sets[setName].append(printingInfo);
|
||||
}
|
||||
_sets[setName].append(printingInfo);
|
||||
}
|
||||
// related cards
|
||||
} else if (xmlName == "related" || xmlName == "reverse-related") {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <QString>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class ICardPreferenceProvider;
|
||||
class ICardSetPriorityController;
|
||||
class QXmlStreamReader;
|
||||
|
||||
|
|
@ -27,7 +26,6 @@ inline Q_LOGGING_CATEGORY(CockatriceXml4Log, "cockatrice_xml.xml_4_parser");
|
|||
* @note Differences from v3:
|
||||
* - Card properties are stored in <prop> blocks as a QHash<QString, QString>.
|
||||
* - Sets can include a <priority> element.
|
||||
* - Supports user preferences via ICardPreferenceProvider (e.g., skipping rebalanced cards).
|
||||
* - Related cards support persistent relations and multiple attach types (e.g., transform).
|
||||
* - More robust serialization; easier to extend schema in the future.
|
||||
*/
|
||||
|
|
@ -35,8 +33,7 @@ class CockatriceXml4Parser : public ICardDatabaseParser
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CockatriceXml4Parser(ICardPreferenceProvider *cardPreferenceProvider,
|
||||
ICardSetPriorityController *cardSetPriorityController);
|
||||
explicit CockatriceXml4Parser(ICardSetPriorityController *cardSetPriorityController);
|
||||
~CockatriceXml4Parser() override = default;
|
||||
|
||||
/**
|
||||
|
|
@ -71,8 +68,6 @@ public:
|
|||
const QString &sourceVersion = "unknown") override;
|
||||
|
||||
private:
|
||||
ICardPreferenceProvider *cardPreferenceProvider; ///< Interface to handle user preferences
|
||||
|
||||
/**
|
||||
* @brief Loads a generic <prop> block from a <card> element.
|
||||
* @param xml The open QXmlStreamReader positioned at a <prop> element.
|
||||
|
|
@ -83,7 +78,6 @@ private:
|
|||
/**
|
||||
* @brief Load all <card> elements from the XML stream.
|
||||
* @param xml The open QXmlStreamReader positioned at the <cards> element.
|
||||
* Honors the user's preference regarding rebalanced cards.
|
||||
*/
|
||||
void loadCardsFromXml(QXmlStreamReader &xml);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue