changeset 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 cbeee87dc2d3
children 7b9ff7b1df24
files API/Objects/Requirement/RequiresNUnitsForMObjectsRequirement.cs
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
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)