changeset 55:9080366031c0

Re #9 - Refactor for small methods * Replace use of obsolete constructors with small constructors and property setting
author IBBoard <dev@ibboard.co.uk>
date Sun, 05 Apr 2009 19:21:51 +0000
parents 3a90f70dac73
children 9561ef46c6fb
files api/Factories/Xml/WarFoundryXmlRaceFactory.cs api/Objects/Race.cs
diffstat 2 files changed, 7 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Apr 05 13:45:23 2009 +0000
     1.2 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Apr 05 19:21:51 2009 +0000
     1.3 @@ -44,7 +44,7 @@
     1.4  			string subid = elem.GetAttribute("subid");
     1.5  			string systemID = elem.GetAttribute("system");
     1.6  			string name = elem.GetAttribute("name");
     1.7 -			Race race = new Race(id, subid, name, systemID, mainFactory);
     1.8 +			Race race = new Race(id, subid, name, WarFoundryLoader.GetDefault().GetGameSystem(systemID), mainFactory);
     1.9  			StoreExtraData(race, elem);
    1.10  			return race;
    1.11  		}
    1.12 @@ -155,7 +155,7 @@
    1.13  		{
    1.14  			string id = elem.GetAttribute("id");
    1.15  			string name = elem.GetAttribute("name");
    1.16 -			double cost = 0, min = 0, max = 0;
    1.17 +			double cost = 0;
    1.18  			ArmourType armourType;
    1.19  			
    1.20  			try
    1.21 @@ -177,8 +177,11 @@
    1.22  			}
    1.23  			
    1.24  			//TODO: Parse equipment stats if there are any
    1.25 +			EquipmentItem item = new EquipmentItem(id, name, race);
    1.26 +			item.Cost = cost;
    1.27 +			item.ItemArmourType = armourType;
    1.28  			
    1.29 -			return new EquipmentItem(id, name, cost, min, max, armourType, race);
    1.30 +			return item;
    1.31  		}
    1.32  		
    1.33  		private Ability CreateAbilityFromElement(XmlElement elem, Race race)
     2.1 --- a/api/Objects/Race.cs	Sun Apr 05 13:45:23 2009 +0000
     2.2 +++ b/api/Objects/Race.cs	Sun Apr 05 19:21:51 2009 +0000
     2.3 @@ -230,12 +230,7 @@
     2.4  		public List<Ability> GetAbilityList()
     2.5  		{
     2.6  			List<Ability> items = new List<Ability>();
     2.7 -			
     2.8 -			foreach (Ability ability in abilities.Values)
     2.9 -			{
    2.10 -				items.Add(ability);
    2.11 -			}
    2.12 -			
    2.13 +			items.AddRange(abilities.Values);			
    2.14  			return items;
    2.15  		}
    2.16