changeset 454:def5d333c5e8

Re #379: Fix validation of requirements to check for unit * Remove custom messages for overrides to reduce verbosity * Add missing multiplication signs for readability
author IBBoard <dev@ibboard.co.uk>
date Tue, 31 Jan 2012 20:58:09 +0000
parents dace3b7779ca
children afc6410e4efc
files API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirement.cs
diffstat 3 files changed, 2 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs	Sun Jan 29 20:05:25 2012 +0000
+++ b/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirement.cs	Tue Jan 31 20:58:09 2012 +0000
@@ -66,7 +66,7 @@
 				if (!IsValidByRequirement(unitType, toArmy, limit, allowedTypeCount))
 				{
 					string unitTypeList = GetUnitTypeList(limit);
-					failures.Add(String.Format("{0} {1} for every {2} {3} (would have {4} for {5})", limit.Count, unitTypeList, limit.AllowsCount, allowedType.Name, limitedTypeCount, allowedTypeCount));
+					failures.Add(String.Format("{0} × {1} for every {2} × {3} (would have {4} for {5})", limit.Count, unitTypeList, limit.AllowsCount, allowedType.Name, limitedTypeCount, allowedTypeCount));
 				}
 			}
 
@@ -190,7 +190,7 @@
 				if (!IsValidByRequirement(limit, allowedTypeCount, limitedTypeCount))
 				{
 					string unitTypeList = GetUnitTypeList(limit);
-					failures.Add(String.Format("{0} {1} for every {2} {3} (have {4} for {5})", limit.Count, unitTypeList, limit.AllowsCount, allowedType.Name, limitedTypeCount, allowedTypeCount));
+					failures.Add(String.Format("{0} × {1} for every {2} × {3} (have {4} for {5})", limit.Count, unitTypeList, limit.AllowsCount, allowedType.Name, limitedTypeCount, allowedTypeCount));
 				}
 			}
 
--- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs	Sun Jan 29 20:05:25 2012 +0000
+++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirement.cs	Tue Jan 31 20:58:09 2012 +0000
@@ -38,22 +38,6 @@
 		{
 			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}.";
-			}
-		}
 	}
 }
 
--- a/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirement.cs	Sun Jan 29 20:05:25 2012 +0000
+++ b/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirement.cs	Tue Jan 31 20:58:09 2012 +0000
@@ -50,22 +50,6 @@
 		{
 			return requirementOnType.Equals(toObject) || (toObject is Unit && requirementOnType.Equals(((Unit)toObject).UnitType));
 		}
-
-		protected override string ValidationFailedMessage
-		{
-			get
-			{
-				return "Army contains " + requirementOnType.Name + " and so cannot contain more than: {0}.";
-			}
-		}
-
-		protected override string AllowsAddingFailedMessage
-		{
-			get
-			{
-				return "Army would contain " + requirementOnType.Name + " and so cannot contain more than: {0}.";
-			}
-		}
 	}
 }