diff api/Objects/Army.cs @ 259:35dc06030355

Re #270: Add multiple categories to API * Add "category" attribute to army schema * Add method to define category when adding unit to army * Make army loading check new attribute and assign to correct category or main category TODO: Write out category of unit to army file
author IBBoard <dev@ibboard.co.uk>
date Wed, 19 May 2010 20:07:07 +0000
parents 7f13ffcb8765
children 92d10b06ab0f
line wrap: on
line diff
--- a/api/Objects/Army.cs	Wed May 19 19:23:29 2010 +0000
+++ b/api/Objects/Army.cs	Wed May 19 20:07:07 2010 +0000
@@ -169,7 +169,13 @@
 		
 		public void AddUnit(Unit unit)
 		{
-			ArmyCategory armyCat = GetCategory(unit.UnitType.MainCategory);
+			Category category = unit.UnitType.MainCategory;
+			AddUnit(unit, category);
+		}
+		
+		public void AddUnit(Unit unit, Category category)
+		{			
+			ArmyCategory armyCat = GetCategory(category);
 			armyCat.AddUnit(unit);
 		}