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 diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Jul 23 19:53:42 2011 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Jul 23 20:01:26 2011 +0000
     1.3 @@ -397,7 +397,7 @@
     1.4  			foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:requirements/race:requirement"))
     1.5  			{
     1.6  				string name = extraData.GetAttribute("requirementName");
     1.7 -				UnitRequiresAtLeastNUnitsRequirementFactory reqFactory = GetRequirementFactory(name);
     1.8 +				IRequirementFactory reqFactory = WarFoundryLoader.GetRequirementFactory(name);
     1.9  
    1.10  				if (reqFactory != null) {
    1.11  					string data = WarFoundryXmlFactoryUtils.SelectSingleElement(extraData, "race:data").InnerText;
    1.12 @@ -405,19 +405,6 @@
    1.13  					type.AddRequirement(req);
    1.14  				}
    1.15  			}
    1.16 -		}
    1.17 -
    1.18 -		private UnitRequiresAtLeastNUnitsRequirementFactory GetRequirementFactory (string name)
    1.19 -		{
    1.20 -		
    1.21 -			UnitRequiresAtLeastNUnitsRequirementFactory factory = null;
    1.22 -			
    1.23 -			if ("RequiresAtLeastNUnits".Equals(name))
    1.24 -			{
    1.25 -				factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.26 -			}
    1.27 -
    1.28 -			return factory;
    1.29  		}
    1.30  		
    1.31  		private void LoadExtraDataForUnitType(XmlElement elem, UnitType type)