5 #define COMPAT_NO_MOD_IS_XONOTIC
8 #ifndef QCC_SUPPORT_ACCUMULATE
10 #define QCC_SUPPORT_ACCUMULATE
14 #ifndef QCC_SUPPORT_NIL
16 #define QCC_SUPPORT_NIL
20 #ifndef QCC_SUPPORT_INT
23 #define stoi(s) stof(s)
24 #define stob(s) stof(s)
25 #define itos(i) ftos(i)
27 #define stoi(s) ((int) stof(s))
28 #define stob(s) ((bool) stof(s))
29 #define itos(i) ftos(i)
32 #ifndef QCC_SUPPORT_BOOL
40 #ifndef QCC_SUPPORT_ENTITYCLASS
41 #define entityclass(name) typedef entity name
43 #define new(class) spawn()
45 #define entityclass(name) entityclass name {}
46 #define class(name) [[class(name)]]
47 #define new(class) ((class) spawn())
50 // Transitional aliases
51 [[deprecated("use true")]] [[alias("true")]] const bool TRUE;
52 [[deprecated("use false")]] [[alias("false")]] const bool FALSE;
54 #define FOREACH(arr, start, end, cond, body) do { \
55 for (int i = start; i < end; ++i) { \
56 const noref entity it = arr[i]; \
62 #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
64 #define OVERLOAD_(F,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
65 #define OVERLOAD(F, ...) OVERLOAD_(F,__VA_ARGS__,9,8,7,6,5,4,3,2,1)(__VA_ARGS__)
68 #define LAMBDA(...) { __VA_ARGS__ ; }
70 #define MAP(f, ...) OVERLOAD(MAP, f, __VA_ARGS__)
71 #define MAP_2(f, it) f(it)
72 #define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__)
73 #define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__)
74 #define MAP_5(f, it, ...) f(it)MAP_4(f, __VA_ARGS__)
75 #define MAP_6(f, it, ...) f(it)MAP_5(f, __VA_ARGS__)
76 #define MAP_7(f, it, ...) f(it)MAP_6(f, __VA_ARGS__)
77 #define MAP_8(f, it, ...) f(it)MAP_7(f, __VA_ARGS__)
78 #define MAP_9(f, it, ...) f(it)MAP_8(f, __VA_ARGS__)
79 #define MAP_10(f, it, ...) f(it)MAP_9(f, __VA_ARGS__)
80 #define MAP_11(f, it, ...) f(it)MAP_10(f, __VA_ARGS__)
81 #define MAP_12(f, it, ...) f(it)MAP_11(f, __VA_ARGS__)
82 #define MAP_13(f, it, ...) f(it)MAP_12(f, __VA_ARGS__)
83 #define MAP_14(f, it, ...) f(it)MAP_13(f, __VA_ARGS__)
84 #define MAP_15(f, it, ...) f(it)MAP_14(f, __VA_ARGS__)
85 #define MAP_16(f, it, ...) f(it)MAP_15(f, __VA_ARGS__)
86 #define MAP_17(f, it, ...) f(it)MAP_16(f, __VA_ARGS__)
87 #define MAP_18(f, it, ...) f(it)MAP_17(f, __VA_ARGS__)
88 #define MAP_19(f, it, ...) f(it)MAP_18(f, __VA_ARGS__)
89 #define MAP_20(f, it, ...) f(it)MAP_19(f, __VA_ARGS__)
91 #define IDENTITY(it) it
93 #define UNWORDS(...) MAP(IDENTITY, __VA_ARGS__)
95 #define APPLY(f, ...) f(__VA_ARGS__)
98 #define SV(f, ...) f(__VA_ARGS__)
104 #define CL(f, ...) f(__VA_ARGS__)
109 #define IF(cond, f, ...) cond(f, __VA_ARGS__)
111 #define GET(name) name##get
112 #define GETTER(type, name) type GET(name)() { return name; }
114 #define BIT(n) (1 << (n))
115 #ifndef BRANCHLESS_BITSET
116 #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) &~ (mask))
118 #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask))