prismpirate
New Member
- Reaction score
- 2
Are there any tutorials for removing leaks in Jass? All the tutorials seem to be only for GUI.
call RemoveLocation(whichlocation)
call DestroyGroup(whichgroup)
call DestroyForce(whichforce)
local unit u
set u = null
Aside from that being wrong, you're right.Booleanexpressions will leak when used as argument for some EnumUnits...(...) functions, I can't remember which, however just use a static/constant booleanexpression and pass that to those functions.
Oh yeah, and Blitz is wrong too. Only agents need nulling, and even then players are an exception.I can tell you that all locals that aren't of type integer or real need to be nulled.
Same. Everyone is saying different things. Someone consolidate a list? So far, I take it that:
integers
reals
strings
some boolexprs
texttags
don't need to be nulled. I've been nulling all units so far. I don't use much other than units, groups and locations, although I try to keep it to x,y as much as possible.
//Place these function into a library and use them instead of the functions mentioned above
function OrbitX takes real X, real dist, real angle returns real
return ( X + dist * Cos(angle * bj_DEGTORAD) )
endfunction
function OrbitY takes real Y, real dist, real angle returns real
return ( Y + dist * Sin(angle * bj_DEGTORAD) )
endfunction
function DisXY takes real X1, real Y1, real X2, real Y2 returns real
local real dx = X2 - X1
local real dy = Y2 - Y1
return SquareRoot(dx * dx + dy * dy)
endfunction
function AngXY takes real X1, real Y1, real X2, real Y2 returns real
return bj_RADTODEG * Atan2(Y2 - Y1, X2 - X1)
endfunction
private function A takes nothing returns nothing
local integer i = GetSpellAbilityId()
if i == 039;A01M039; then
call DarkPossession()
else
if i == 039;A05B039; then
call WindRush()
else
if i == 039;A05A039; then
call ChainUp()
endif
endif
endif
endfunction
private function A takes nothing returns nothing
set i = GetSpellAbilityId()
if i == 039;A00M039; or i == 039;A00K039; or i == 039;A03P039; or i == 039;A03O039; or i == 039;A03N039; or i == 039;A030039; or i == 039;A02P039; or i == 039;A02Z039; or i == 039;AMaE039; then
call epuseherospells()
endif
endfunction