4 #define FOREACH_ARRAY(arr, start, end, cond, body) \
7 for (int i = start; i < end; ++i) \
9 const noref entity it = arr[i]; \
14 #define FOREACH_LIST(list, next, cond, body) \
18 for (entity it = list##_first; it; (it = it.next, ++i)) \
24 #define FOREACH_WORD(words, cond, body) \
27 string _words = words; \
29 for (string _it; (_it = car(_words)); (_words = cdr(_words), ++i)) \
31 const noref string it = _it; \
37 entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
38 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #403;
39 entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
41 entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
42 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #403;
43 entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
45 entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #26;
46 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #27;
47 entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #88;
50 .entity _FOREACH_ENTITY_fld;
51 .entity _FOREACH_ENTITY_next;
53 #define FOREACH_ENTITY_UNORDERED(cond, body) \
56 for (entity it = findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
62 #define FOREACH_ENTITY_ORDERED(cond, body) \
65 for (entity it = NULL; (it = nextent(it)); ++i) \
71 #define FOREACH_ENTITY_FLAGS(fld, flags, body) \
74 for (entity it = _findchainflags_tofield(fld, flags, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
80 #define FOREACH_ENTITY_CLASS(class, cond, body) \
83 for (entity it = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
89 #define FOREACH_ENTITY(cond, body) FOREACH_ENTITY_UNORDERED(cond, body)
91 #define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body)