# HG changeset patch # User IBBoard # Date 1257022519 0 # Node ID c4cf4c7db7d5d644cb4636a8df8d6355ce8d5d3a # Parent ec1cfe3ef94e49379c5f63d57276f1d33e4936ed * Line ending fix no-open-ticket diff -r ec1cfe3ef94e -r c4cf4c7db7d5 api/Factories/Xml/WarFoundryXmlRaceFactory.cs --- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Fri Oct 30 21:02:48 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Oct 31 20:55:19 2009 +0000 @@ -182,30 +182,30 @@ private static AbstractLimit GetLimitFromElement(XmlElement limitElem) { - AbstractLimit limit = null; - - if (limitElem != null) - { - switch (limitElem.LocalName) - { - case "percentageLimit": - double limitPercent = XmlTools.GetDoubleValueFromAttribute(limitElem, "limit"); - bool roundUp = limitElem.GetAttribute("round").Equals("up"); - limit = new SimpleRoundedPercentageLimit(limitPercent, roundUp); - break; - case "sizeConstrainedLimit": - limit = new NumericSizeConstrainedLimit(XmlTools.GetIntValueFromAttribute(limitElem, "limit")); - break; - case "absoluteLimit": - limit = new AbsoluteNumericLimit(XmlTools.GetIntValueFromAttribute(limitElem, "limit")); - break; - case "unitSizeLimit": - limit = new NumericSizeConstrainedLimit(); - break; - default: - //TODO: Warn of missing handler for when we've extended the limit list - break; - } + AbstractLimit limit = null; + + if (limitElem != null) + { + switch (limitElem.LocalName) + { + case "percentageLimit": + double limitPercent = XmlTools.GetDoubleValueFromAttribute(limitElem, "limit"); + bool roundUp = limitElem.GetAttribute("round").Equals("up"); + limit = new SimpleRoundedPercentageLimit(limitPercent, roundUp); + break; + case "sizeConstrainedLimit": + limit = new NumericSizeConstrainedLimit(XmlTools.GetIntValueFromAttribute(limitElem, "limit")); + break; + case "absoluteLimit": + limit = new AbsoluteNumericLimit(XmlTools.GetIntValueFromAttribute(limitElem, "limit")); + break; + case "unitSizeLimit": + limit = new NumericSizeConstrainedLimit(); + break; + default: + //TODO: Warn of missing handler for when we've extended the limit list + break; + } } return limit; @@ -260,20 +260,20 @@ { throw new InvalidFileException("Attribute 'equipmentSlot' of unit equipment item " + id + " for " + type.Name + " was not a valid slot name"); } - } - - AbstractLimit limit = GetMaxLimit(equip); - - if (limit != null) - { - unitEquipItem.MaxLimit = limit; - } - - limit = GetMinLimit(equip); - - if (limit != null) - { - unitEquipItem.MinLimit = limit; + } + + AbstractLimit limit = GetMaxLimit(equip); + + if (limit != null) + { + unitEquipItem.MaxLimit = limit; + } + + limit = GetMinLimit(equip); + + if (limit != null) + { + unitEquipItem.MinLimit = limit; } unitEquipItem.RoundNumberUp = equip.GetAttribute("roundDirection").Equals("up"); @@ -310,12 +310,12 @@ throw new InvalidFileException("Equipment item with ID '" + id + "' was required by " + type.Name + " but was not found"); } } - } - - private static AbstractLimit GetMinLimit(XmlElement elem) - { - XmlElement limitElem = WarFoundryXmlFactoryUtils.SelectSingleElement(elem, "race:minLimit/*[1]"); - return GetLimitFromElement(limitElem); + } + + private static AbstractLimit GetMinLimit(XmlElement elem) + { + XmlElement limitElem = WarFoundryXmlFactoryUtils.SelectSingleElement(elem, "race:minLimit/*[1]"); + return GetLimitFromElement(limitElem); } private void LoadAbilitiesForUnitType(XmlElement elem, UnitType type)