From a717e715b64ff0ede4e5e085bab4f282c4bfd773 Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:54:15 +0100 Subject: [PATCH] Introduce null checks, add setShortName and collectorNumber to deckList export. (#5471) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce null checks, add setShortName and collectorNumber to deckList export. * Lint. * Lint again. * Lint AGAIN. --------- Co-authored-by: Lukas BrĂ¼bach --- cockatrice/src/deck/deck_loader.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/deck/deck_loader.cpp b/cockatrice/src/deck/deck_loader.cpp index 155f8c038..0543020a4 100644 --- a/cockatrice/src/deck/deck_loader.cpp +++ b/cockatrice/src/deck/deck_loader.cpp @@ -254,6 +254,14 @@ struct FormatDeckListForExport mainBoardCards += QString::number(card->getNumber()); mainBoardCards += "%20"; mainBoardCards += card->getName(); + if (!card->getCardSetShortName().isNull()) { + mainBoardCards += "%20"; + mainBoardCards += "(" + card->getCardSetShortName() + ")"; + } + if (!card->getCardCollectorNumber().isNull()) { + mainBoardCards += "%20"; + mainBoardCards += card->getCardCollectorNumber(); + } mainBoardCards += "%0A"; } } @@ -419,7 +427,20 @@ void DeckLoader::saveToStream_DeckZoneCards(QTextStream &out, out << "SB: "; } - out << card->getNumber() << " " << card->getName() << "\n"; + if (card->getNumber()) { + out << card->getNumber(); + } + if (!card->getName().isNull() && !card->getName().isEmpty()) { + out << " " << card->getName(); + } + if (!card->getCardSetShortName().isNull() && !card->getCardSetShortName().isEmpty()) { + out << " " + << "(" << card->getCardSetShortName() << ")"; + } + if (!card->getCardCollectorNumber().isNull()) { + out << " " << card->getCardCollectorNumber(); + } + out << "\n"; } }