X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Futil-pre.qh;h=b81fd2a6df81d409626458a4ba338a15273796f2;hb=5f591ed9737ba08832475c1c324f91721e76bdf7;hp=9d60ae0a9ae2797bfdaedea9632237e81554f564;hpb=60997ce6cb9acfdedb87a8aca9b4cba5aaf1c60f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index 9d60ae0a9..b81fd2a6d 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -29,27 +29,21 @@ #define itos(i) ftos(i) #endif -#ifndef QCC_SUPPORT_BOOL - #define bool float - - // Boolean Constants - const int true = 1; - const int false = 0; -#endif - -#ifndef QCC_SUPPORT_ENTITYCLASS - #define entityclass(name) typedef entity name - #define class(name) - #define new(class) spawn() -#else - #define entityclass(name) entityclass name {} - #define class(name) [[class(name)]] - #define new(class) ((class) spawn()) -#endif - -// Transitional aliases -[[deprecated("use true")]] [[alias("true")]] const bool TRUE; -[[deprecated("use false")]] [[alias("false")]] const bool FALSE; +#define FOREACH_ARRAY(arr, start, end, cond, body) do { \ + for (int i = start; i < end; ++i) { \ + const noref entity it = arr[i]; \ + if (cond) { body } \ + } \ +} while(0) + +#define FOREACH_LIST(list, next, cond, body) do { \ + noref int i = 0; \ + for (entity it = list##_first; it; (it = it.next, ++i)) { \ + if (cond) { body } \ + } \ +} while(0) + +#define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body) #ifdef GMQCC #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)