diff api/Objects/Race.cs @ 47:85f2b9c3609c

Re #13 - Use XPath for file loading * Replace loading of race unit types, categories and equipment with XPath method * Add loading of abilities using XPath Also: * Add implementation for Ability * Add AddAbility method to Race * Alter some logging so that "for ID" is followed by ID not name
author IBBoard <dev@ibboard.co.uk>
date Thu, 26 Mar 2009 20:49:42 +0000
parents 306558904c2a
children 3a90f70dac73
line wrap: on
line diff
--- a/api/Objects/Race.cs	Mon Mar 23 20:57:07 2009 +0000
+++ b/api/Objects/Race.cs	Thu Mar 26 20:49:42 2009 +0000
@@ -238,9 +238,19 @@
 			return items;
 		}
 		
+		public void AddAbility(Ability newAbility)
+		{
+			//TODO: Throw DuplicateItemException
+			abilities.Add(newAbility.ID, newAbility);
+		}
+
+		[Obsolete("Use AddAbility method instead")]
 		public void SetAbilities(Dictionary<string, Ability> newAbilities)
 		{
-			abilities = newAbilities;
+			foreach (Ability ability in newAbilities.Values)
+			{
+				AddAbility(ability);
+			}
 		}
 				
 		public Ability GetAbility(string id)