Hi
Just learning how to attach data to timers in jass.
I am following this tutorial here:
http://www.thehelper.net/threads/jass-timers-and-how-to-pass-data-to-them.106986/
This code is for removing the instances from the array. I don't understand why you reduce total by 1 first and then set D=D[Total].
Shouldn't it be set D=D[Total+1]?
Just learning how to attach data to timers in jass.
I am following this tutorial here:
http://www.thehelper.net/threads/jass-timers-and-how-to-pass-data-to-them.106986/
JASS:
private function TimerLoop takes nothing returns nothing
local integer i=0
loop
exitwhen i>=Total
if D[i].end then // end is a boolean which tells us when to stop calling actions
call D[i].destroy()
set Total=Total-1
if Total > 0 then
set D[i]=D[Total]
set i=i-1
else
call PauseTimer(T)
endif
else
call D[i].action()
endif
set i=i+1
endloop
endfunction
This code is for removing the instances from the array. I don't understand why you reduce total by 1 first and then set D=D[Total].
Shouldn't it be set D=D[Total+1]?