From: Mario Date: Fri, 25 Dec 2015 06:42:52 +0000 (+1000) Subject: Add a loop for entities X-Git-Tag: xonotic-v0.8.2~1385 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a137b14e153d3e27ac233c75e3c120eea37c01b8;p=xonotic%2Fxonotic-data.pk3dir.git Add a loop for entities --- 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)