summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/pso/TObject.h122
1 files changed, 61 insertions, 61 deletions
diff --git a/include/pso/TObject.h b/include/pso/TObject.h
index 797218c..f399d7b 100644
--- a/include/pso/TObject.h
+++ b/include/pso/TObject.h
@@ -45,6 +45,67 @@ static inline void operator|=(object_flags &a, object_flags b) { a = a | b; };
class TObject {
private:
+ void _delete_children() {
+ while (m_down != NULL) {
+ delete m_down;
+ }
+ };
+ void add_parent(TObject *parent, bool set_parent) {
+ if (set_parent) {
+ m_up = parent;
+ }
+ TObject *child;
+ if (parent == NULL) {
+ m_prev = this;
+ m_next = NULL;
+ return;
+ }
+ child = parent->m_down;
+ if (child != NULL) {
+ m_prev = child->m_next;
+ m_next = NULL;
+ child->m_prev->m_next = this;
+ child->m_prev = this;
+ } else {
+ m_prev = this;
+ parent->m_down = this;
+ m_next = NULL;
+ }
+ };
+ void remove_parent() {
+ if (m_up != NULL) {
+ if (m_prev == this) {
+ m_up->m_down = NULL;
+ } else if (m_up->m_down == this) {
+ m_up->m_down = m_next;
+ m_prev->m_next = NULL;
+ if (m_next != NULL) {
+ m_next->m_prev = m_prev;
+ }
+ } else {
+ m_prev->m_next = m_next;
+ if (m_next != NULL) {
+ m_next->m_prev = m_prev;
+ } else {
+ m_up->m_down->m_prev = m_prev;
+ }
+ }
+ }
+ };
+
+ void set_flags(object_flags flags) {
+ m_flags |= flags;
+ }
+
+ void clear_flags(object_flags flags) {
+ m_flags_u16 &= ~static_cast<u16>(flags);
+ }
+
+ u32 get_flags(object_flags flags) {
+ return m_flags & flags;
+ };
+
+
const char *m_name;
union {
object_flags m_flags;
@@ -111,67 +172,6 @@ public:
static void *alloc(size_t size);
static void free(void *ptr);
bool toggle_flag_9_if_flag_10_is_clear();
-
-private:
- void _delete_children() {
- while (m_down != NULL) {
- delete m_down;
- }
- };
- void add_parent(TObject *parent, bool set_parent) {
- if (set_parent) {
- m_up = parent;
- }
- TObject *child;
- if (parent == NULL) {
- m_prev = this;
- m_next = NULL;
- return;
- }
- child = parent->m_down;
- if (child != NULL) {
- m_prev = child->m_next;
- m_next = NULL;
- child->m_prev->m_next = this;
- child->m_prev = this;
- } else {
- m_prev = this;
- parent->m_down = this;
- m_next = NULL;
- }
- };
- void remove_parent() {
- if (m_up != NULL) {
- if (m_prev == this) {
- m_up->m_down = NULL;
- } else if (m_up->m_down == this) {
- m_up->m_down = m_next;
- m_prev->m_next = NULL;
- if (m_next != NULL) {
- m_next->m_prev = m_prev;
- }
- } else {
- m_prev->m_next = m_next;
- if (m_next != NULL) {
- m_next->m_prev = m_prev;
- } else {
- m_up->m_down->m_prev = m_prev;
- }
- }
- }
- };
-
- void set_flags(object_flags flags) {
- m_flags |= flags;
- }
-
- void clear_flags(object_flags flags) {
- m_flags_u16 &= ~static_cast<u16>(flags);
- }
-
- u32 get_flags(object_flags flags) {
- return m_flags & flags;
- };
};
#endif