From: Mario Date: Fri, 15 Apr 2016 01:52:58 +0000 (+1000) Subject: Fix defer X-Git-Tag: xonotic-v0.8.2~956 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9e4d4368341089b726b96a2a7f43813975ecc6da;p=xonotic%2Fxonotic-data.pk3dir.git Fix defer --- diff --git a/qcsrc/lib/defer.qh b/qcsrc/lib/defer.qh index d4c1eadac..24764ae15 100644 --- a/qcsrc/lib/defer.qh +++ b/qcsrc/lib/defer.qh @@ -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) @@ -28,18 +29,18 @@ 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; }