From 1fd57b39dfa23f1cc9fc05fc9b38f28927ee579e Mon Sep 17 00:00:00 2001 From: idb Date: Sat, 7 Mar 2009 10:37:15 +0000 Subject: Correct casts so that the target id in the at_target event matches the original target id. Fixes Mantis #2861 --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 13 +++++-------- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 5 +++++ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a88f8a9..debab8d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -77,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes { public Vector3 targetPos; public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -2891,6 +2892,7 @@ namespace OpenSim.Region.Framework.Scenes waypoint.targetPos = target; waypoint.tolerance = tolerance; uint handle = m_scene.AllocateLocalId(); + waypoint.handle = handle; lock (m_targets) { m_targets.Add(handle, waypoint); @@ -2927,12 +2929,11 @@ namespace OpenSim.Region.Framework.Scenes // trigger at_target if (m_scriptListens_atTarget) { - // Reusing att.tolerance to hold the index of the target in the targets dictionary - // to avoid deadlocking the sim. at_target = true; scriptPosTarget att = new scriptPosTarget(); att.targetPos = target.targetPos; - att.tolerance = (float)idx; + att.tolerance = target.tolerance; + att.handle = target.handle; atTargets.Add(idx, att); } } @@ -2956,11 +2957,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint target in atTargets.Keys) { scriptPosTarget att = atTargets[target]; - // Reusing att.tolerance to hold the index of the target in the targets dictionary - // to avoid deadlocking the sim. - m_scene.TriggerAtTargetEvent(localids[ctr], (uint)att.tolerance, att.targetPos, m_rootPart.GroupPosition); - - + m_scene.TriggerAtTargetEvent(localids[ctr], att.handle, att.targetPos, m_rootPart.GroupPosition); } } return; diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index e5e097b..93a6300 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1469,6 +1469,11 @@ namespace OpenSim.Region.ScriptEngine.Shared value = i; } + public LSLInteger(uint i) + { + value = (int)i; + } + public LSLInteger(double d) { value = (int)d; -- cgit v1.1