From 117cc09edcc796f93cb05f98d7589b7ca5313ee8 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Thu, 24 Jul 2008 05:23:38 +0000 Subject: Replace implicit casts from LSLFloat to int and uint which were removed in r5487. Also put the unit tests back for Bamboo to execute them, let's see how this goes. --- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 10 ++++++++++ OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 10 ++++++++++ .../Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index be790d6..7274fa5 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -1422,6 +1422,16 @@ namespace OpenSim.Region.ScriptEngine.Common #region Operators + static public implicit operator int(LSLFloat f) + { + return (int)f.value; + } + + static public implicit operator uint(LSLFloat f) + { + return (uint) Math.Abs(f.value); + } + static public implicit operator Boolean(LSLFloat f) { if (f.value == 0.0) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 0cddf36..acfe613 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1477,6 +1477,16 @@ namespace OpenSim.Region.ScriptEngine.Shared #region Operators + static public implicit operator int(LSLFloat f) + { + return (int)f.value; + } + + static public implicit operator uint(LSLFloat f) + { + return (uint) Math.Abs(f.value); + } + static public implicit operator Boolean(LSLFloat f) { if (f.value == 0.0) diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs index 130c0ec..29d0e1c 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs @@ -133,7 +133,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests foreach (KeyValuePair number in numberSet) { - testNumber = (int)(new LSL_Types.LSLFloat(number.Key)); + testNumber = new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); } } @@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests foreach (KeyValuePair number in numberSet) { - testNumber = (uint)(new LSL_Types.LSLFloat(number.Key)); + testNumber = new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); } } -- cgit v1.1