From 178b2d1033c29337f77e1a8602b664afb13ed3b2 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 12 Feb 2023 13:27:22 -0400 Subject: TObject: Move private functions to the top --- context.h | 122 +++++++++++++++++++++++++------------------------- include/pso/TObject.h | 122 +++++++++++++++++++++++++------------------------- 2 files changed, 122 insertions(+), 122 deletions(-) diff --git a/context.h b/context.h index 24a211d..8b00bac 100644 --- a/context.h +++ b/context.h @@ -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(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(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(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(flags); - } - - u32 get_flags(object_flags flags) { - return m_flags & flags; - }; }; #endif -- cgit v1.2.3-13-gbd6f