comparison API/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 374:13793f3a2a2e

Re #351: Add extensible requirement handling method * Add initial conditional to fetching of factory * Exception if content isn't correct
author IBBoard <dev@ibboard.co.uk>
date Sat, 02 Jul 2011 14:59:45 +0000
parents bfdb95906075
children e50682387d63
comparison
equal deleted inserted replaced
373:e10630f39ec2 374:13793f3a2a2e
386 type.AddRequirement(req); 386 type.AddRequirement(req);
387 } 387 }
388 } 388 }
389 } 389 }
390 390
391 UnitRequiresAtLeastNUnitsRequirementFactory GetRequirementFactory (string name) 391 private UnitRequiresAtLeastNUnitsRequirementFactory GetRequirementFactory (string name)
392 { 392 {
393 return new UnitRequiresAtLeastNUnitsRequirementFactory(); 393
394 UnitRequiresAtLeastNUnitsRequirementFactory factory = null;
395
396 if ("RequiresAtLeastNUnits".Equals(name))
397 {
398 factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
399 }
400
401 return factory;
394 } 402 }
395 403
396 private void LoadExtraDataForUnitType(XmlElement elem, UnitType type) 404 private void LoadExtraDataForUnitType(XmlElement elem, UnitType type)
397 { 405 {
398 foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:extraData/race:data")) 406 foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:extraData/race:data"))