Warcraft III resources & community, 2003–2006 · archived

GroupMakeTemporary

not rated
Submitted by PepparVariable Change0 downloads
When used, the function makes sure that the group is destroyed immediately after the calling thread has finished, or when it executes a TriggerSleepAction (or PolledWait), whichever comes first.

This function is designed to make things easier for whoever wishes to get rid of memory leaks. When you don't want to keep all your temporary groups in variables for later removal, use this function.

Example:
call SelectGroupForPlayerBJ(GroupMakeTemporary(GetUnitsInRectAll(gg_rct_my_rect)), Player(0))

Source

function GroupMakeTemporary_Child takes nothing returns nothing
    local group g = bj_groupAddGroupDest
    call TriggerSleepAction(0)
    call DestroyGroup(g)
    set g = null
endfunction

function GroupMakeTemporary takes group g returns group
    local trigger dispatcher = CreateTrigger()
    set bj_groupAddGroupDest = g
    call TriggerAddAction(dispatcher, function GroupMakeTemporary_Child)
    call TriggerExecute(dispatcher)
    call DestroyTrigger(dispatcher)
    set dispatcher = null
    return g
endfunction

Comments

0

No comments.