aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-10 06:14:38 +0000
committerMelanie Thielker2008-09-10 06:14:38 +0000
commita68e34b5587723899cbc20e6e27a47ad01234718 (patch)
treee69778c8fb25b9407e0e94440349ab5049ed7186 /OpenSim
parentUpdate svn properties, minor formatting cleanup. (diff)
downloadopensim-SC_OLD-a68e34b5587723899cbc20e6e27a47ad01234718.zip
opensim-SC_OLD-a68e34b5587723899cbc20e6e27a47ad01234718.tar.gz
opensim-SC_OLD-a68e34b5587723899cbc20e6e27a47ad01234718.tar.bz2
opensim-SC_OLD-a68e34b5587723899cbc20e6e27a47ad01234718.tar.xz
Mantis #511
Allow parsing of hexadecimal int constants from strings. Also fixes a DBNull value in the touch type field crashing the sim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs12
2 files changed, 10 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 920a001..9c36d49 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -1226,7 +1226,8 @@ namespace OpenSim.Data.MySQL
1226 prim.SalePrice = Convert.ToInt32(row["SalePrice"]); 1226 prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
1227 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); 1227 prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
1228 1228
1229 prim.ClickAction = Convert.ToByte(row["ClickAction"]); 1229 if (!row.IsNull("ClickAction"))
1230 prim.ClickAction = Convert.ToByte(row["ClickAction"]);
1230 1231
1231 return prim; 1232 return prim;
1232 } 1233 }
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)