library RecycleChecking
//this is freehand, but basically this is useful for detecting when a unit is recycled and when it isn't
//useful for spells to check if your recycling is working (assuming you use the ShowUnit()) method of recycling
globals
private integer count = 0
private integer removeCount = 0
endglobals
function CreateUnitEx takes player id, integer uid, real x, real y, real face returns unit
set count = count+1
call BJDebugMsg("A unit was created! Count: "+I2S(count))
endfunction
function RemoveUnitEx takes unit u returns nothing
set removeCount = removeCount+1
set count = count-1
call BJDebugMsg("A unit was removed! Count: "+I2S(count))
call BJDebugMsg("Remove Count: "+I2S(removeCount))
endfunction
function ShowUnitEx takes unit u, boolean show returns nothing
if show then
set count = count+1
call BJDebugMsg("A unit was shown! Count: "+I2S(count))
else
set count = count-1
call BJDebugMsg("A unit was hidden! Count: "+I2S(count))
endif
endfunction
hook ShowUnit ShowUnitEx
hook CreateUnit CreateUnitEx //I would hook the other functions for creating units, but I don't use those
hook RemoveUnit RemoveUnitEx
endlibrary