Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison 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 |
comparison
equal
deleted
inserted
replaced
122:571eee2b7b30 | 123:52e8c3cdde10 |
---|---|
73 | 73 |
74 if (unitType == null) | 74 if (unitType == null) |
75 { | 75 { |
76 throw new RequiredDataMissingException(file.Name, "unitType", unitTypeId); | 76 throw new RequiredDataMissingException(file.Name, "unitType", unitTypeId); |
77 } | 77 } |
78 | |
79 string name = unitElem.GetAttribute("unitName"); | |
80 int size = XmlTools.GetIntValueFromAttribute(unitElem, "size"); | |
78 | 81 |
79 Unit unit = new Unit(unitType, army.GetCategory(unitType.MainCategory)); | 82 Unit unit = new Unit(id, name, size, unitType, army.GetCategory(unitType.MainCategory)); |
80 army.AddUnit(unit); | 83 army.AddUnit(unit); |
81 units.Add(id, unit); | 84 units.Add(id, unit); |
82 | 85 |
83 LoadUnitEquipment(unitElem, unit); | 86 LoadUnitEquipment(unitElem, unit); |
84 } | 87 } |