From 24d879de227c348cc21880f047287f79accb44d1 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 30 Jan 2023 14:33:31 -0400 Subject: TObject, macros: Add `FOREACH_NODE` macros for dealing with TObject iteration Thanks to EpochFlame for suggesting this. --- src/pso/TObject.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') 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(); } -- cgit v1.2.3-13-gbd6f