mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-26 19:09:10 -05:00
[DeckList] Drop const from zone lookup that creates nodes (#7304)
DecklistNodeTree::getZoneObjFromName creates a new zone node when the name is unknown, so declaring it const was a lie that let a const DecklistNodeTree mutate its tree. It is only called from mutating paths (addCard, readZoneElement), so the const qualifier is removed. Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -197,7 +197,7 @@ void DecklistNodeTree::forEachCard(const std::function<void(InnerDecklistNode *,
|
||||
* Top-level zones take precedence, then deck-unique custom zones nested under boards
|
||||
* are resolved. Unknown names create a new top-level zone (legacy behavior).
|
||||
*/
|
||||
InnerDecklistNode *DecklistNodeTree::getZoneObjFromName(const QString &zoneName) const
|
||||
InnerDecklistNode *DecklistNodeTree::getZoneObjFromName(const QString &zoneName)
|
||||
{
|
||||
for (int i = 0; i < root->size(); i++) {
|
||||
auto *node = dynamic_cast<InnerDecklistNode *>(root->at(i));
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
|
||||
private:
|
||||
// Helpers for traversing the tree
|
||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName) const;
|
||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
||||
InnerDecklistNode *findBoardZone(const QString &boardZoneName) const;
|
||||
InnerDecklistNode *findOrCreateBoardZone(const QString &boardZoneName);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user