changeset 445:2d1bdd679f82

Re #350: Add requirement to allow N of unit for specific other units * Make method public so it is part of the API (additive units with an allowed number other than 1) * Fix up documentation
author IBBoard <dev@ibboard.co.uk>
date Thu, 15 Dec 2011 20:59:21 +0000
parents 206a45fdfa9e
children ca1e8f7c8b73
files API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs	Wed Dec 07 21:01:33 2011 +0000
+++ b/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs	Thu Dec 15 20:59:21 2011 +0000
@@ -243,11 +243,11 @@
 		/// </param>
 		public void AddUnitTypeRequirement(UnitType unitType, int allowedCount)
 		{
-			AddUnitTypeRequirement(unitType, 1, allowedCount);
+			AddUnitTypeRequirement(allowedCount, unitType);
 		}
 
 		/// <summary>
-		/// Adds a requirement for there to be one or more of a given UnitType, allowing one of this UnitType. If multiple unit types
+		/// Adds a requirement for there to be one or more of the given UnitTypes, allowing one of this UnitType. If multiple unit types
 		/// are supplied here then the number is additive (so 1 x unitType1 and 1 x unitType2 allows two of this UnitType).
 		/// </summary>
 		/// <param name='unitType'>
@@ -258,9 +258,19 @@
 			AddUnitTypeRequirement(1, unitTypes);
 		}
 
-		private void AddUnitTypeRequirement(int minCount, params UnitType[] unitTypes)
+		/// <summary>
+		/// Adds a requirement for there to be one or more of the given UnitTypes, allowing allowsAmount of this UnitType. If multiple unit types
+		/// are supplied here then the number is additive (so 1 x unitType1 and 1 x unitType2 allows two of this UnitType).
+		/// </summary>
+		/// <param name="allowsAmount">
+		/// The number of units to be allowed for each 1 of unitType
+		/// </param>
+		/// <param name='unitType'>
+		/// The unit type or types to require.
+		/// </param>
+		public void AddUnitTypeRequirement(int allowsAmount, params UnitType[] unitTypes)
 		{
-			requiredTypes.Add(new UnitCountRequirementData(unitTypes, minCount, 1));
+			requiredTypes.Add(new UnitCountRequirementData(unitTypes, 1, allowsAmount));
 		}
 	}
 }