Mercurial > repos > IBBoard.WarFoundry.API
changeset 136:413a7a049e41
Fixes #146: Incorrect logic in Unit.AddEquipmentAmount()
* Logic error was in UnitEquipmentNumericForRatioSelection where we didn't treat percentages as decimal numbers and got ranges of "125 to 500" for a unit of 5!
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 08 Sep 2009 19:27:51 +0000 |
parents | a37cdcbcad14 |
children | f58051572ec7 |
files | api/Objects/UnitEquipmentNumericForRatioSelection.cs |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Objects/UnitEquipmentNumericForRatioSelection.cs Fri Sep 04 18:43:52 2009 +0000 +++ b/api/Objects/UnitEquipmentNumericForRatioSelection.cs Tue Sep 08 19:27:51 2009 +0000 @@ -23,10 +23,10 @@ protected override bool IsInRange (double newValue) { - int minLimit = (int) IBBMath.Round(EquipmentForUnit.Size * EquipmentItem.MinPercentage, EquipmentItem.RoundNumberUp); - int maxLimit = (int) IBBMath.Round(EquipmentForUnit.Size * EquipmentItem.MaxPercentage, EquipmentItem.RoundNumberUp); + int minLimit = (int) IBBMath.Round(EquipmentForUnit.Size * EquipmentItem.MinPercentage / 100, EquipmentItem.RoundNumberUp); + int maxLimit = (int)IBBMath.Round(EquipmentForUnit.Size * EquipmentItem.MaxPercentage / 100, EquipmentItem.RoundNumberUp); + newValue = (newValue == WarFoundryCore.INFINITY ? EquipmentForUnit.Size : newValue); bool isInRange = (minLimit <= newValue) && (newValue <= maxLimit); - newValue = (newValue == WarFoundryCore.INFINITY ? EquipmentForUnit.Size : newValue); return isInRange && IsWholeNumber(newValue); } }