]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/functional.qh
Optimize vehicle impact code by only calling vlen() if damage would be taken
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / functional.qh
1 #pragma once
2
3 #define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__))
4 #define MAP_2(f, it) f(it)
5 #define MAP_3(f, it, ...) f(it) MAP_2(f, __VA_ARGS__)
6 #define MAP_4(f, it, ...) f(it) MAP_3(f, __VA_ARGS__)
7 #define MAP_5(f, it, ...) f(it) MAP_4(f, __VA_ARGS__)
8 #define MAP_6(f, it, ...) f(it) MAP_5(f, __VA_ARGS__)
9 #define MAP_7(f, it, ...) f(it) MAP_6(f, __VA_ARGS__)
10 #define MAP_8(f, it, ...) f(it) MAP_7(f, __VA_ARGS__)
11 #define MAP_9(f, it, ...) f(it) MAP_8(f, __VA_ARGS__)
12 #define MAP_10(f, it, ...) f(it) MAP_9(f, __VA_ARGS__)
13 #define MAP_11(f, it, ...) f(it) MAP_10(f, __VA_ARGS__)
14 #define MAP_12(f, it, ...) f(it) MAP_11(f, __VA_ARGS__)
15 #define MAP_13(f, it, ...) f(it) MAP_12(f, __VA_ARGS__)
16 #define MAP_14(f, it, ...) f(it) MAP_13(f, __VA_ARGS__)
17 #define MAP_15(f, it, ...) f(it) MAP_14(f, __VA_ARGS__)
18 #define MAP_16(f, it, ...) f(it) MAP_15(f, __VA_ARGS__)
19 #define MAP_17(f, it, ...) f(it) MAP_16(f, __VA_ARGS__)
20 #define MAP_18(f, it, ...) f(it) MAP_17(f, __VA_ARGS__)
21 #define MAP_19(f, it, ...) f(it) MAP_18(f, __VA_ARGS__)
22 #define MAP_20(f, it, ...) f(it) MAP_19(f, __VA_ARGS__)
23
24 #define IDENTITY(it) it
25
26 #define UNWORDS(...) MAP(IDENTITY, __VA_ARGS__)
27
28 #define APPLY(f, ...) f(__VA_ARGS__)
29
30 #ifdef SVQC
31         #define SV(f, ...) f(__VA_ARGS__)
32 #else
33         #define SV(f, ...)
34 #endif
35
36 #ifdef CSQC
37         #define CL(f, ...) f(__VA_ARGS__)
38 #else
39         #define CL(f, ...)
40 #endif
41
42 #define IF(cond, f, ...) cond(f, __VA_ARGS__)