Mercurial > repos > IBDev-IBBoard.WarFoundry.API
changeset 198:c4cf4c7db7d5
* Line ending fix
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 31 Oct 2009 20:55:19 +0000 |
parents | ec1cfe3ef94e |
children | 70ba3bee0c2e |
files | api/Factories/Xml/WarFoundryXmlRaceFactory.cs |
diffstat | 1 files changed, 44 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- 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)