JASS #281
not ratedThis counts all Items in an "rect" of type.
constant function WhichItemType takes nothing returns integer
return 'XXXX'
endfunction
function CountItem takes nothing returns nothing
set bj_forLoopAIndex=bj_forLoopAIndex+1
endfunction
function IsItemType takes nothing returns boolean
return GetItemTypeId(GetFilterItem())==WhichItemType()
endfunction
function CountFolianteInRect takes rect r returns integer
local integer n
set bj_forLoopAIndex=0
call EnumItemsInRect(r,Condition(function IsItemType),function CountItem)
set n=bj_forLoopAIndex
return n
endfunctionNo comments.