IntersectionGroups
not ratedReturns the intersection of the two groups. That means that the returned group will contain all the units which are present in BOTH groups.
function IntersectionGroups takes group One, group Two returns group
local unit u
local group result = CreateGroup()
local group a = CreateGroup()
call GroupAddGroup( One, a )
loop
set u = FirstOfGroup(a)
exitwhen ( u==null )
if ( IsUnitInGroup( u, Two ) ) then
call GroupAddUnit( result, u )
endif
call GroupRemoveUnit( a, u )
endloop
call DestroyGroup( a )
return result
endfunctionNo comments.