[DeckList] Add maybeboard zone constant and skip it in exports

Introduce DECK_ZONE_MAYBEBOARD and its visible name, and treat the
maybeboard as editor-only scratch space: plain-text export, DeckStats
and TappedOut uploads now skip cards living there. Zones of this name
are created by later custom-zones units; until then the skips are inert.

Took 20 minutes
This commit is contained in:
Lukas Brübach 2026-08-23 21:37:40 +02:00
parent 03229db0bd
commit ef3b51f9eb
5 changed files with 10 additions and 2 deletions

View file

@ -72,7 +72,7 @@ void DeckStatsInterface::copyDeckWithoutTokens(const DeckList &source, DeckList
{ {
auto copyIfNotAToken = [&destination](const auto node, const auto card) { auto copyIfNotAToken = [&destination](const auto node, const auto card) {
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName()); CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
if (dbCard && !dbCard->getIsToken()) { if (dbCard && !dbCard->getIsToken() && node->getName() != DECK_ZONE_MAYBEBOARD) {
DecklistCardNode *addedCard = destination.addCard(card->getName(), node->getName(), -1); DecklistCardNode *addedCard = destination.addCard(card->getName(), node->getName(), -1);
addedCard->setNumber(card->getNumber()); addedCard->setNumber(card->getNumber());
} }

View file

@ -99,7 +99,7 @@ void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckLi
{ {
auto copyMainOrSide = [&mainboard, &sideboard](const auto node, const auto card) { auto copyMainOrSide = [&mainboard, &sideboard](const auto node, const auto card) {
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName()); CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
if (!dbCard || dbCard->getIsToken()) { if (!dbCard || dbCard->getIsToken() || node->getName() == DECK_ZONE_MAYBEBOARD) {
return; return;
} }

View file

@ -413,6 +413,10 @@ bool DeckList::loadFromFile_Plain(QIODevice *device, const std::function<QString
bool DeckList::saveToStream_Plain(QTextStream &stream, bool prefixSideboardCards, bool slashTappedOutSplitCards) const bool DeckList::saveToStream_Plain(QTextStream &stream, bool prefixSideboardCards, bool slashTappedOutSplitCards) const
{ {
auto writeToStream = [&stream, prefixSideboardCards, slashTappedOutSplitCards](const auto node, const auto card) { auto writeToStream = [&stream, prefixSideboardCards, slashTappedOutSplitCards](const auto node, const auto card) {
// The maybeboard is scratch space and never exported.
if (node->getName() == DECK_ZONE_MAYBEBOARD) {
return;
}
if (prefixSideboardCards && node->getName() == DECK_ZONE_SIDE) { if (prefixSideboardCards && node->getName() == DECK_ZONE_SIDE) {
stream << "SB: "; stream << "SB: ";
} }

View file

@ -28,6 +28,8 @@ QString InnerDecklistNode::visibleNameFromName(const QString &_name)
return QObject::tr("Sideboard"); return QObject::tr("Sideboard");
} else if (_name == DECK_ZONE_TOKENS) { } else if (_name == DECK_ZONE_TOKENS) {
return QObject::tr("Tokens"); return QObject::tr("Tokens");
} else if (_name == DECK_ZONE_MAYBEBOARD) {
return QObject::tr("Maybeboard");
} else { } else {
return _name; return _name;
} }

View file

@ -24,6 +24,8 @@
#define DECK_ZONE_SIDE "side" #define DECK_ZONE_SIDE "side"
/** @brief Constant for the "tokens" zone name. */ /** @brief Constant for the "tokens" zone name. */
#define DECK_ZONE_TOKENS "tokens" #define DECK_ZONE_TOKENS "tokens"
/** @brief Constant for the "maybeboard" zone name. */
#define DECK_ZONE_MAYBEBOARD "maybeboard"
/** /**
* @class InnerDecklistNode * @class InnerDecklistNode