diff api/Commands/CreateAndAddUnitCommand.cs @ 58:e53ed2d613a1

Re #61 - Complete structure of WarFoundry API objects * Migrate AddUnit/RemoveUnit methods to Army for easier army loading * Migrate requirement checking call to Army, since ArmyCategory just called parent army anyway Also: * Use genericed collections in Army * Remove failed unit requirements from ArmyCategory * Alter army.xsd to stop negatives in equipment amounts
author IBBoard <dev@ibboard.co.uk>
date Tue, 07 Apr 2009 15:28:06 +0000
parents 306558904c2a
children 3ea0ab04352b
line wrap: on
line diff
--- a/api/Commands/CreateAndAddUnitCommand.cs	Tue Apr 07 14:43:04 2009 +0000
+++ b/api/Commands/CreateAndAddUnitCommand.cs	Tue Apr 07 15:28:06 2009 +0000
@@ -13,16 +13,20 @@
 	{
 		private UnitType addedUnitType;
 		private Army army;
-		private ArmyCategory cat;
-		private Unit addedUnit;
-
-		public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory catTo, Army armyTo)
+		private Unit addedUnit;
+		
+		public CreateAndAddUnitCommand(UnitType toAdd, Army armyTo)
+		{
+			addedUnitType = toAdd;
+			army = armyTo;
+		}
+
+		[Obsolete("Use two parameter constructor instead")]
+		public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory catTo, Army armyTo) : this(toAdd, armyTo)
 		{
-			addedUnitType = toAdd;
-			cat = catTo;
-			army = armyTo;
 		}
-
+
+		[Obsolete("Use two parameter constructor instead")]
 		public CreateAndAddUnitCommand(UnitType toAdd, Category catTo, Army armyTo) : this (toAdd, armyTo.GetCategory(catTo), armyTo)
 		{
 		}
@@ -51,12 +55,12 @@
 
 		public override void Redo()
 		{
-			cat.AddUnit(addedUnit);
+			army.AddUnit(addedUnit);
 		}
 
 		public override void Undo()
 		{
-			cat.RemoveUnit(addedUnit);
+			army.RemoveUnit(addedUnit);
 		}