diff options
Diffstat (limited to 'engines/titanic/core/tree_item.cpp')
-rw-r--r-- | engines/titanic/core/tree_item.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index de3d87e0d3..5fcd74bbd7 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -213,16 +213,16 @@ void CTreeItem::moveUnder(CTreeItem *newParent) { } void CTreeItem::destroyAll() { - destroyOthers(); + destroyChildren(); detach(); delete this; } -int CTreeItem::destroyOthers() { +int CTreeItem::destroyChildren() { if (!_firstChild) return 0; - CTreeItem *item = this, *child, *nextSibling; + CTreeItem *item = _firstChild, *child, *nextSibling; int total = 0; do { @@ -230,9 +230,9 @@ int CTreeItem::destroyOthers() { nextSibling = item->_nextSibling; if (child) - total += child->destroyOthers(); - child->detach(); - delete child; + total += item->destroyChildren(); + item->detach(); + delete item; ++total; } while ((item = nextSibling) != nullptr); |