diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-12 13:27:22 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-12 13:27:22 -0400 |
commit | 178b2d1033c29337f77e1a8602b664afb13ed3b2 (patch) | |
tree | 0ea723427a54b0e3d44e1e45954876b95abfa957 | |
parent | eee869308a52fccb12fd02eba47fcaa5494d9bea (diff) |
TObject: Move private functions to the top
-rw-r--r-- | context.h | 122 | ||||
-rw-r--r-- | include/pso/TObject.h | 122 |
2 files changed, 122 insertions, 122 deletions
@@ -193,6 +193,67 @@ public: 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; @@ -259,67 +320,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; - }; }; class TMainTask : public TObject { 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 |