diff 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
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Jan 21 20:40:28 2012 +0000
+++ b/API/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Jan 22 19:17:06 2012 +0000
@@ -156,6 +156,7 @@
 			string name = elem.GetAttribute("typeName");
 			UnitType type = new UnitType(id, name, parentRace);
 			LoadCoreValuesForUnitType(elem, type);
+			parentRace.AddUnitType(type);
 			LoadEquipmentSlotsForUnitType(elem, type);
 			LoadEquipmentForUnitType(elem, type);
 			LoadAbilitiesForUnitType(elem, type);
@@ -163,7 +164,6 @@
 			LoadRequirementsForUnitType(elem, type);
 			LoadExtraDataForUnitType(elem, type);
 			LoadNotesForUnitType(elem, type);
-			parentRace.AddUnitType(type);
 			return type;
 		}