diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 004b53e..9f69ebb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1337,14 +1337,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1337 | 1337 | ||
1338 | public static explicit operator LSLInteger(LSLString s) | 1338 | public static explicit operator LSLInteger(LSLString s) |
1339 | { | 1339 | { |
1340 | Regex r = new Regex("^[ ]*-?[0-9][0-9]*"); | 1340 | Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*"); |
1341 | Match m = r.Match(s); | 1341 | Match m = r.Match(s); |
1342 | string v = m.Groups[0].Value; | 1342 | string v = m.Groups[0].Value; |
1343 | 1343 | ||
1344 | if (v == String.Empty) | 1344 | if (v == String.Empty) |
1345 | v = "0"; | 1345 | v = "0"; |
1346 | 1346 | ||
1347 | return new LSLInteger(int.Parse(v)); | 1347 | if (v.Contains("x") || v.Contains("X")) |
1348 | return new LSLInteger(int.Parse(v.Substring(2), System.Globalization.NumberStyles.HexNumber)); | ||
1349 | return new LSLInteger(int.Parse(v, System.Globalization.NumberStyles.Integer)); | ||
1348 | } | 1350 | } |
1349 | 1351 | ||
1350 | public static explicit operator LSLString(double d) | 1352 | public static explicit operator LSLString(double d) |
@@ -1468,14 +1470,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1468 | 1470 | ||
1469 | static public explicit operator LSLInteger(string s) | 1471 | static public explicit operator LSLInteger(string s) |
1470 | { | 1472 | { |
1471 | Regex r = new Regex("^[ ]*-?[0-9][0-9]*"); | 1473 | Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*"); |
1472 | Match m = r.Match(s); | 1474 | Match m = r.Match(s); |
1473 | string v = m.Groups[0].Value; | 1475 | string v = m.Groups[0].Value; |
1474 | 1476 | ||
1475 | if (v == String.Empty) | 1477 | if (v == String.Empty) |
1476 | v = "0"; | 1478 | v = "0"; |
1477 | 1479 | ||
1478 | return new LSLInteger(int.Parse(v)); | 1480 | if (v.Contains("x") || v.Contains("X")) |
1481 | return new LSLInteger(int.Parse(v.Substring(2), System.Globalization.NumberStyles.HexNumber)); | ||
1482 | return new LSLInteger(int.Parse(v, System.Globalization.NumberStyles.Integer)); | ||
1479 | } | 1483 | } |
1480 | 1484 | ||
1481 | static public implicit operator LSLInteger(uint u) | 1485 | static public implicit operator LSLInteger(uint u) |