From a137b14e153d3e27ac233c75e3c120eea37c01b8 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 25 Dec 2015 16:42:52 +1000 Subject: [PATCH] Add a loop for entities --- qcsrc/lib/iter.qh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qcsrc/lib/iter.qh b/qcsrc/lib/iter.qh index 223522504..d86d77c46 100644 --- a/qcsrc/lib/iter.qh +++ b/qcsrc/lib/iter.qh @@ -121,6 +121,16 @@ } \ } MACRO_END +#define FOREACH_ENTITY_ENT(fld, match, body) \ + do { \ + int i = 0; \ + for (entity it = findchainentity_tofield(fld, match, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \ + { \ + body \ + } \ + } \ + while (0) + #define FOREACH_ENTITY(cond, body) FOREACH_ENTITY_UNORDERED(cond, body) #define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body) -- 2.39.2