Correct casts so that the target id in the at_target event matches the original target id.

Fixes Mantis #2861
0.6.4-rc1
idb 2009-03-07 10:37:15 +00:00
parent 5a49c772ca
commit 1fd57b39df
2 changed files with 10 additions and 8 deletions

View File

@ -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;

View File

@ -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;