comparison API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirement.cs @ 457:8e01c3174cc3

Re #379: Fix validation of requirements to check for unit * Rename public accessor for unit types to ConstraintTypes so that "no more than" requirements don't work with "required types" * Remove class level version of ConstraintTypes to fall back to abstract class version * Make sure we cascade allowedObject up through RequiresNoMoreThanNOfUnitTypeRequirement * Rebuild UnitRequiresNoMoreThanNOfUnitTypeRequirement "IsApplicable" so that we don't get applicable for unrelated types, even if the requirement is currently in a failure state
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Feb 2012 15:14:01 +0000
parents 52baffdd2ab9
children f48c49b53738
comparison
equal deleted inserted replaced
456:52baffdd2ab9 457:8e01c3174cc3
57 addedType = (toObject is Unit) ? ((Unit)toObject).UnitType : null; 57 addedType = (toObject is Unit) ? ((Unit)toObject).UnitType : null;
58 } 58 }
59 59
60 if (addedType != null && toArmy.GetUnitTypeCount(AllowedObject) > 0) 60 if (addedType != null && toArmy.GetUnitTypeCount(AllowedObject) > 0)
61 { 61 {
62 foreach (UnitCountRequirementData limit in RequiredTypes) 62 foreach (UnitCountRequirementData limit in ConstraintTypes)
63 { 63 {
64 if (Arrays.Contains(limit.UnitTypes, addedType)) 64 if (Arrays.Contains(limit.UnitTypes, addedType))
65 { 65 {
66 isApplicable = true; 66 isApplicable = true;
67 break; 67 break;