Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Factories/Xml/WarFoundryXmlArmyFactory.cs @ 116:2010a7e8bf9a
Re #54: Add Army support to WarFoundryFactory
* Separate out army parsing to a separate class to make unit loading easier
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 22 Aug 2009 19:42:04 +0000 |
parents | 5ebbffd4a05f |
children |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlArmyFactory.cs Sat Aug 22 19:41:15 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlArmyFactory.cs Sat Aug 22 19:42:04 2009 +0000 @@ -17,27 +17,7 @@ { public Army CreateArmyFromElement(ZipFile file, XmlElement elem) { - string name = elem.GetAttribute("name"); - string systemID = elem.GetAttribute("system"); - GameSystem system = WarFoundryLoader.GetDefault().GetGameSystem(systemID); - - if (system == null) - { - throw new RequiredDataMissingException(file.Name, "gameSystem", systemID); - } - - string raceID = elem.GetAttribute("race"); - Race race = WarFoundryLoader.GetDefault().GetRace(system, raceID); - - if (race == null) - { - throw new RequiredDataMissingException(file.Name, "race", raceID); - } - - int points = XmlTools.GetIntValueFromAttribute(elem, "maxPoints"); - Army army = new Army(race, name, points, file); - //TODO: Complete loading of army - return army; + return new WarFoundryXmlArmyParser(file, elem).GetArmy(); } } }