summaryrefslogtreecommitdiff
path: root/include/pso/TMainTask.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-08 13:49:01 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-08 13:49:01 -0400
commit87fe4412c45be2f06883d7bb04c4e8966cf7beb2 (patch)
tree41cd98c6aa0a1a7ba0f6d09f3249bed553e95dde /include/pso/TMainTask.h
parentf1bb53df8d5a0b0cf462fb92a5358bc126309876 (diff)
TMainTask: Add, and use `X_OR_Y_CHILD` macro
Diffstat (limited to 'include/pso/TMainTask.h')
-rw-r--r--include/pso/TMainTask.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/pso/TMainTask.h b/include/pso/TMainTask.h
index e299006..c2cfbfa 100644
--- a/include/pso/TMainTask.h
+++ b/include/pso/TMainTask.h
@@ -5,20 +5,24 @@
#include "pso/macros.h"
#include "pso/TObject.h"
-#define SET_OR_CLEAR_CHILD_FLAGS(flags, old_flags, flag_bit) \
+
+#define X_OR_Y_CHILD(flags, old_flags, one_prefix, zero_prefix, suffix) \
if (flags != old_flags) { \
TMainTask *child; \
u32 bit = 1; \
FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.down, child, bit <<= 1) { \
if (main_task_flags & bit) { \
- child->set_flag_##flag_bit(); \
+ child->one_prefix##_##suffix(); \
} else { \
- child->clear_flag_##flag_bit(); \
+ child->zero_prefix##_##suffix(); \
} \
} \
old_flags = flags; \
}
+#define SET_OR_CLEAR_CHILD_FLAGS(flags, old_flags, flag_bit) \
+ X_OR_Y_CHILD(flags, old_flags, set_flag, clear_flag, flag_bit)
+
#define o(var, name) extern const char *var##_name;
TL_OBJECTS
#undef o