Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison API/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 450:8811737baebf
Fixes #352: Test/fix cyclic references in unit types
* Tell the Race it has a new UnitType earlier to resolve load loops
* Update example data file to one that uses all requirements, but caused cyclic issues
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 22 Jan 2012 19:17:06 +0000 |
parents | 7036bf04e955 |
children | 2ba1f24eb427 |
comparison
equal
deleted
inserted
replaced
449:ba6c762cdfc3 | 450:8811737baebf |
---|---|
154 private UnitType CreateUnitTypeFromElement(XmlElement elem, string id, Race parentRace) | 154 private UnitType CreateUnitTypeFromElement(XmlElement elem, string id, Race parentRace) |
155 { | 155 { |
156 string name = elem.GetAttribute("typeName"); | 156 string name = elem.GetAttribute("typeName"); |
157 UnitType type = new UnitType(id, name, parentRace); | 157 UnitType type = new UnitType(id, name, parentRace); |
158 LoadCoreValuesForUnitType(elem, type); | 158 LoadCoreValuesForUnitType(elem, type); |
159 parentRace.AddUnitType(type); | |
159 LoadEquipmentSlotsForUnitType(elem, type); | 160 LoadEquipmentSlotsForUnitType(elem, type); |
160 LoadEquipmentForUnitType(elem, type); | 161 LoadEquipmentForUnitType(elem, type); |
161 LoadAbilitiesForUnitType(elem, type); | 162 LoadAbilitiesForUnitType(elem, type); |
162 LoadContainedUnitsForUnitType(elem, type); | 163 LoadContainedUnitsForUnitType(elem, type); |
163 LoadRequirementsForUnitType(elem, type); | 164 LoadRequirementsForUnitType(elem, type); |
164 LoadExtraDataForUnitType(elem, type); | 165 LoadExtraDataForUnitType(elem, type); |
165 LoadNotesForUnitType(elem, type); | 166 LoadNotesForUnitType(elem, type); |
166 parentRace.AddUnitType(type); | |
167 return type; | 167 return type; |
168 } | 168 } |
169 | 169 |
170 private void LoadCoreValuesForUnitType(XmlElement elem, UnitType type) | 170 private void LoadCoreValuesForUnitType(XmlElement elem, UnitType type) |
171 { | 171 { |