diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-12 12:22:47 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-12 12:22:47 -0400 |
commit | 55d7db1ea564454629454b79925edc72b34d6d57 (patch) | |
tree | e0dd9d2b8f2f1ec68683d04975bf52b9d68ab5f3 /include | |
parent | 0d06559bcc3d60595cedcab343408589dcdb9c94 (diff) |
TObject: Add `m_` prefix to non-function members, and remove `get_` from
getter function names
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TMainTask.h | 2 | ||||
-rw-r--r-- | include/pso/TObject.h | 106 | ||||
-rw-r--r-- | include/pso/macros.h | 8 |
3 files changed, 58 insertions, 58 deletions
diff --git a/include/pso/TMainTask.h b/include/pso/TMainTask.h index 3a6e59b..3bcd6e5 100644 --- a/include/pso/TMainTask.h +++ b/include/pso/TMainTask.h @@ -10,7 +10,7 @@ if (flags != old_flags) { \ TMainTask *child; \ u32 bit = 1; \ - FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.get_down(), child, bit <<= 1) { \ + FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.down(), child, bit <<= 1) { \ if (flags & bit) { \ child->one_prefix##_##suffix(); \ } else { \ diff --git a/include/pso/TObject.h b/include/pso/TObject.h index 9af0251..e259487 100644 --- a/include/pso/TObject.h +++ b/include/pso/TObject.h @@ -45,16 +45,16 @@ static inline void operator|=(object_flags &a, object_flags b) { a = a | b; }; class TObject { private: - const char *name; + const char *m_name; union { - object_flags flags; - u16 flags_u16; + object_flags m_flags; + u16 m_flags_u16; }; - u16 id; - TObject *prev; - TObject *next; - TObject *up; - TObject *down; + u16 m_id; + TObject *m_prev; + TObject *m_next; + TObject *m_up; + TObject *m_down; public: void disallow_rendering_shadows(); void allow_rendering_shadows(); @@ -73,23 +73,23 @@ public: void *operator new (size_t size) { return alloc(size); }; void operator delete(void *ptr) { free(ptr); }; - const char *get_name() { return this->name; }; - object_flags get_flags() { return this->flags; }; - u16 get_flags_u16() { return this->flags_u16; }; - u16 get_id() { return this->id; }; - TObject *get_prev() { return this->prev; }; - TObject *get_next() { return this->next; }; - TObject *get_up() { return this->up; }; - TObject *get_down() { return this->down; }; - - void set_name(const char *name) { this->name = name; }; - void set_obj_flags(object_flags flags) { this->flags = flags; }; - void set_flags_u16(u16 flags) { flags_u16 = flags; }; - void set_id(u16 id) { this->id = id; }; - void set_prev(TObject *node) { prev = node; }; - void set_next(TObject *node) { next = node; }; - void set_up(TObject *node) { up = node; }; - void set_down(TObject *node) { down = node; }; + const char *name() { return m_name; }; + object_flags flags() { return m_flags; }; + u16 flags_u16() { return m_flags_u16; }; + u16 id() { return m_id; }; + TObject *prev() { return m_prev; }; + TObject *next() { return m_next; }; + TObject *up() { return m_up; }; + TObject *down() { return m_down; }; + + void set_name(const char *name) { m_name = name; }; + void set_obj_flags(object_flags flags) { m_flags = flags; }; + void set_flags_u16(u16 flags) { m_flags_u16 = flags; }; + void set_id(u16 id) { m_id = id; }; + void set_prev(TObject *node) { m_prev = node; }; + void set_next(TObject *node) { m_next = node; }; + void set_up(TObject *node) { m_up = node; }; + void set_down(TObject *node) { m_down = node; }; void delete_children(); void queue_destruction_for_each_node(); @@ -114,63 +114,63 @@ public: private: void _delete_children() { - while (this->down != NULL) { - delete this->down; + while (m_down != NULL) { + delete m_down; } }; void add_parent(TObject *parent, bool set_parent) { if (set_parent) { - up = parent; + m_up = parent; } TObject *child; if (parent == NULL) { - this->prev = this; - this->next = NULL; + m_prev = this; + m_next = NULL; return; } - child = parent->down; + child = parent->m_down; if (child != NULL) { - this->prev = child->next; - this->next = NULL; - child->prev->next = this; - child->prev = this; + m_prev = child->m_next; + m_next = NULL; + child->m_prev->m_next = this; + child->m_prev = this; } else { - this->prev = this; - parent->down = this; - this->next = NULL; + m_prev = this; + parent->m_down = this; + m_next = NULL; } }; void remove_parent() { - if (this->up != NULL) { - if (this->prev == this) { - this->up->down = NULL; - } else if (this->up->down == this) { - this->up->down = this->prev; - this->prev->next = NULL; - if (this->next != NULL) { - this->next->prev = this->next; + 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_prev; + m_prev->m_next = NULL; + if (m_next != NULL) { + m_next->m_prev = m_next; } } else { - this->prev->next = this->next; - if (this->next != NULL) { - this->next->prev = this->prev; + m_prev->m_next = m_next; + if (m_next != NULL) { + m_next->m_prev = m_prev; } else { - this->up->down->prev = this->prev; + m_up->m_down->m_prev = m_prev; } } } }; void set_flags(object_flags flags) { - this->flags |= flags; + m_flags |= flags; } void clear_flags(object_flags flags) { - flags_u16 &= ~static_cast<u16>(flags); + m_flags_u16 &= ~static_cast<u16>(flags); } u32 get_flags(object_flags flags) { - return this->flags & flags; + return m_flags & flags; }; }; diff --git a/include/pso/macros.h b/include/pso/macros.h index 64ce214..f10c911 100644 --- a/include/pso/macros.h +++ b/include/pso/macros.h @@ -27,10 +27,10 @@ o(tl_fade, TL_FADE) \ o(tl_fadeafter, TL_FADEAFTER) -#define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next())) -#define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next())) +#define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) +#define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) -#define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next()), __VA_ARGS__) -#define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next()), __VA_ARGS__) +#define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) +#define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) #endif |