Mantis #511
Allow parsing of hexadecimal int constants from strings. Also fixes a DBNull value in the touch type field crashing the sim0.6.0-stable
							parent
							
								
									b9b996be38
								
							
						
					
					
						commit
						a68e34b558
					
				| 
						 | 
				
			
			@ -1226,7 +1226,8 @@ namespace OpenSim.Data.MySQL
 | 
			
		|||
            prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
 | 
			
		||||
            prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
 | 
			
		||||
 | 
			
		||||
            prim.ClickAction = Convert.ToByte(row["ClickAction"]);
 | 
			
		||||
            if (!row.IsNull("ClickAction"))
 | 
			
		||||
                prim.ClickAction = Convert.ToByte(row["ClickAction"]);
 | 
			
		||||
 | 
			
		||||
            return prim;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1337,14 +1337,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
 | 
			
		|||
 | 
			
		||||
            public static explicit operator LSLInteger(LSLString s)
 | 
			
		||||
            {
 | 
			
		||||
                Regex r = new Regex("^[ ]*-?[0-9][0-9]*");
 | 
			
		||||
                Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*");
 | 
			
		||||
                Match m = r.Match(s);
 | 
			
		||||
                string v = m.Groups[0].Value;
 | 
			
		||||
 | 
			
		||||
                if (v == String.Empty)
 | 
			
		||||
                    v = "0";
 | 
			
		||||
 | 
			
		||||
                return new LSLInteger(int.Parse(v));
 | 
			
		||||
                if (v.Contains("x") || v.Contains("X"))
 | 
			
		||||
                    return new LSLInteger(int.Parse(v.Substring(2), System.Globalization.NumberStyles.HexNumber));
 | 
			
		||||
                return new LSLInteger(int.Parse(v, System.Globalization.NumberStyles.Integer));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public static explicit operator LSLString(double d)
 | 
			
		||||
| 
						 | 
				
			
			@ -1468,14 +1470,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
 | 
			
		|||
 | 
			
		||||
            static public explicit operator LSLInteger(string s)
 | 
			
		||||
            {
 | 
			
		||||
                Regex r = new Regex("^[ ]*-?[0-9][0-9]*");
 | 
			
		||||
                Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*");
 | 
			
		||||
                Match m = r.Match(s);
 | 
			
		||||
                string v = m.Groups[0].Value;
 | 
			
		||||
 | 
			
		||||
                if (v == String.Empty)
 | 
			
		||||
                    v = "0";
 | 
			
		||||
 | 
			
		||||
                return new LSLInteger(int.Parse(v));
 | 
			
		||||
                if (v.Contains("x") || v.Contains("X"))
 | 
			
		||||
                    return new LSLInteger(int.Parse(v.Substring(2), System.Globalization.NumberStyles.HexNumber));
 | 
			
		||||
                return new LSLInteger(int.Parse(v, System.Globalization.NumberStyles.Integer));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            static public implicit operator LSLInteger(uint u)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue