diff API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs @ 452:b671085871b7

Re #379: Fix validation of requirements to check for unit * Separate messages for adding unit and validating army. * Make translation easier (once we add it in)
author IBBoard <dev@ibboard.co.uk>
date Sun, 29 Jan 2012 19:39:25 +0000
parents 777725613edb
children def5d333c5e8
line wrap: on
line diff
--- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs	Sat Jan 28 16:57:59 2012 +0000
+++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs	Sun Jan 29 19:39:25 2012 +0000
@@ -17,7 +17,6 @@
 		public UnitRequiresAtLeastNUnitsRequirement(UnitType requirementOn) : base()
 		{
 			requirementOnType = requirementOn;
-			FailureStringPrefix = "Army contains " + requirementOn.Name + " and so must contain: ";
 		}
 
 		protected override bool IsApplicable(WarFoundryObject toObjectAdded)
@@ -39,6 +38,22 @@
 		{
 			return IsApplicable(toArmy) ? base.ValidatesArmy(toArmy) : Validation.NotApplicable;
 		}
+
+		protected override string ValidationFailedMessage
+		{
+			get
+			{
+				return "Army contains " + requirementOnType.Name + " and so must contain: {0}.";
+			}
+		}
+
+		protected override string AllowsAddingFailedMessage
+		{
+			get
+			{
+				return "Army would contain " + requirementOnType.Name + " and so must contain: {0}.";
+			}
+		}
 	}
 }