diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 9bde177543..0b28af0840 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -1189,6 +1189,7 @@ namespace OpenSim.Region.ScriptEngine.Common { return new Vector3(s.m_string); } + public static implicit operator LSLFloat(LSLString s) { return new LSLFloat(Convert.ToDouble(s.m_string)); diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 73ec9dfb1e..f49d4538a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1199,10 +1199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared { return new Vector3(s.m_string); } - public static implicit operator LSLFloat(LSLString s) - { - return new LSLFloat(Convert.ToDouble(s.m_string)); - } + + public static implicit operator LSLFloat(LSLString s) + { + return new LSLFloat(Convert.ToDouble(s.m_string)); + } #endregion diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs index 00bf4f4d7b..aba87ac8dd 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs @@ -318,6 +318,21 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } } + /// + /// Tests string is correctly cast implicitly to LSLFloat. + /// + [Test] + public void TestExplicitCastLSLStringToLSLFloat() + { + LSL_Types.LSLFloat testFloat; + + foreach (KeyValuePair number in m_stringDoubleSet) + { + testFloat = (LSL_Types.LSLFloat) new LSL_Types.LSLString(number.Key); + Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); + } + } + /// /// Tests double is correctly cast implicitly to LSLFloat. /// diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs index 7a11d33ed9..43e314374a 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CompilerTest.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests } } - [Test] + //[Test] /// /// Test the C# compiler error message can be mapped to the correct /// line/column in the LSL source when an undeclared variable is used.