mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 03:10:22 +00:00
TITANIC: Fix destroying previous game project when loading savegame
This commit is contained in:
parent
1102203396
commit
543434aa78
@ -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);
|
||||
|
||||
|
@ -233,9 +233,10 @@ public:
|
||||
void destroyAll();
|
||||
|
||||
/**
|
||||
* Destroys all tree items around the given one
|
||||
* Destroys all child tree items under this one.
|
||||
* @returns Total number of tree items recursively removed
|
||||
*/
|
||||
int destroyOthers();
|
||||
int destroyChildren();
|
||||
|
||||
/**
|
||||
* Detach the tree item from any other associated tree items
|
||||
|
Loading…
Reference in New Issue
Block a user