diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-30 14:33:31 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-30 14:33:31 -0400 |
commit | 24d879de227c348cc21880f047287f79accb44d1 (patch) | |
tree | e18f9d830a279fcec2e4039449af4583c31065ac /src/pso | |
parent | 2b94b732c9e71a5884de4729ca50d9a8eda42049 (diff) |
TObject, macros: Add `FOREACH_NODE` macros for dealing with TObject
iteration
Thanks to EpochFlame for suggesting this.
Diffstat (limited to 'src/pso')
-rw-r--r-- | src/pso/TObject.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pso/TObject.cpp b/src/pso/TObject.cpp index 012b62f..cd4403f 100644 --- a/src/pso/TObject.cpp +++ b/src/pso/TObject.cpp @@ -45,7 +45,7 @@ int TObject::get_node_count() { // NOTE: The order of the variable declarations matter for matching. TObject *child; int node_count = 0; - for (child = this->down; child != NULL; child = child->next) { + FOREACH_NODE_NO_DECL(TObject, this->down, child) { node_count += child->get_node_count() + 1; } return node_count; @@ -81,7 +81,7 @@ void TObject::empty_func() { } void TObject::call_func_0x10_for_each_node2() { - for (TObject *child = this->down; child != NULL; child = child->next) { + FOREACH_NODE(TObject, this->down, child) { if (child->get_flags(0x200)) { child->func_0x10(); child->clear_flag_9(); @@ -91,7 +91,7 @@ void TObject::call_func_0x10_for_each_node2() { } void TObject::call_func_0x14_for_each_node() { - for (TObject *child = this->down; child != NULL; child = child->next) { + FOREACH_NODE(TObject, this->down, child) { if (!child->get_flags(0x100)) { child->func_0x14(); child->call_func_0x14_for_each_node(); @@ -100,7 +100,7 @@ void TObject::call_func_0x14_for_each_node() { } void TObject::call_func_0x10_for_each_node() { - for (TObject *child = this->down; child != NULL; child = child->next) { + FOREACH_NODE(TObject, this->down, child) { if (!child->get_flags(0x10)) { child->func_0x10(); child->call_func_0x10_for_each_node(); @@ -140,7 +140,7 @@ void TObject::run_tasks() { } void TObject::set_flag_0_for_each_node() { - for (TObject *child = this->down; child != NULL; child = child->next) { + FOREACH_NODE(TObject, this->down, child) { child->set_flag_0(); child->set_flag_0_for_each_node(); } |