View Single Post
Old 04-20-2017, 07:16 AM   #2
default string
Fledermaus's Avatar
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus

No it doesn't leak because they're parameters/arguments. You only need to destroy/null local/global variables (globals don't have to be nulled because you can't ever lose the reference to that variable).
Attached a testmap so you can play around and see for yourself :)

However most people don't like using locations because they can leak.
Here are 2 commonly used alternatives:
Collapse JASS:
function DistanceBetweenXY takes real x1, real y1, real x2, real y2 returns real
    return SquareRoot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))

function DistanceBetweenUnits takes unit a, unit b returns real
    return SquareRoot(((GetUnitX(b) - GetUnitX(a)) * (GetUnitX(b) - GetUnitX(a))) + ((GetUnitY(b) - GetUnitY(a)) * (GetUnitY(b) - GetUnitY(a))))
Attached Files
File Type: w3x Leak Test.w3x (8.6 KB, 10 views)
Fledermaus is offline   Reply With Quote