Mercurial > repos > IBBoard.WarFoundry.API
diff API/Objects/Requirement/UnitCountRequirementData.cs @ 444:206a45fdfa9e
Re #350: Add requirement to allow N of unit for specific other units
* Extend N for M requirement to start handling multiple unit types in an additive method
* Extend requirement data object to handle multiple unit types
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 07 Dec 2011 21:01:33 +0000 |
parents | 0922851f6125 |
children |
line wrap: on
line diff
--- a/API/Objects/Requirement/UnitCountRequirementData.cs Sun Dec 04 20:40:31 2011 +0000 +++ b/API/Objects/Requirement/UnitCountRequirementData.cs Wed Dec 07 21:01:33 2011 +0000 @@ -8,7 +8,7 @@ { public class UnitCountRequirementData { - private UnitType unitType; + private UnitType[] unitTypes; private int count; private int allows; @@ -17,16 +17,31 @@ //Do nothing special } - public UnitCountRequirementData(UnitType unitType, int count, int allows) + public UnitCountRequirementData(UnitType unitType, int count, int allows) : this(new UnitType[]{unitType}, count, allows) + { + //Do nothing special + } + + public UnitCountRequirementData(UnitType[] unitTypes, int count) : this(unitTypes, count, WarFoundryCore.INFINITY) { - this.unitType = unitType; + //Do nothing special + } + + public UnitCountRequirementData(UnitType[] unitTypes, int count, int allows) + { + this.unitTypes = unitTypes ?? new UnitType[0]; this.count = count; this.allows = allows; } public UnitType UnitType { - get { return unitType; } + get { return unitTypes.Length > 0 ? unitTypes[0] : null; } + } + + public UnitType[] UnitTypes + { + get { return unitTypes; } } public int Count