changeset 342:407757e597f9

Re #27: Unit requirements * Correct documentation * Add "limit to none" method
author IBBoard <dev@ibboard.co.uk>
date Mon, 04 Apr 2011 19:45:38 +0000
parents 5f94b8a40876
children acd390dba551
files API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs	Mon Apr 04 19:28:44 2011 +0000
+++ b/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs	Mon Apr 04 19:45:38 2011 +0000
@@ -20,7 +20,7 @@
 
 			foreach (UnitType unitType in limitedUnitTypes)
 			{
-				AddUnitTypeRequirement(unitType, 0);
+				AddUnitTypeRequirement(unitType);
 			}
 		}
 
@@ -53,17 +53,28 @@
 		}
 
 		/// <summary>
-		/// Adds a requirement for there to be at least minCount of a given UnitType
+		/// Adds a requirement for there to be no more than maxCount of a given UnitType
 		/// </summary>
 		/// <param name='unitType'>
-		/// The unit type to require.
+		/// The unit type to limit.
 		/// </param>
 		/// <param name='minCount'>
-		/// The minimum number of that type that must exist.
+		/// The maximum number of that type that must exist.
 		/// </param>
-		public void AddUnitTypeRequirement(UnitType unitType, int minCount)
+		public void AddUnitTypeRequirement(UnitType unitType, int maxCount)
 		{
-			limitedTypes.Add(new UnitCountRequirementData(unitType, minCount));
+			limitedTypes.Add(new UnitCountRequirementData(unitType, maxCount));
+		}
+
+		/// <summary>
+		/// Adds a requirement for there to be none of a given UnitType
+		/// </summary>
+		/// <param name='unitType'>
+		/// The unit type to limit.
+		/// </param>
+		public void AddUnitTypeRequirement(UnitType unitType)
+		{
+			AddUnitTypeRequirement(unitType, 0);
 		}
 	}
 }