From 177a53fbcf521767f7277ccccabad689d7674953 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 15 May 2013 22:04:38 +0100 Subject: Fix issue where osMakeNotecard() would fail if given a list containing vectors or quaternions. http://opensimulator.org/mantis/view.php?id=6640 --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 44fdd1a..9ca5ca9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -544,21 +544,33 @@ namespace OpenSim.Region.ScriptEngine.Shared set {m_data = value; } } - // Function to obtain LSL type from an index. This is needed - // because LSL lists allow for multiple types, and safely - // iterating in them requires a type check. + + /// + /// Obtain LSL type from an index. + /// + /// + /// This is needed because LSL lists allow for multiple types, and safely + /// iterating in them requires a type check. + /// + /// + /// public Type GetLSLListItemType(int itemIndex) { return m_data[itemIndex].GetType(); } - // Member functions to obtain item as specific types. - // For cases where implicit conversions would apply if items - // were not in a list (e.g. integer to float, but not float - // to integer) functions check for alternate types so as to - // down-cast from Object to the correct type. - // Note: no checks for item index being valid are performed - + /// + /// Obtain float from an index. + /// + /// + /// For cases where implicit conversions would apply if items + /// were not in a list (e.g. integer to float, but not float + /// to integer) functions check for alternate types so as to + /// down-cast from Object to the correct type. + /// Note: no checks for item index being valid are performed + /// + /// + /// public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex) { if (m_data[itemIndex] is LSL_Types.LSLInteger) @@ -589,26 +601,14 @@ namespace OpenSim.Region.ScriptEngine.Shared public LSL_Types.LSLString GetLSLStringItem(int itemIndex) { - if (m_data[itemIndex] is LSL_Types.key) - { - return (LSL_Types.key)m_data[itemIndex]; - } - else if (m_data[itemIndex] is String) - { - return new LSL_Types.LSLString((string)m_data[itemIndex]); - } - else if (m_data[itemIndex] is LSL_Types.LSLFloat) - { - return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]); - } - else if (m_data[itemIndex] is LSL_Types.LSLInteger) - { - return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]); - } - else - { - return (LSL_Types.LSLString)m_data[itemIndex]; - } + if (m_data[itemIndex] is LSL_Types.key) + { + return (LSL_Types.key)m_data[itemIndex]; + } + else + { + return new LSL_Types.LSLString(m_data[itemIndex].ToString()); + } } public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) -- cgit v1.1