Add to GameObj::removeChildrenFromObjList()

This commit is contained in:
KeybadeBlox 2026-02-05 21:11:11 -05:00
parent 35c8844529
commit e668b52cd0
2 changed files with 6 additions and 1 deletions

View file

@ -184,7 +184,13 @@ void GameObj::removeFromObjList(GameObj * obj) {
void GameObj::removeChildrenFromObjList(GameObj * firstChild) { void GameObj::removeChildrenFromObjList(GameObj * firstChild) {
if (firstChild != NULL) do { if (firstChild != NULL) do {
if (firstChild->flags > -1) { if (firstChild->flags > -1) {
firstChild->flags = GameObjFlags(firstChild->flags | GOF_DELETEAFTEREXEC);
g_game->removeFromDrawList(firstChild);
g_game->unsetObj(firstChild->index);
} }
this->removeChildrenFromObjList(firstChild->firstChild);
firstChild = firstChild->nextSibling;
} while (firstChild != NULL); } while (firstChild != NULL);
} }

View file

@ -139,7 +139,6 @@ struct GameObj {
void removeFromObjList (GameObj * obj); void removeFromObjList (GameObj * obj);
void removeChildrenFromObjList(GameObj * firstChild); void removeChildrenFromObjList(GameObj * firstChild);
// Each frame, one of these trios of methods is called depending on // Each frame, one of these trios of methods is called depending on
// which state the game is in // which state the game is in
// Default implementation of each does nothing; inheriting objects // Default implementation of each does nothing; inheriting objects