diff API/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs @ 479:f48c49b53738

Re #410: "N units per M models in parent" requirement * Add a "context" object that will hold the parent unit (or possibly other stuff) * Update all method signatures and calls
author IBBoard <dev@ibboard.co.uk>
date Wed, 23 May 2012 20:56:27 +0100
parents 7b9ff7b1df24
children e0641e0eb86c
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs	Wed May 23 20:37:23 2012 +0100
+++ b/API/Objects/Requirement/RequiresAtLeastNUnitsRequirement.cs	Wed May 23 20:56:27 2012 +0100
@@ -30,29 +30,12 @@
 			}
 		}
 
-		/// <summary>
-		/// Checks whether the supplied WarFoundryObject can be added to the supplied army.
-		/// </summary>
-		/// <returns>
-		/// A <code>Validation</code> enum to show the result of the validation
-		/// </returns>
-		/// <param name='wfObject'>
-		/// The object that we want to add. This may be involved in the check, or it may not affect the evaluation of the requirement
-		/// </param>
-		/// <param name='toArmy'>
-		/// The army to add the object to.
-		/// </param>
-		public override Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy)
-		{
-			return IsApplicable(wfObject, toArmy) ? CheckAllowsAdding(wfObject, toArmy) : Validation.NotApplicable;
-		}
-
-		protected override bool IsApplicable(Army toArmy)
+		protected override bool IsApplicable(Army toArmy, AddingContext context)
 		{
 			return false;
 		}
 
-		protected override bool IsApplicable(IWarFoundryObject toObject)
+		protected override bool IsApplicable(IWarFoundryObject toObject, AddingContext context)
 		{
 			bool isApplicable = false;
 			UnitType unitType = GetUnitTypeFromObject(toObject);
@@ -79,7 +62,7 @@
 			return isApplicable;
 		}
 
-		private Validation CheckAllowsAdding(IWarFoundryObject wfObject, Army toArmy)
+		protected override Validation CheckAllowsAdding(IWarFoundryObject wfObject, Army toArmy, AddingContext context)
 		{
 			Validation isValid = Validation.Passed;