Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 170:3045a168714a WarFoundry_v0.1beta4_Winforms WarFoundry_v0.1beta5_Winforms
* Line ending clean-up
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 11 Oct 2009 19:57:34 +0000 |
parents | 9ba56a8e5096 |
children | 85dc413279a4 |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Tue Oct 06 18:29:07 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sun Oct 11 19:57:34 2009 +0000 @@ -111,7 +111,7 @@ { string name = elem.GetAttribute("typeName"); UnitType type = new UnitType(id, name, parentRace); - LoadCoreValuesForUnitType(elem, type); + LoadCoreValuesForUnitType(elem, type); LoadEquipmentSlotsForUnitType(elem, type); LoadEquipmentForUnitType(elem, type); LoadAbilitiesForUnitType(elem, type); @@ -151,17 +151,17 @@ type.MainCategory = cat; XmlElement statsElement = WarFoundryXmlFactoryUtils.SelectSingleElement(elem, "race:stats"); Stats unitStats = ParseUnitStats(statsElement, type.GameSystem); - type.SetUnitStats(unitStats); - } - - private void LoadEquipmentSlotsForUnitType(XmlElement elem, UnitType type) - { - foreach (XmlElement equip in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:equipmentSlots/race:equipmentSlot")) - { - string slotName = equip.GetAttribute("name"); - int slotLimit = XmlTools.GetIntValueFromAttribute(equip, "limit"); - type.AddEquipmentSlot(slotName, slotLimit); - } + type.SetUnitStats(unitStats); + } + + private void LoadEquipmentSlotsForUnitType(XmlElement elem, UnitType type) + { + foreach (XmlElement equip in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:equipmentSlots/race:equipmentSlot")) + { + string slotName = equip.GetAttribute("name"); + int slotLimit = XmlTools.GetIntValueFromAttribute(equip, "limit"); + type.AddEquipmentSlot(slotName, slotLimit); + } } private void LoadEquipmentForUnitType(XmlElement elem, UnitType type) @@ -198,20 +198,20 @@ mutexGroups = new string[0]; } - UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups); - - string equipSlot = equip.GetAttribute("equipmentSlot"); - - if (equipSlot != "") - { - if (type.HasEquipmentSlot(equipSlot)) - { - unitEquipItem.SlotName = equipSlot; - } - else - { - throw new InvalidFileException("Attribute 'equipmentSlot' of unit equipment item " + id + " for " + type.Name + " was not a valid slot name"); - } + UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups); + + string equipSlot = equip.GetAttribute("equipmentSlot"); + + if (equipSlot != "") + { + if (type.HasEquipmentSlot(equipSlot)) + { + unitEquipItem.SlotName = equipSlot; + } + else + { + throw new InvalidFileException("Attribute 'equipmentSlot' of unit equipment item " + id + " for " + type.Name + " was not a valid slot name"); + } } unitEquipItem.RoundNumberUp = equip.GetAttribute("roundDirection").Equals("up");