Mercurial > repos > IBBoard.WarFoundry.API
changeset 380:7036bf04e955
Re #351: Add extensible requirement handling method
* Move to using registered requirement factories
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 23 Jul 2011 20:01:26 +0000 |
parents | 04f4c2fea356 |
children | 30db6669f5cd |
files | API/Factories/Xml/WarFoundryXmlRaceFactory.cs |
diffstat | 1 files changed, 1 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Jul 23 19:53:42 2011 +0000 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Jul 23 20:01:26 2011 +0000 @@ -397,7 +397,7 @@ foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:requirements/race:requirement")) { string name = extraData.GetAttribute("requirementName"); - UnitRequiresAtLeastNUnitsRequirementFactory reqFactory = GetRequirementFactory(name); + IRequirementFactory reqFactory = WarFoundryLoader.GetRequirementFactory(name); if (reqFactory != null) { string data = WarFoundryXmlFactoryUtils.SelectSingleElement(extraData, "race:data").InnerText; @@ -405,19 +405,6 @@ type.AddRequirement(req); } } - } - - private UnitRequiresAtLeastNUnitsRequirementFactory GetRequirementFactory (string name) - { - - UnitRequiresAtLeastNUnitsRequirementFactory factory = null; - - if ("RequiresAtLeastNUnits".Equals(name)) - { - factory = new UnitRequiresAtLeastNUnitsRequirementFactory(); - } - - return factory; } private void LoadExtraDataForUnitType(XmlElement elem, UnitType type)