Fix minor race conditions in llTeleportAgent(), llTeleportAgentGlobalCoords(), llEjectFromLand() and llOverMyLand() where the wrong parcel could be identified for very fast moving avatars.

user_profiles
Justin Clark-Casey (justincc) 2013-03-14 22:22:10 +00:00
parent 7b85279dba
commit 3c9bea1e3f
1 changed files with 21 additions and 14 deletions

View File

@ -4202,9 +4202,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (destination == String.Empty) if (destination == String.Empty)
destination = World.RegionInfo.RegionName; destination = World.RegionInfo.RegionName;
Vector3 pos = presence.AbsolutePosition;
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject( if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{ {
DoLLTeleport(presence, destination, targetPos, targetLookAt); DoLLTeleport(presence, destination, targetPos, targetLookAt);
} }
@ -4234,9 +4235,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// agent must not be a god // agent must not be a god
if (presence.GodLevel >= 200) return; if (presence.GodLevel >= 200) return;
Vector3 pos = presence.AbsolutePosition;
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject( if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{ {
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
} }
@ -5865,8 +5867,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentID); ScenePresence presence = World.GetScenePresence(agentID);
if (presence != null) if (presence != null)
{ {
Vector3 pos = presence.AbsolutePosition;
// agent must be over the owners land // agent must be over the owners land
ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
if (land == null) if (land == null)
return; return;
@ -5888,21 +5892,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(key); ScenePresence presence = World.GetScenePresence(key);
if (presence != null) // object is an avatar if (presence != null) // object is an avatar
{ {
if (m_host.OwnerID Vector3 pos = presence.AbsolutePosition;
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
return 1; return 1;
} }
else // object is not an avatar else // object is not an avatar
{ {
SceneObjectPart obj = World.GetSceneObjectPart(key); SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null) if (obj != null)
if (m_host.OwnerID {
== World.LandChannel.GetLandObject( Vector3 pos = obj.AbsolutePosition;
obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID)
if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
return 1; return 1;
} }
} }
}
return 0; return 0;
} }
@ -5979,7 +5986,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// or // or
// if the object is owned by a person with estate access. // if the object is owned by a person with estate access.
ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); Vector3 pos = av.AbsolutePosition;
ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y);
if (parcel != null) if (parcel != null)
{ {
if (m_host.OwnerID == parcel.LandData.OwnerID || if (m_host.OwnerID == parcel.LandData.OwnerID ||
@ -5991,9 +6000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
} }
} }
} }
public LSL_Vector llGroundSlope(LSL_Vector offset) public LSL_Vector llGroundSlope(LSL_Vector offset)