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 diff
     1.1 --- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs	Mon Apr 04 19:28:44 2011 +0000
     1.2 +++ b/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs	Mon Apr 04 19:45:38 2011 +0000
     1.3 @@ -20,7 +20,7 @@
     1.4  
     1.5  			foreach (UnitType unitType in limitedUnitTypes)
     1.6  			{
     1.7 -				AddUnitTypeRequirement(unitType, 0);
     1.8 +				AddUnitTypeRequirement(unitType);
     1.9  			}
    1.10  		}
    1.11  
    1.12 @@ -53,17 +53,28 @@
    1.13  		}
    1.14  
    1.15  		/// <summary>
    1.16 -		/// Adds a requirement for there to be at least minCount of a given UnitType
    1.17 +		/// Adds a requirement for there to be no more than maxCount of a given UnitType
    1.18  		/// </summary>
    1.19  		/// <param name='unitType'>
    1.20 -		/// The unit type to require.
    1.21 +		/// The unit type to limit.
    1.22  		/// </param>
    1.23  		/// <param name='minCount'>
    1.24 -		/// The minimum number of that type that must exist.
    1.25 +		/// The maximum number of that type that must exist.
    1.26  		/// </param>
    1.27 -		public void AddUnitTypeRequirement(UnitType unitType, int minCount)
    1.28 +		public void AddUnitTypeRequirement(UnitType unitType, int maxCount)
    1.29  		{
    1.30 -			limitedTypes.Add(new UnitCountRequirementData(unitType, minCount));
    1.31 +			limitedTypes.Add(new UnitCountRequirementData(unitType, maxCount));
    1.32 +		}
    1.33 +
    1.34 +		/// <summary>
    1.35 +		/// Adds a requirement for there to be none of a given UnitType
    1.36 +		/// </summary>
    1.37 +		/// <param name='unitType'>
    1.38 +		/// The unit type to limit.
    1.39 +		/// </param>
    1.40 +		public void AddUnitTypeRequirement(UnitType unitType)
    1.41 +		{
    1.42 +			AddUnitTypeRequirement(unitType, 0);
    1.43  		}
    1.44  	}
    1.45  }