# HG changeset patch # User IBBoard # Date 1237655073 0 # Node ID 3664eee50390836bdb12ded5e380ffe4c1e223c6 # Parent 05c6745cc660804b9f87f7c2e79738f356ec9f65 Fixes #47 - remove magic numbers * Create "infinity" in core types * Redefine special core types without trying to use non-existant INF for Integers * Use new types in Cats and Race * Remove special handling of INF when parsing an integer attribute Closes #46 - Resolve problems using custom restrictions of decimal and double * New schemas seem to work without exceptioning diff -r 05c6745cc660 -r 3664eee50390 api/Factories/Xml/WarFoundryXmlFactory.cs --- a/api/Factories/Xml/WarFoundryXmlFactory.cs Thu Mar 19 20:12:29 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlFactory.cs Sat Mar 21 17:04:33 2009 +0000 @@ -381,26 +381,14 @@ private int GetIntValueFromAttribute(XmlElement elem, string attributeName) { - string attribValue = elem.GetAttribute(attributeName); - int intValue = int.MaxValue; - - if ("INF".Equals(attribValue)) - { - intValue = WarFoundryCore.INFINITY; - } - else + try { - try - { - intValue = int.Parse(attribValue); - } - catch(FormatException) - { - throw new FormatException(String.Format("Attribute '{0}' of {1} with ID {2} was not a valid number", attributeName, elem.Name, elem.GetAttribute("id"))); - } + return int.Parse(elem.GetAttribute(attributeName)); } - - return intValue; + catch(FormatException) + { + throw new FormatException(String.Format("Attribute '{0}' of {1} with ID {2} was not a valid number", attributeName, elem.Name, elem.GetAttribute("id"))); + } } private UnitType CreateUnitTypeFromElement(XmlElement elem, Race parentRace, GameSystem system) diff -r 05c6745cc660 -r 3664eee50390 dtds/race.xsd --- a/dtds/race.xsd Thu Mar 19 20:12:29 2009 +0000 +++ b/dtds/race.xsd Sat Mar 21 17:04:33 2009 +0000 @@ -33,12 +33,12 @@ - - + + - + - + @@ -62,8 +62,8 @@ - - + + @@ -126,7 +126,7 @@ - + diff -r 05c6745cc660 -r 3664eee50390 dtds/warfoundry-cats.xsd --- a/dtds/warfoundry-cats.xsd Thu Mar 19 20:12:29 2009 +0000 +++ b/dtds/warfoundry-cats.xsd Sat Mar 21 17:04:33 2009 +0000 @@ -8,7 +8,7 @@ - + diff -r 05c6745cc660 -r 3664eee50390 dtds/warfoundry-core.xsd --- a/dtds/warfoundry-core.xsd Thu Mar 19 20:12:29 2009 +0000 +++ b/dtds/warfoundry-core.xsd Sat Mar 21 17:04:33 2009 +0000 @@ -1,17 +1,24 @@ - + + + + + + + + + + + + + - - - - - - +