mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-15 15:01:42 +00:00
Make ZCC_TreeNode::AppendSibling() work with lists
- Previously, you could only append lone nodes to ZCC_TreeNode lists. Now you can append one list to another.
This commit is contained in:
parent
2ab3974752
commit
d5fa550118
1 changed files with 7 additions and 5 deletions
|
@ -211,17 +211,19 @@ struct ZCC_TreeNode
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The new sibling node should only be in a list with itself.
|
|
||||||
assert(sibling->SiblingNext == sibling && sibling->SiblingPrev == sibling);
|
|
||||||
|
|
||||||
// Check integrity of our sibling list.
|
// Check integrity of our sibling list.
|
||||||
assert(SiblingPrev->SiblingNext == this);
|
assert(SiblingPrev->SiblingNext == this);
|
||||||
assert(SiblingNext->SiblingPrev == this);
|
assert(SiblingNext->SiblingPrev == this);
|
||||||
|
|
||||||
|
// Check integrity of new sibling list.
|
||||||
|
assert(sibling->SiblingPrev->SiblingNext = sibling);
|
||||||
|
assert(sibling->SiblingNext->SiblingPrev = sibling);
|
||||||
|
|
||||||
|
ZCC_TreeNode *siblingend = sibling->SiblingPrev;
|
||||||
SiblingPrev->SiblingNext = sibling;
|
SiblingPrev->SiblingNext = sibling;
|
||||||
sibling->SiblingPrev = SiblingPrev;
|
sibling->SiblingPrev = SiblingPrev;
|
||||||
SiblingPrev = sibling;
|
SiblingPrev = siblingend;
|
||||||
sibling->SiblingNext = this;
|
siblingend->SiblingNext = this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue