I made this simple function to get units that are distant less then R from (X,Y) but more then r. Does group g leak? Do I have to make it global to destroy it?
Oh I just realized I'm also nulling the locals before destroying them
silliness
JASS:
function GetUnitsInCrown takes real x, real y, real rmin, real rmax returns group
local unit u
local location loc = Location(x,y)
local group temp = CreateGroup()
local group g = CreateGroup()
call GroupEnumUnitsInRange(temp, x, y, rmax, null)
if (rmin>0) then
loop
set u = FirstOfGroup(temp)
exitwhen u == null
if not (IsUnitInRangeLoc(u, loc, rmin)) then
call GroupAddUnit(g, u)
endif
call GroupRemoveUnit(temp, u)
endloop
endif
set u = null
set loc = null
set temp = null
call DestroyGroup(temp)
call RemoveLocation(loc)
return g
endfunction
Oh I just realized I'm also nulling the locals before destroying them