Mercurial > repos > snowblizz-super-API-ideas
changeset 355:47712a323cf2
Re #27: Unit requirements
* Implement check for adding units to army
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 25 Apr 2011 10:32:51 +0000 |
parents | 47acc63cf529 |
children | 51cccccf3669 |
files | API/Objects/Requirement/RequirementHandler.cs |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequirementHandler.cs Fri Apr 22 10:38:03 2011 +0000 +++ b/API/Objects/Requirement/RequirementHandler.cs Mon Apr 25 10:32:51 2011 +0000 @@ -29,6 +29,22 @@ return result; } + + public static Validation AllowsAdding(UnitType unitType, Army army) + { + Validation result = Validation.Passed; + + foreach (IRequirement requirement in army.GetRequirements()) + { + if (!Validates.AsOkay(requirement.AllowsAdding(unitType, army))) + { + result = Validation.Failed; + break; + } + } + + return result; + } } }