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 wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Apr 05 13:45:23 2009 +0000
+++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Apr 05 19:21:51 2009 +0000
@@ -44,7 +44,7 @@
 			string subid = elem.GetAttribute("subid");
 			string systemID = elem.GetAttribute("system");
 			string name = elem.GetAttribute("name");
-			Race race = new Race(id, subid, name, systemID, mainFactory);
+			Race race = new Race(id, subid, name, WarFoundryLoader.GetDefault().GetGameSystem(systemID), mainFactory);
 			StoreExtraData(race, elem);
 			return race;
 		}
@@ -155,7 +155,7 @@
 		{
 			string id = elem.GetAttribute("id");
 			string name = elem.GetAttribute("name");
-			double cost = 0, min = 0, max = 0;
+			double cost = 0;
 			ArmourType armourType;
 			
 			try
@@ -177,8 +177,11 @@
 			}
 			
 			//TODO: Parse equipment stats if there are any
+			EquipmentItem item = new EquipmentItem(id, name, race);
+			item.Cost = cost;
+			item.ItemArmourType = armourType;
 			
-			return new EquipmentItem(id, name, cost, min, max, armourType, race);
+			return item;
 		}
 		
 		private Ability CreateAbilityFromElement(XmlElement elem, Race race)
--- a/api/Objects/Race.cs	Sun Apr 05 13:45:23 2009 +0000
+++ b/api/Objects/Race.cs	Sun Apr 05 19:21:51 2009 +0000
@@ -230,12 +230,7 @@
 		public List<Ability> GetAbilityList()
 		{
 			List<Ability> items = new List<Ability>();
-			
-			foreach (Ability ability in abilities.Values)
-			{
-				items.Add(ability);
-			}
-			
+			items.AddRange(abilities.Values);			
 			return items;
 		}