From 6447d7132f0f443205e719a00e595f79444eea25 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 8 Sep 2008 19:29:16 +0000 Subject: Adapt the unit tests to the new list rules, change some casts to new method for testing --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 +++++++------ OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bc58a8a..4b92739 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5614,12 +5614,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 6) return; - face = Convert.ToInt32(rules.Data[idx++].ToString()); // holeshape - v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut - hollow = (float)Convert.ToDouble(rules.Data[idx++].ToString()); - twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); - taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); - topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); + face = (int)rules.GetLSLIntegerItem(idx++); + v = rules.GetVector3Item(idx++); // cut + hollow = (float)rules.GetLSLFloatItem(idx++); + twist = rules.GetVector3Item(idx++); + taper_b = rules.GetVector3Item(idx++); + topshear = rules.GetVector3Item(idx++); + part.Shape.PathCurve = (byte)Extrusion.Straight; SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); break; diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 4554b0c..f149f60 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -454,7 +454,12 @@ namespace OpenSim.Region.ScriptEngine.Shared public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) { - return (LSL_Types.LSLInteger)m_data[itemIndex]; + if (m_data[itemIndex] is LSL_Types.LSLInteger) + return (LSL_Types.LSLInteger)m_data[itemIndex]; + else if (m_data[itemIndex] is Int32) + return new LSLInteger((int)m_data[itemIndex]); + else + throw new InvalidCastException(); } public LSL_Types.Vector3 GetVector3Item(int itemIndex) -- cgit v1.1