From 947242f4764b8d98fe860d3c18bcea709aea777f Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Fri, 5 Sep 2008 23:26:35 +0000 Subject: Mantis#2126. Thank you kindly, Ralphos for a patch that addresses: Types extracted from a LSL_Types.list have to be down-cast initially to the exact type of value type object that the Object actually is. This would make for very cumbersome, ugly code when extracting list parameter items in ll functions where a few implicit conversions should be applied such as key -> LSLString and LSLInteger -> LSLFloat (but not LSLFloat -> LSLInteger). This patch adds a set of GetXXXItem member functions to the LLS_Type.list class, where XXX is the name of the LSL_Type to be extracted: LSLFLoat, LSLInteger etc. All take a single, int parameter that is the item number to be extracted. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 74c2d89..93dfeea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5726,13 +5726,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 7) return; - bool flexi = (LSL_Types.LSLInteger)rules.Data[idx++]; - int softness = (LSL_Types.LSLInteger)rules.Data[idx++]; - float gravity = (float)(LSL_Types.LSLFloat)rules.Data[idx++]; - float friction = (float)(LSL_Types.LSLFloat)rules.Data[idx++]; - float wind = (float)(LSL_Types.LSLFloat)rules.Data[idx++]; - float tension = (float)(LSL_Types.LSLFloat)rules.Data[idx++]; - LSL_Types.Vector3 force = (LSL_Types.Vector3)rules.Data[idx++]; + bool flexi = rules.GetLSLIntegerItem(idx++); + int softness = rules.GetLSLIntegerItem(idx++); + float gravity = (float)rules.GetLSLFloatItem(idx++); + float friction = (float)rules.GetLSLFloatItem(idx++); + float wind = (float)rules.GetLSLFloatItem(idx++); + float tension = (float)rules.GetLSLFloatItem(idx++); + LSL_Types.Vector3 force = rules.GetVector3Item(idx++); SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); -- cgit v1.1