diff options
Diffstat (limited to 'engines/titanic/true_talk/tt_node.cpp')
-rw-r--r-- | engines/titanic/true_talk/tt_node.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index 8b175a0906..22695ad379 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -46,6 +46,18 @@ void TTnode::detach() { _nextP->_priorP = _priorP; } +void TTnode::deleteSiblings() { + // Detach current node from prior one, if there is one + if (_priorP) + _priorP->_nextP = nullptr; + + // Iterate through the linked chain of nodes, deleting each in turn + for (TTnode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { + nextP = curP->_nextP; + delete curP; + } +} + TTnode *TTnode::getTail() { if (_nextP == nullptr) return this; |