Mercurial > repos > IBBoard.WarFoundry.API
diff api/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 222:2f9ad5385707
Re #228: Crash with missing abilityID
* Fix build failure because of duplicate variable name - not sure why VS.net didn't complain before first commit
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 13 Dec 2009 19:49:50 +0000 |
parents | 78f7456f6419 |
children | f097888efcfe |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Mon Dec 07 19:40:12 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sun Dec 13 19:49:50 2009 +0000 @@ -327,17 +327,17 @@ private void LoadAbilitiesForUnitType(XmlElement elem, UnitType type) { - foreach (XmlElement ability in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:unitAbilities/race:unitAbility")) + foreach (XmlElement abilityElem in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:unitAbilities/race:unitAbility")) { - string id = ability.GetAttribute("abilityID"); + string id = abilityElem.GetAttribute("abilityID"); Ability ability = type.Race.GetAbility(id); if (ability == null) { throw new InvalidFileException("Ability for "+type.Name+ " with ID "+id+ " did not exist in race definition"); } - - bool required = XmlTools.GetBoolValueFromAttribute(ability, "required"); + + bool required = XmlTools.GetBoolValueFromAttribute(abilityElem, "required"); type.AddAbility(ability, required); } }