]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/iter.qh
Add a loop for entities
[xonotic/xonotic-data.pk3dir.git] / 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)