|
发表于 2007-2-3 23:45:44
|
显示全部楼层
好吧...优化效率...
减少了2次函数调用开销,3次乘法和1次开平方运算...
[jass]
function RandomLocInRange takes location loc,real dist returns location
local real angel=GetRandomReal(0,3.1415926)
local real d=GetRandomReal(0,dist)
local real x=GetLocationX(loc) + dist * Cos(angle)
local real y=GetLocationY(loc) + dist * Sin(angle)
return Location(x,y)
endfunction
[/jass] |
|