diff api/Factories/Xml/WarFoundryXmlArmyParser.cs @ 123:52e8c3cdde10

Re #127: Unit creation always assigns default equipment * Add and use new constructor for Unit that doesn't assign default values Re #54: Add Army support to WarFoundryFactory * Load unit name and unit size
author IBBoard <dev@ibboard.co.uk>
date Mon, 24 Aug 2009 19:30:19 +0000
parents 53654e938982
children df61d26c23fb
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Sun Aug 23 11:07:47 2009 +0000
+++ b/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Mon Aug 24 19:30:19 2009 +0000
@@ -75,8 +75,11 @@
 					{
 						throw new RequiredDataMissingException(file.Name, "unitType", unitTypeId);
 					}
+					
+					string name = unitElem.GetAttribute("unitName");
+					int size = XmlTools.GetIntValueFromAttribute(unitElem, "size");
 
-					Unit unit = new Unit(unitType, army.GetCategory(unitType.MainCategory));
+					Unit unit = new Unit(id, name, size, unitType, army.GetCategory(unitType.MainCategory));
 					army.AddUnit(unit);
 					units.Add(id, unit);