From f3913114894e318ec733b8e1d8c64609ffe78847 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sun, 30 Nov 2025 01:46:24 -0800 Subject: [PATCH] restore copy constructor --- .../libcockatrice/deck_list/deck_list.cpp | 6 ++++++ .../libcockatrice/deck_list/deck_list.h | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp index 30809a3d2..32321457b 100644 --- a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp @@ -87,6 +87,12 @@ DeckList::DeckList() root = new InnerDecklistNode; } +DeckList::DeckList(const DeckList &other) + : metadata(other.metadata), sideboardPlans(other.sideboardPlans), root(new InnerDecklistNode(other.getRoot())), + cachedDeckHash(other.cachedDeckHash) +{ +} + DeckList::DeckList(const QString &nativeString) { root = new InnerDecklistNode; diff --git a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h index 225e27832..e10710900 100644 --- a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.h @@ -93,7 +93,7 @@ public: * @brief Represents a complete deck, including metadata, zones, cards, * and sideboard plans. * - * A DeckList is a QObject wrapper around an `InnerDecklistNode` tree, + * A DeckList is a wrapper around an `InnerDecklistNode` tree, * enriched with metadata like deck name, comments, tags, banner card, * and multiple sideboard plans. * @@ -211,9 +211,8 @@ protected: public: /// @brief Construct an empty deck. explicit DeckList(); - /// @brief Delete copy constructor. - DeckList(const DeckList &) = delete; - DeckList &operator=(const DeckList &) = delete; + /// @brief Copy constructor (deep copies the node tree) + DeckList(const DeckList &other); /// @brief Construct from a serialized native-format string. explicit DeckList(const QString &nativeString); virtual ~DeckList();