function GetRectContainingGroupExec takes group gtemp returns rect
local unit utemp = FirstOfGroup(gtemp)
local rect r = null
call GroupRemoveUnitSimple(utemp, gtemp)
if ( FirstOfGroup(gtemp) == null ) then
call DestroyGroup(gtemp)
set r = Rect(GetUnitX(utemp),GetUnitY(utemp),GetUnitX(utemp),GetUnitY(utemp))
return r
endif
set r = GetRectContainingGroupExec(gtemp)
set r = Rect(RMinBJ(GetUnitX(utemp),GetRectMinX(r)), RMinBJ(GetUnitY(utemp),GetRectMinY(r)), RMaxBJ(GetUnitX(utemp),GetRectMaxX(r)), RMaxBJ(GetUnitY(utemp),GetRectMaxY(r)))
return r
endfunction
function GetRectContainingGroup takes group g returns rect
local group gtemp = CreateGroup()
call GroupAddGroup(g, gtemp)
return GetRectContainingGroupExec(gtemp)
endfunction