HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Question About Leaks in GUI

05-13-2007, 06:08 PM#1
Dil999
I wasn't sure how to test this, so:
Does anyone know if Math - Distance Between Points leaks if you use Position of Unit?
05-13-2007, 06:15 PM#2
Ammorth
Collapse JASS:
function DistanceBetweenPoints takes location locA, location locB returns real
    local real dx = GetLocationX(locB) - GetLocationX(locA)
    local real dy = GetLocationY(locB) - GetLocationY(locA)
    return SquareRoot(dx * dx + dy * dy)
endfunction

The function doesn't leak, but make sure you clean up both points used in the arguments. Ie: Set the Position of unit to a variable, use it, and then Destroy it with call RemoveLocation()
05-13-2007, 06:53 PM#3
Dil999
Thanks, answers my question perfectly.