diff options
author | Melanie Thielker | 2010-08-22 16:23:36 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-08-22 16:23:36 +0200 |
commit | 0ca771c1850780d0be87b5f16f282b46f9bd4936 (patch) | |
tree | 1166f69e67ca3adcfd34f572084e424323d5eb15 /OpenSim/Region/ScriptEngine | |
parent | Revert "Fix a typecasting issue in llList2Float. This addresses mantis #262" (diff) | |
download | opensim-SC_OLD-0ca771c1850780d0be87b5f16f282b46f9bd4936.zip opensim-SC_OLD-0ca771c1850780d0be87b5f16f282b46f9bd4936.tar.gz opensim-SC_OLD-0ca771c1850780d0be87b5f16f282b46f9bd4936.tar.bz2 opensim-SC_OLD-0ca771c1850780d0be87b5f16f282b46f9bd4936.tar.xz |
Provide a better implementation of llList2Float
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5caade6..ca09705 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5123,7 +5123,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5123 | else if (src.Data[index] is LSL_Float) | 5123 | else if (src.Data[index] is LSL_Float) |
5124 | return Convert.ToDouble(((LSL_Float) src.Data[index]).value); | 5124 | return Convert.ToDouble(((LSL_Float) src.Data[index]).value); |
5125 | else if (src.Data[index] is LSL_String) | 5125 | else if (src.Data[index] is LSL_String) |
5126 | return Convert.ToDouble(((LSL_String) src.Data[index]).m_string); | 5126 | { |
5127 | string str = ((LSL_String) src.Data[index]).m_string; | ||
5128 | Match m = Regex.Match(str, "^\\s*(-?+?[0-9,]+\\.?[0-9]*)"); | ||
5129 | if (m != Match.Empty) | ||
5130 | { | ||
5131 | str = m.Value; | ||
5132 | double d = 0.0; | ||
5133 | if (!Double.TryParse(str, out d)) | ||
5134 | return 0.0; | ||
5135 | |||
5136 | return d; | ||
5137 | } | ||
5138 | return 0.0; | ||
5139 | } | ||
5127 | return Convert.ToDouble(src.Data[index]); | 5140 | return Convert.ToDouble(src.Data[index]); |
5128 | } | 5141 | } |
5129 | catch (FormatException) | 5142 | catch (FormatException) |