]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix defer
authorMario <mario@smbclan.net>
Fri, 15 Apr 2016 01:52:58 +0000 (11:52 +1000)
committerMario <mario@smbclan.net>
Fri, 15 Apr 2016 01:52:58 +0000 (11:52 +1000)
qcsrc/lib/defer.qh

index d4c1eadac75db7a4dbbd87a738892b7e0f039565..24764ae1585038b96257e139e857f7f30417dae5 100644 (file)
@@ -9,6 +9,7 @@
        class(Defer).entity owner;
        class(Defer).void() think;
        class(Defer).float nextthink;
+       class(Defer).void(entity) defer_func;
 
        /** Remove self */
        void SUB_Remove(entity this)
                SELFPARAM();
                this.think     = SUB_Remove_self;
                this.nextthink = time;
-               WITHSELF(this.owner, this.selfthink(this));
+               this.defer_func(this.owner);
        }
 
     /**
      * Execute func() after time + fdelay.
      * self when func is executed = self when defer is called
      */
-       void defer(entity this, float fdelay, void(entity this) func)
+       void defer(entity this, float fdelay, void(entity) func)
        {
                entity e    = new_pure(deferred);
                e.owner     = this;
-               setthink(e, func);
+               e.defer_func = func;
                e.think     = defer_think;
                e.nextthink = time + fdelay;
        }