• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Remove All Units of Group From Group Efficiency.

Status
Not open for further replies.
Presumably it's more efficient than FirstOfGroup or ForGroup -based removal loops.
Okay but that still has an N run-time I'm assuming.

BlzGroupRemoveGroupFast might be O(1), going by the presumption that adding a group quickly just appends the entire target list (group) to the desired list of units (whichGroup)

The function above might be O(N), based on how it was implemented before.

BlzGroupRemoveFast is 1.31 isn't it?
 
If you want to clear a group then use the appropriate native to do so...
JASS:
native GroupClear takes group whichGroup returns nothing
If you want to remove all units in group B from group A then this is the current implementation...
JASS:
function GroupRemoveGroup takes group sourceGroup,group destGroup returns nothing
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false
    set bj_groupRemoveGroupDest = destGroup
    call ForGroup(sourceGroup, function GroupRemoveGroupEnum)
    if (wantDestroy) then
        call DestroyGroup(sourceGroup)
    endif
endfunction

function GroupRemoveGroupEnum takes nothing returns nothing
    call GroupRemoveUnit(bj_groupRemoveGroupDest, GetEnumUnit())
endfunction
On the 1.31 PTR there is this native implementation, which is likely considerably faster...
JASS:
native BlzGroupRemoveGroupFast takes group whichGroup,group removeGroup returns integer
 
Status
Not open for further replies.
Back
Top