Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
accumulate.qh
Go to the documentation of this file.
1#pragma once
2
3#ifdef QCC_SUPPORT_ACCUMULATE
4 #define ACCUMULATE_FUNCTION(func, otherfunc) \
5 ACCUMULATE void func() \
6 { \
7 otherfunc(); \
8 }
9 #define CALL_ACCUMULATED_FUNCTION(func) \
10 func()
11#else
12 #ifdef HAVE_YO_DAWG_CPP
13// YO DAWG!
14// I HERD YO LIEK MACROS
15// SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
16// SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
17 #define ACCUMULATE_FUNCTION(func, otherfunc) \
18 #ifdef func \
19 void __merge__##otherfunc() \
20 { \
21 func(); otherfunc(); \
22 } \
23 #undef func \
24 #define func __merge__##otherfunc \
25 #else \
26 #define func otherfunc \
27 #endif
28 #define CALL_ACCUMULATED_FUNCTION(func) \
29 func()
30 #else
31 #define ACCUMULATE_FUNCTION(func, otherfunc) \
32 .float _ACCUMULATE_##func##__##otherfunc;
33 void ACCUMULATE_call(string func)
34 {
35 int n = numentityfields();
36 string name, funcprefix = strcat("_ACCUMULATE_", func, "__");
37 float funcprefixlen = strlen(funcprefix);
38 for (int i = 0; i < n; ++i)
39 {
40 name = entityfieldname(i);
41 if (substring(name, 0, funcprefixlen) == funcprefix)
42 callfunction(substring(name, funcprefixlen, -1));
43 }
44 }
45 #define CALL_ACCUMULATED_FUNCTION(func) \
46 ACCUMULATE_call( #func)
47 #endif
48#endif
49
50// used for simplifying ACCUMULATE_FUNCTIONs
51#define SET_FIRST_OR_LAST(input, first, count) \
52 if (!input) \
53 input = first + count;
54#define SET_FIELD_COUNT(field, first, count) \
55 if (!field) \
56 { \
57 field = first + count; \
58 ++count; \
59 }
60#define CHECK_MAX_COUNT(name, max, count, type) \
61 if (count > max) \
62 error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n"));
void ACCUMULATE_call(string func)
Definition accumulate.qh:33
#define strlen
string name
Definition menu.qh:30
string substring(string s, float start, float length)
void callfunction(...)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))