|
这个fun1函数会点泄露吗,DistanceBetweenPoints 中的点location locA, location locB没有删除和set null
- 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
复制代码
- function func1 takes nothing returns nothing
- local location A = GetUnitLoc(unit_a)
- local location B = GetUnitLoc(unit_b)
- local real dist = DistanceBetweenPoints(A,B)
- call RemoveLocation(A)
- call RemoveLocation(B)
- set A = null
- set B = null
- endfunction
复制代码
|
|