- Joined
- Jun 30, 2008
- Messages
- 580
Hello,
I don't understand how this code can still be leaking. I have isolated the
Here is the code:
I don't understand how this code can still be leaking. I have isolated the
CreateDestructable
function to be leaking, even though I remove the destructable after I use it, and I null the local variable, I also store the GetRectX and GetRectY globally.Here is the code:
JASS:
private function NextChoice takes nothing returns nothing
local integer ary = GetPlayerId(GetTriggerPlayer())
local CharDat dat = LoadInteger(CD, ary, 1)
local destructable d = null
call UnitRemoveAbility(Display[ary], LoadInteger(Options, dat.Attribute, dat.Choices[dat.Attribute]))
if (dat.Choices[dat.Attribute] < MaxChoice[dat.Attribute]) then
set dat.Choices[dat.Attribute] = dat.Choices[dat.Attribute]+1
else
set dat.Choices[dat.Attribute] = 1
endif
if (dat.Attribute == 1) or (dat.Attribute == 2) then
set d = CreateDestructable(LoadInteger(Options, dat.Choices[2], dat.Choices[1]), dat.rX, dat.rY, 0.0, 0.0, 0)
call IssueTargetOrder( Display[ary], "grabtree", d)
call RemoveDestructable(d)
set d = null
endif
call UnitAddAbility(Display[ary], LoadInteger(Options, dat.Attribute, dat.Choices[dat.Attribute]))
call MultiboardSetItemValue(dat.mbitemB[dat.Attribute], LoadStringBJ(dat.Attribute, dat.Choices[dat.Attribute], OStrings))
endfunction