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)
23 #define SELFPARAM() const entity this = __self
26 // Step 4: kill unstructured setself
31 // Step 5: this should work
33 #define self (0, this)
36 // Step 6: Remove SELFPARAM in favor of a parameter
38 .void(entity this) selftouch;
39 void touch_self() { SELFPARAM(); this.selftouch(this); }
40 #define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
42 //.void(entity this) selfuse;
43 //void use_self() { SELFPARAM(); this.selfuse(this); }
44 //#define setuse(e, f) (e.use = use_self, e.selfuse = f)
46 .void(entity this) selfthink;
47 void think_self() { SELFPARAM(); this.selfthink(this); }
48 #define setthink(e, f) (e.think = think_self, e.selfthink = f)