mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 10:05:10 -07: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:
parent
733deac0bb
commit
f4d5fc181d
2 changed files with 2 additions and 2 deletions
|
|
@ -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
|
* 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).
|
* 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++) {
|
for (int i = 0; i < root->size(); i++) {
|
||||||
auto *node = dynamic_cast<InnerDecklistNode *>(root->at(i));
|
auto *node = dynamic_cast<InnerDecklistNode *>(root->at(i));
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Helpers for traversing the tree
|
// Helpers for traversing the tree
|
||||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName) const;
|
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
||||||
InnerDecklistNode *findBoardZone(const QString &boardZoneName) const;
|
InnerDecklistNode *findBoardZone(const QString &boardZoneName) const;
|
||||||
InnerDecklistNode *findOrCreateBoardZone(const QString &boardZoneName);
|
InnerDecklistNode *findOrCreateBoardZone(const QString &boardZoneName);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue