From d743a221e88626bf8b7de8427c98e54df0f523d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Jun 2010 21:25:39 +0100 Subject: Fix scripts in rezzed objects not starting (Mantis #4775) --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index f702e65..73ef570 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -488,6 +488,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (stateSource == (int)StateSource.ScriptedRez) { + lock (m_CompileDict) + { + m_CompileDict[itemID] = 0; + } + DoOnRezScript(parms); } else -- cgit v1.1 From 0116b80795af199c8a68c6ba536c208ea82253d3 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:14:02 -0700 Subject: fix a potential division by zero --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 1ea52c5..326f327 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -257,12 +257,17 @@ namespace OpenSim.Region.ScriptEngine.Shared public static double Mag(Vector3 v) { return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); - } - - public static Vector3 Norm(Vector3 vector) - { - double mag = Mag(vector); - return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); + } + + public static Vector3 Norm(Vector3 vector) + { + double mag = Mag(vector); + if (mag > 0.0) + { + double invMag = 1.0 / mag; + return vector * invMag; + } + return new Vector3(0, 0, 0); } #endregion -- cgit v1.1 From c7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:17:28 -0700 Subject: llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e4e087f..eaaa9eb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -450,13 +450,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llVecNorm(LSL_Vector v) { - m_host.AddScriptLPS(1); - double mag = LSL_Vector.Mag(v); - LSL_Vector nor = new LSL_Vector(); - nor.x = v.x / mag; - nor.y = v.y / mag; - nor.z = v.z / mag; - return nor; + m_host.AddScriptLPS(1); + return LSL_Vector.Norm(v); } public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) -- cgit v1.1