Question about leak

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
  • Trigger
    • Events
    • Conditions
    • Actions
      • For each (Integer Temp_Int[0]) from 1 to SomeVar, do (Actions)
        • Loop - Actions
          • Set Some_UnitGroup[Temp_Int[0]] = (Units in SomeRegion[Temp_Int[0]])
          • Unit Group - Pick every unit in Some_UnitGroup[Temp_Int[0]] and do (Actions)
            • Loop - Actions
              • Some Actions
              • Custom script: set bj_wantDestroyGroup = true
Would set "bj_wantDestroyGroup = true" remove "Some_UnitGroup" even though it was made before the loop?

Don't really know why you wouldn't just call destroy group but I were just wondering.
 
Setting it to true has to be done before using the group, while if you want to use DestroyGroup you'll have to set it to a variable earlier.

Pick every unit in... is this:

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
 
Status
Not open for further replies.
Back
Top