Fix issue where osMakeNotecard() would fail if given a list containing vectors or quaternions.

http://opensimulator.org/mantis/view.php?id=6640
user_profiles
Justin Clark-Casey (justincc) 2013-05-15 22:04:38 +01:00
parent df2a0fec5f
commit 177a53fbcf
1 changed files with 30 additions and 30 deletions

View File

@ -544,21 +544,33 @@ namespace OpenSim.Region.ScriptEngine.Shared
set {m_data = value; } set {m_data = value; }
} }
// Function to obtain LSL type from an index. This is needed
// because LSL lists allow for multiple types, and safely /// <summary>
// iterating in them requires a type check. /// Obtain LSL type from an index.
/// </summary>
/// <remarks>
/// This is needed because LSL lists allow for multiple types, and safely
/// iterating in them requires a type check.
/// </remarks>
/// <returns></returns>
/// <param name='itemIndex'></param>
public Type GetLSLListItemType(int itemIndex) public Type GetLSLListItemType(int itemIndex)
{ {
return m_data[itemIndex].GetType(); return m_data[itemIndex].GetType();
} }
// Member functions to obtain item as specific types. /// <summary>
// For cases where implicit conversions would apply if items /// Obtain float from an index.
// were not in a list (e.g. integer to float, but not float /// </summary>
// to integer) functions check for alternate types so as to /// <remarks>
// down-cast from Object to the correct type. /// For cases where implicit conversions would apply if items
// Note: no checks for item index being valid are performed /// 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
/// </remarks>
/// <returns></returns>
/// <param name='itemIndex'></param>
public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex) public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex)
{ {
if (m_data[itemIndex] is LSL_Types.LSLInteger) if (m_data[itemIndex] is LSL_Types.LSLInteger)
@ -593,21 +605,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
{ {
return (LSL_Types.key)m_data[itemIndex]; 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 else
{ {
return (LSL_Types.LSLString)m_data[itemIndex]; return new LSL_Types.LSLString(m_data[itemIndex].ToString());
} }
} }