GetUnitsOfTypeIdAll

Parameters
unitid integer
comment
bug

Leaks handle result: In Jass you must set local variables that hold agents (or any child type) to null at the end of functions to avoid reference counter leaks.

bug

Leaks handle g: In Jass you must set local variables that hold agents (or any child type) to null at the end of functions to avoid reference counter leaks.

note

Creates a new group object and returns it. The caller must remove it on its own after use.

patch

1.00

Source
Blizzard.j
return type
group
Source code
function GetUnitsOfTypeIdAll takes integer unitid returns group
    local group   result = CreateGroup()
    local group   g      = CreateGroup()
    local integer index

    set index = 0
    loop
        set bj_groupEnumTypeId = unitid
        call GroupClear(g)
        call GroupEnumUnitsOfPlayer(g, Player(index), filterGetUnitsOfTypeIdAll)
        call GroupAddGroup(g, result)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call DestroyGroup(g)

    return result
endfunction