Do you think I'm doing good or not? Did I allocate and deallocate properly?
Because I have doubt in
How to make a periodic loop inside the struct?
vJASS:
TimerUtils, /* wc3c.net/showthread.php?t=101322 */
Alloc /* github.com/nestharus/JASS/blob/master/jass/Systems/Alloc/Standard/script.j */
struct Stealth extends array {
module Alloc; /* optional, maybe */
unit target;
timer t;
static method onExpire() {
integer data = GetTimerData(GetExpiredTimer());
thistype this = data; /* I'm not sure at this */
UnitRemoveAbility(this.target, STEALTH_DETECTOR_ID );
ReleaseTimer(this.t);
this.deallocate();
}
static method apply( unit target ) {
thistype this = thistype.allocate();
this.target = target;
this.t = NewTimerEx(this);
UnitAddAbility( this.target, STEALTH_DETECTOR_ID );
TimerStart( this.t, STEALTH_DURATION, false, function thistype.onExpire );
}
}
Because I have doubt in
thistype this = data
andHow to make a periodic loop inside the struct?
Last edited: