From 06a367be194b3118469ae47d763256e5898604bc Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 29 Apr 2008 12:09:55 +0000 Subject: * Applying melanie's List2Vector and List2Rot patch. Added a routine in the Quaternion constructors to catch 0,0,0,0 quaternions and convert them to 0,0,0,1 (as 0,0,0,0 is implicitly converted to 0,0,0,1 in LSL and will crash libsl if left which will in turn crash the simulator) --- OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 4 ++-- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 09be26a..4e7d5ef 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2979,7 +2979,7 @@ namespace OpenSim.Region.ScriptEngine.Common } else { - return new LSL_Types.Vector3(0, 0, 0); + return new LSL_Types.Vector3(src.Data[index].ToString()); } } @@ -3000,7 +3000,7 @@ namespace OpenSim.Region.ScriptEngine.Common } else { - return new LSL_Types.Quaternion(0, 0, 0, 1); + return new LSL_Types.Quaternion(src.Data[index].ToString()); } } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index aed591c..65047fb 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -259,6 +259,8 @@ namespace OpenSim.Region.ScriptEngine.Common y = (float)Quat.y; z = (float)Quat.z; s = (float)Quat.s; + if (x == 0 && y == 0 && z == 0 && s == 0) + s = 1; } public Quaternion(double X, double Y, double Z, double S) @@ -267,6 +269,8 @@ namespace OpenSim.Region.ScriptEngine.Common y = Y; z = Z; s = S; + if (x == 0 && y == 0 && z == 0 && s == 0) + s = 1; } public Quaternion(string str) @@ -279,6 +283,8 @@ namespace OpenSim.Region.ScriptEngine.Common res = res & Double.TryParse(tmps[1], out y); res = res & Double.TryParse(tmps[2], out z); res = res & Double.TryParse(tmps[3], out s); + if (x == 0 && y == 0 && z == 0 && s == 0) + s = 1; } #endregion -- cgit v1.1