SmartCameraPanBJ
- Parameters
-
whichPlayer player
loc location
duration real
- comment
- bug
Fixed in 1.31: Caused a desync in multiplayer by creating a
location
inside the local block. It was known as "Camera - Pan Camera as necessary (timed)" in GUI. Explanation- bug
Leaks handle
cameraLoc
: In Jass you must set local variables that hold agents (or any child type) tonull
at the end of functions to avoid reference counter leaks.- patch
1.00
- Source
- Blizzard.j
- return type
nothing
- Source code
function SmartCameraPanBJ takes player whichPlayer, location loc, real duration returns nothing local real dist local location cameraLoc = GetCameraTargetPositionLoc() if (GetLocalPlayer() == whichPlayer) then // Use only local code (no net traffic) within this block to avoid desyncs. set dist = DistanceBetweenPoints(loc, cameraLoc) if (dist >= bj_SMARTPAN_TRESHOLD_SNAP) then // If the user is too far away, snap the camera. call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), 0) elseif (dist >= bj_SMARTPAN_TRESHOLD_PAN) then // If the user is moderately close, pan the camera. call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), duration) else // User is close enough, so don't touch the camera. endif endif call RemoveLocation(cameraLoc) endfunction