- Joined
- Nov 30, 2007
- Messages
- 1,202
Does this leak a location?
JASS:
method spawn takes player p, real x, real y, location l returns nothing
local integer i = 0
local integer j
local unit u
loop
set j = 0
loop
set u = CreateUnit(p, .u[i].unitTypeId, x, y, 0)
call IssuePointOrderLoc(u, "attack", l)
set j = j + 1
exitwhen j >= .u[i].amount
endloop
set i = i + 1
exitwhen i >= .index
endloop
set u = null
endmethod
JASS:
private function OnFinish takes nothing returns boolean
local unit u = GetTrainedUnit()
local integer i = Squad.getIndex(GetUnitTypeId(u))
local location l
if i > 0 then
set l = GetUnitRallyPoint(GetTriggerUnit())
call squad[i].spawn(GetTriggerPlayer(), GetUnitX(u), GetUnitY(u), l)
call RemoveLocation(l)
set l = null
endif
set u = null
return false
endfunction