Mercurial > repos > IBBoard.WarFoundry.API
changeset 491:a41c2bc1683a
Re #410: M units for N parent models requirement
* Fix text string for requirement failure
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 02 Aug 2012 21:02:23 +0100 |
parents | e35fc85eda2b |
children | 4e1895ef9269 |
files | API/Objects/Requirement/UnitRequiresNParentModelsForMUnitsRequirement.cs |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/Requirement/UnitRequiresNParentModelsForMUnitsRequirement.cs Sun Jul 29 21:02:59 2012 +0100 +++ b/API/Objects/Requirement/UnitRequiresNParentModelsForMUnitsRequirement.cs Thu Aug 02 21:02:23 2012 +0100 @@ -113,9 +113,20 @@ private string GetFailedAddingRequirementsString(UnitType unitType, Unit parentUnit, Army toArmy) { - int allowedTypeCount = GetChildCountFromUnit(parentUnit); + int allowedTypeCount = GetChildCountFromUnit(parentUnit) + 1; + UnitCountRequirementData parentRequirement = null; - return String.Format("Army can only contain {0} × {1} as sub-units of each {2}, would have {3}", allowedTypeCount, unitType.Name, parentUnit.UnitType.Name, (allowedTypeCount + 1)); + foreach (UnitCountRequirementData limit in ConstraintTypes) + { + if (Arrays.Contains(limit.UnitTypes, parentUnit.UnitType)) + { + parentRequirement = limit; + break; + } + } + + string txt = "Units of type {0} can only have {1} x {2} for every {3} models, would have {4} for {5}"; + return String.Format(txt, parentUnit.UnitType.Name, parentRequirement.AllowsCount, unitType.Name, parentRequirement.Count, allowedTypeCount, parentUnit.Size); } protected override string AllowsAddingFailedMessage