- Joined
- Apr 26, 2011
- Messages
- 403
It is a tower defend map, with many wave.
for every wave, I execute the code below to start the trigger :
as you can see:
- the trigger for "EVENT_UNIT_ACQUIRED_TARGET" is register again and again for every wave,
- I never need them for later wave, because "udg_Fighter_Group" is destroy at the end of each wave, and created again for next wave
so how can I safely remove leak on this ?
for every wave, I execute the code below to start the trigger :
JASS:
call TriggerExecute( gg_trg_Fight_Start_Add_Events )
JASS:
function Trig_Unpause_Fighters_Function takes nothing returns nothing
call SetUnitMoveSpeed( GetTriggerUnit(), GetUnitDefaultMoveSpeed(GetTriggerUnit()) )
//call DestroyTrigger(GetTriggeringTrigger())
endfunction
function Trig_Unpause_Fighters_Add_Events_Function takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterUnitEvent( t, GetEnumUnit(), EVENT_UNIT_ACQUIRED_TARGET )
call TriggerAddAction( t, function Trig_Unpause_Fighters_Function )
endfunction
function Trig_Unpause_Fighters_Add_Events_Actions takes nothing returns nothing
call ForGroup(udg_Fighter_Group, function Trig_Unpause_Fighters_Add_Events_Function)
endfunction
function InitTrig_Fight_Start_Add_Events takes nothing returns nothing
set gg_trg_Fight_Start_Add_Events = CreateTrigger( )
call TriggerAddAction( gg_trg_Fight_Start_Add_Events, function Trig_Unpause_Fighters_Add_Events_Actions )
endfunction
as you can see:
- the trigger for "EVENT_UNIT_ACQUIRED_TARGET" is register again and again for every wave,
- I never need them for later wave, because "udg_Fighter_Group" is destroy at the end of each wave, and created again for next wave
so how can I safely remove leak on this ?