3 // Transition from global 'self' to local 'this'
5 // Step 1: auto oldself
7 #define SELFPARAM() noref const entity this = self
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))
18 // Step 3: propagate SELFPARAM()
21 #define self (this, self)
24 // Step 4: kill unstructured setself
29 // Step 5: this should work
31 #define self (0, this)
34 // Step 6: Remove SELFPARAM in favor of a parameter
36 .void(entity this) selftouch;
37 void touch_self() { SELFPARAM(); this.selftouch(this); }
38 #define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
40 .void(entity this) selfuse;
41 void use_self() { SELFPARAM(); this.selfuse(this); }
42 #define setuse(e, f) (e.use = use_self, e.selfuse = f)
44 .void(entity this) selfthink;
45 void think_self() { SELFPARAM(); this.selfthink(this); }
46 #define setthink(e, f) (e.think = think_self, e.selfthink = f)