]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/self.qh
Move use1 definition to util (should fix compilation test unit)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / self.qh
1 #pragma once
2
3 // Transition from global 'self' to local 'this'
4
5 // Step 1: auto oldself
6 #if 1
7     #define SELFPARAM() noref const entity this = self
8 #endif
9
10 // Step 2: const self
11 #if 1
12     #define self (0, self)
13     [[alias("self")]] entity __self;
14     #define setself(s) (__self = s)
15     #define WITHSELF(value, block) WITH(entity, __self, value, (0, block))
16 #endif
17
18 // Step 3: propagate SELFPARAM()
19 #if 1
20     #undef self
21     #define self (this, self)
22 #endif
23
24 // Step 4: kill unstructured setself
25 #if 0
26     #undef setself
27 #endif
28
29 // Step 5: this should work
30 #if 0
31     #define self (0, this)
32 #endif
33
34 // Step 6: Remove SELFPARAM in favor of a parameter