diff options
author | Mike Mazur | 2008-07-28 07:46:53 +0000 |
---|---|---|
committer | Mike Mazur | 2008-07-28 07:46:53 +0000 |
commit | f6fa4ada4ea8680e49a47e2b9a5741c8d33ef74d (patch) | |
tree | 93ca486045152bb3d60903e395b84ab3fe51d701 /OpenSim/Region | |
parent | -implement LSLString -> Quaternion explicit cast (diff) | |
download | opensim-SC_OLD-f6fa4ada4ea8680e49a47e2b9a5741c8d33ef74d.zip opensim-SC_OLD-f6fa4ada4ea8680e49a47e2b9a5741c8d33ef74d.tar.gz opensim-SC_OLD-f6fa4ada4ea8680e49a47e2b9a5741c8d33ef74d.tar.bz2 opensim-SC_OLD-f6fa4ada4ea8680e49a47e2b9a5741c8d33ef74d.tar.xz |
When casting strings to int, use double.Parse() as strings may be floats. With
this commit, issue 1822 should be fixed.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 74c9935..d0a5079 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -1172,7 +1172,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1172 | 1172 | ||
1173 | public static explicit operator LSLInteger(LSLString s) | 1173 | public static explicit operator LSLInteger(LSLString s) |
1174 | { | 1174 | { |
1175 | return new LSLInteger(Convert.ToInt32(s.m_string)); | 1175 | // double.Parse() used because s could be "123.9" for example. |
1176 | return new LSLInteger(double.Parse(s.m_string)); | ||
1176 | } | 1177 | } |
1177 | 1178 | ||
1178 | public static explicit operator LSLString(double d) | 1179 | public static explicit operator LSLString(double d) |
@@ -1283,7 +1284,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1283 | 1284 | ||
1284 | static public explicit operator LSLInteger(string s) | 1285 | static public explicit operator LSLInteger(string s) |
1285 | { | 1286 | { |
1286 | return new LSLInteger(int.Parse(s)); | 1287 | // double.Parse() used because s could be "123.9" for example. |
1288 | return new LSLInteger(double.Parse(s)); | ||
1287 | } | 1289 | } |
1288 | 1290 | ||
1289 | static public implicit operator LSLInteger(uint u) | 1291 | static public implicit operator LSLInteger(uint u) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 57394d9..c42e3e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1172,7 +1172,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1172 | 1172 | ||
1173 | public static explicit operator LSLInteger(LSLString s) | 1173 | public static explicit operator LSLInteger(LSLString s) |
1174 | { | 1174 | { |
1175 | return new LSLInteger(Convert.ToInt32(s.m_string)); | 1175 | // double.Parse() used because s could be "123.9" for example. |
1176 | return new LSLInteger(double.Parse(s.m_string)); | ||
1176 | } | 1177 | } |
1177 | 1178 | ||
1178 | public static explicit operator LSLString(double d) | 1179 | public static explicit operator LSLString(double d) |
@@ -1283,7 +1284,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1283 | 1284 | ||
1284 | static public explicit operator LSLInteger(string s) | 1285 | static public explicit operator LSLInteger(string s) |
1285 | { | 1286 | { |
1286 | return new LSLInteger(int.Parse(s)); | 1287 | // double.Parse() used because s could be "123.9" for example. |
1288 | return new LSLInteger(double.Parse(s)); | ||
1287 | } | 1289 | } |
1288 | 1290 | ||
1289 | static public implicit operator LSLInteger(uint u) | 1291 | static public implicit operator LSLInteger(uint u) |