diff API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactory.cs @ 427:3882b533d99d

Re #27: Define unit requirements * Add ID to requirements so that it isn't just defined in factories * Make factory use ID from requirement class to avoid duplication and possible mismatch
author IBBoard <dev@ibboard.co.uk>
date Sun, 30 Oct 2011 20:31:43 +0000
parents 04f4c2fea356
children 7b9ff7b1df24
line wrap: on
line diff
--- a/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactory.cs	Fri Oct 28 20:52:29 2011 +0100
+++ b/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactory.cs	Sun Oct 30 20:31:43 2011 +0000
@@ -7,6 +7,20 @@
 
 namespace IBBoard.WarFoundry.API.Factories.Requirement
 {
+	/// <summary>
+	/// Factory for creating instances of <see cref="UnitRequiresAtLeastNUnitsRequirement" />. Data must be in the format:
+	///
+	/// <code>unitID[:count][|unitID[:count][|...]]</code>
+	///
+	/// e.g.:
+	///
+	/// <code>Swordsmen:2|Bowmen</code>
+	///
+	/// would generate a requirement to allow any number of the unit type after 1 unit with ID Bowmen or 2 units with ID Swordsmen were added.
+	/// </summary>
+	/// <exception cref='InvalidRequirementException'>
+	/// Is thrown when the invalid requirement exception.
+	/// </exception>
 	public class UnitRequiresAtLeastNUnitsRequirementFactory : IRequirementFactory
 	{
 		public UnitRequiresAtLeastNUnitsRequirementFactory()
@@ -16,7 +30,7 @@
 
 		public string AppliesToID {
 			get {
-				return "RequiresAtLeastNUnits";
+				return UnitRequiresAtLeastNUnitsRequirement.REQUIREMENT_ID;
 			}
 		}