Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff API/Objects/Requirement/RequiresNUnitsForMObjectsRequirement.cs @ 464:59e1fb8a476a
Re #394: Make requirements (or factory) more closely match Rollcall methods
* Fix ratio check - we were doing an unnecessary division
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 24 Mar 2012 16:40:01 +0000 |
parents | 159dc9be36c2 |
children | 7b9ff7b1df24 |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNUnitsForMObjectsRequirement.cs Sat Mar 17 20:02:32 2012 +0000 +++ b/API/Objects/Requirement/RequiresNUnitsForMObjectsRequirement.cs Sat Mar 24 16:40:01 2012 +0000 @@ -71,9 +71,8 @@ private bool IsValidByRequirement(UnitCountRequirementData limit, int allowedTypeCount, int limitedTypeCount) { - int wholeNumLimited = (limitedTypeCount / limit.Count); double allowedRatio = (limit.AllowsCount / (limit.Count * 1.0)); - return allowedRatio * wholeNumLimited >= allowedTypeCount; + return allowedRatio * limitedTypeCount >= allowedTypeCount; } public override Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy)