#16
...Hmm, I thought vessel was the FirstOfGroup.
Well, as said, you should stick to GroupLooping if you had to use more than like 3 Handle Vars.
But in this case, I only see one.
function CS_i2r takes integer i returns real
return i
return 0.
endfunction
function CS_h2r takes handle h returns real
return h
return 0.
endfunction
function Stack_First takes location l returns location
return GetLocationX(l)
return null
endfunction
function Stack_Next takes location l returns location
return GetLocationY(l)
return null
endfunction
function Stack_Empty takes location s returns boolean
set udg_csloc=Stack_First(s)
return udg_csloc==null
endfunction
function Stack_Push takes location s, real i returns nothing
local location F=Stack_First(s)
if (F==null) then
set F=Location(i,CS_h2r(null))
else
set F=Location(i,CS_h2r(F))
endif
call MoveLocation(s,CS_h2r(F),0)
set F=null
endfunction
function Stack_Pop takes location s returns real
local location F=Stack_First(s)
local location q
local real i
if (F==null) then
return 0
endif
set i=GetLocationX(F)
set q=Stack_Next(F)
call RemoveLocation(F)
call MoveLocation(s,CS_h2r(q),0)
set F=null
set q=null
return i
endfunction
function NewStack takes nothing returns location
return Location(CS_h2r(null),0)
endfunction
function Stack_Destroy takes location s returns nothing
local location t=Stack_First(s)
local location q
loop
exitwhen (t==null)
set q=t
set t=Stack_Next(t)
call RemoveLocation(q)
endloop
call RemoveLocation(s)
set t=null
set q=null
endfunction
function B takes nothing returns nothing
local location s=NewStack()
local integer n=100
local integer i=0
local real x
loop
exitwhen i>=n
call Stack_Push(s,3.3)
set i=i+1
endloop
set i=0
loop
exitwhen Stack_Empty(s)
call Stack_Pop(s)
set i=i+1
endloop
call Stack_Destroy(s)
if (i>=n) then
set udg_log=udg_log+1
endif
set s=null
endfunctionive learned a helluva lot of JASS