ZakkWylde-
New Member
- Reaction score
- 14
1. If I call this function 5 times, with numPatrols at a constant value:
will this leak? (4 times "numPatrols" units?)
2. After calling this 5 times, would it be possible just to remove all units in udg_EnemyUnits (and then remove those units from the group) and thereby dispose of any leaks?
3. IF #2: If I remove the units udg_EnemyUnits and then remove them from the group udg_EnemyUnits each time before calling the function again, will it still leak?
4. Is anything leaking if I just call this once?
5. Is it better, in terms of performance, to set u = spinUnit[index] and use u in all places instead of spinUnit[index], and then at the end of the function, set u = null?
<3
Zakk
EDIT: If you know an answer to one of these, lemme know . [don't worry about not answering all of them at once. ]
JASS:
function MakeSpinUnit takes integer numPatrols, rect r returns nothing //removed integer v
local integer yi
local real x = GetRectCenterX(r)
local real y = GetRectCenterY(r)
local integer v
local integer index = 0
set numberCirclePatrols = numPatrols
loop
exitwhen index == numPatrols
set yi = GetRandomInt(0, 4)
if yi == 0 then
set v = 039;n000039;
elseif yi == 1 then
set v = 039;n001039;
elseif yi == 2 then
set v = 039;n002039;
elseif yi == 3 then
set v = 039;n003039;
elseif yi == 4 then
set v = 039;n004039;
endif
set spinUnit[index] = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), v, x, y, 0)
call SetUnitVertexColorBJ(spinUnit[index], mRed, mGreen, mBlue, 0)
call TriggerRegisterUnitInRange(gg_trg_Kill, spinUnit[index], uC, null)
call GroupAddUnit(udg_EnemyUnits, spinUnit[index])
call SetUnitFlyHeight(spinUnit[index], 0, 99999)
set index = index+1
endloop
endfunction
will this leak? (4 times "numPatrols" units?)
2. After calling this 5 times, would it be possible just to remove all units in udg_EnemyUnits (and then remove those units from the group) and thereby dispose of any leaks?
3. IF #2: If I remove the units udg_EnemyUnits and then remove them from the group udg_EnemyUnits each time before calling the function again, will it still leak?
4. Is anything leaking if I just call this once?
5. Is it better, in terms of performance, to set u = spinUnit[index] and use u in all places instead of spinUnit[index], and then at the end of the function, set u = null?
<3
Zakk
EDIT: If you know an answer to one of these, lemme know . [don't worry about not answering all of them at once. ]