Skip to content

Commit

Permalink
entity: fix ENT_ARRAY_FOREACH macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Apr 8, 2024
1 parent f3cea8b commit 863468d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,23 +285,23 @@ INLINE void _ent_array_add_Entity(struct EntityInterface *ent, BoxedEntityArray
#define _ent_array_iterator MACROHAX_ADDLINENUM(_ent_array_iterator)
#define _ent_array_temp MACROHAX_ADDLINENUM(_ent_array_temp)

#define ENT_ARRAY_FOREACH(_array, _var, _block) do { \
#define ENT_ARRAY_FOREACH(_array, _var, ...) do { \
for(uint _ent_array_iterator = 0; _ent_array_iterator < (_array)->size; ++_ent_array_iterator) { \
void *_ent_array_temp = ENT_ARRAY_GET((_array), _ent_array_iterator); \
if(_ent_array_temp != NULL) { \
_var = _ent_array_temp; \
_block \
__VA_ARGS__ \
} \
} \
} while(0)

#define ENT_ARRAY_FOREACH_COUNTER(_array, _cntr_var, _ent_var, _block) do { \
#define ENT_ARRAY_FOREACH_COUNTER(_array, _cntr_var, _ent_var, ...) do { \
for(uint _ent_array_iterator = 0; _ent_array_iterator < (_array)->size; ++_ent_array_iterator) { \
void *_ent_array_temp = ENT_ARRAY_GET((_array), _ent_array_iterator); \
if(_ent_array_temp != NULL) { \
_cntr_var = _ent_array_iterator; \
_ent_var = _ent_array_temp; \
_block \
__VA_ARGS__ \
} \
} \
} while(0)
Expand Down

0 comments on commit 863468d

Please sign in to comment.