Mercurial > repos > IBBoard.WarFoundry.API
comparison API/Objects/Requirement/UnitRequiresNParentModelsForMUnitsRequirement.cs @ 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 |
comparison
equal
deleted
inserted
replaced
490:e35fc85eda2b | 491:a41c2bc1683a |
---|---|
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 private string GetFailedAddingRequirementsString(UnitType unitType, Unit parentUnit, Army toArmy) | 114 private string GetFailedAddingRequirementsString(UnitType unitType, Unit parentUnit, Army toArmy) |
115 { | 115 { |
116 int allowedTypeCount = GetChildCountFromUnit(parentUnit); | 116 int allowedTypeCount = GetChildCountFromUnit(parentUnit) + 1; |
117 | 117 UnitCountRequirementData parentRequirement = null; |
118 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)); | 118 |
119 foreach (UnitCountRequirementData limit in ConstraintTypes) | |
120 { | |
121 if (Arrays.Contains(limit.UnitTypes, parentUnit.UnitType)) | |
122 { | |
123 parentRequirement = limit; | |
124 break; | |
125 } | |
126 } | |
127 | |
128 string txt = "Units of type {0} can only have {1} x {2} for every {3} models, would have {4} for {5}"; | |
129 return String.Format(txt, parentUnit.UnitType.Name, parentRequirement.AllowsCount, unitType.Name, parentRequirement.Count, allowedTypeCount, parentUnit.Size); | |
119 } | 130 } |
120 | 131 |
121 protected override string AllowsAddingFailedMessage | 132 protected override string AllowsAddingFailedMessage |
122 { | 133 { |
123 get | 134 get |