summaryrefslogtreecommitdiff
path: root/src/nw4r/g3d/g3d_obj.cpp
blob: f24e0a4d296e32e1d415d35b34001ba1b983bb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "nw4r/g3d.h" // IWYU pragma: export

namespace nw4r {
namespace g3d {

NW4R_G3D_RTTI_DEF(G3dObj);

G3dObj::~G3dObj() {
    Dealloc(mpHeap, this);
}

void G3dObj::Destroy() {
    G3dObj *pParent = GetParent();

    if (pParent != NULL) {
        pParent->G3dProc(G3DPROC_CHILD_DETACHED, 0, this);
    }

    delete this;
}

G3dObj *G3dObj::DetachFromParent() {
    G3dObj *pParent = GetParent();

    if (pParent != NULL) {
        pParent->G3dProc(G3DPROC_CHILD_DETACHED, 0, this);
    }

    return pParent;
}

} // namespace g3d
} // namespace nw4r