Treat LSL_Types as special cases in llList2Integer and llList2Float. This could be implemented many other places, but let's do that on a case-by-case basis.

0.6.0-stable
Mike Mazur 2008-07-18 02:05:20 +00:00
parent bc24c0e5d7
commit 0b92ff4fde
3 changed files with 37 additions and 0 deletions

View File

@ -28,6 +28,7 @@ OpenSim Developers
* Alondria * Alondria
* Dr Scofield (IBM) * Dr Scofield (IBM)
* dahlia * dahlia
* mikem (3Di)
Patches Patches

View File

@ -3421,6 +3421,12 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
try try
{ {
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToInt32(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToInt32(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToInt32(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToInt32(src.Data[index]); return Convert.ToInt32(src.Data[index]);
} }
catch (FormatException) catch (FormatException)
@ -3440,6 +3446,12 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
return 0.0; return 0.0;
} }
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToDouble(src.Data[index]); return Convert.ToDouble(src.Data[index]);
} }
@ -3456,6 +3468,12 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
try try
{ {
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToDouble(src.Data[index]); return Convert.ToDouble(src.Data[index]);
} }
catch (FormatException) catch (FormatException)

View File

@ -3363,6 +3363,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
try try
{ {
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToInt32(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToInt32(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToInt32(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToInt32(src.Data[index]); return Convert.ToInt32(src.Data[index]);
} }
catch (FormatException) catch (FormatException)
@ -3382,6 +3388,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
return 0.0; return 0.0;
} }
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToDouble(src.Data[index]); return Convert.ToDouble(src.Data[index]);
} }
@ -3398,6 +3410,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
try try
{ {
if (src.Data[index] is LSL_Types.LSLInteger)
return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLFloat)
return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value);
else if (src.Data[index] is LSL_Types.LSLString)
return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string);
return Convert.ToDouble(src.Data[index]); return Convert.ToDouble(src.Data[index]);
} }
catch (FormatException) catch (FormatException)