]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a loop for entities
authorMario <mario@smbclan.net>
Fri, 25 Dec 2015 06:42:52 +0000 (16:42 +1000)
committerMario <mario@smbclan.net>
Fri, 25 Dec 2015 06:42:52 +0000 (16:42 +1000)
qcsrc/lib/iter.qh

index 223522504c1a4b65edad2cb0dca4f9d71f0901a2..d86d77c460a48d096281b4a64f1c356cc9255dbc 100644 (file)
                } \
        } 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)