diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 0b28af0840..7ac7a651ff 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -1454,6 +1454,11 @@ namespace OpenSim.Region.ScriptEngine.Common
return new LSLFloat(i);
}
+ static public implicit operator LSLFloat(LSLInteger i)
+ {
+ return new LSLFloat(i.value);
+ }
+
static public implicit operator LSLFloat(string s)
{
return new LSLFloat(double.Parse(s));
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index f49d4538a8..7eb5e77af7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1509,6 +1509,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new LSLFloat(i);
}
+ static public implicit operator LSLFloat(LSLInteger i)
+ {
+ return new LSLFloat(i.value);
+ }
+
static public implicit operator LSLFloat(string s)
{
return new LSLFloat(double.Parse(s));
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
index aba87ac8dd..2d553a7ac4 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
@@ -303,6 +303,36 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
}
}
+ ///
+ /// Tests LSLInteger is correctly cast implicitly to LSLFloat.
+ ///
+ [Test]
+ public void TestImplicitCastLSLIntegerToLSLFloat()
+ {
+ LSL_Types.LSLFloat testFloat;
+
+ foreach (int number in m_intList)
+ {
+ testFloat = new LSL_Types.LSLInteger(number);
+ Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
+ }
+ }
+
+ ///
+ /// Tests LSLInteger is correctly cast explicitly to LSLFloat.
+ ///
+ [Test]
+ public void TestExplicitCastLSLIntegerToLSLFloat()
+ {
+ LSL_Types.LSLFloat testFloat;
+
+ foreach (int number in m_intList)
+ {
+ testFloat = (LSL_Types.LSLFloat) new LSL_Types.LSLInteger(number);
+ Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
+ }
+ }
+
///
/// Tests string is correctly cast implicitly to LSLFloat.
///
@@ -319,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
}
///
- /// Tests string is correctly cast implicitly to LSLFloat.
+ /// Tests LSLString is correctly cast implicitly to LSLFloat.
///
[Test]
public void TestExplicitCastLSLStringToLSLFloat()