# HG changeset patch # User IBBoard # Date 1256936404 0 # Node ID 6d5cb8c7b6edffbd8c7f95295190d3953cf983cd # Parent 9dc22147c2dbf61f460d628d3cd6f34282783e6c Fixes #204: Use new limits in WinForms UI * Set initial amounts correctly * Disable percentage option when all that can be done is "equip all" * Remove unused references to "INFINITY" diff -r 9dc22147c2db -r 6d5cb8c7b6ed UI/EquipmentAmountControl.cs --- a/UI/EquipmentAmountControl.cs Thu Oct 29 20:49:44 2009 +0000 +++ b/UI/EquipmentAmountControl.cs Fri Oct 30 21:00:04 2009 +0000 @@ -55,11 +55,19 @@ int minNumber = UnitEquipmentUtil.GetMinEquipmentCount(unit, equip); SetUpDownControlMinMaxes(minPercent, maxPercent, minNumber, maxNumber); - SetEquipmentAmountsFromPercentage(equipIsRatioLimit ? minPercent : minNumber); + + if (equipIsRatioLimit) + { + SetEquipmentAmountsFromPercentage(minPercent); + } + else + { + SetEquipmentAmountsFromNumber(minNumber); + } rbEquipAll.Enabled = equipIsRatioLimit && maxPercent == 100; rbEquipAll.Checked = equipIsRatioLimit && minPercent == 100; - percentage.Enabled = equipIsRatioLimit; + percentage.Enabled = equipIsRatioLimit && minPercent != 100; rbPercentage.Enabled = percentage.Enabled; rbPercentage.Checked = equipIsRatioLimit && !rbEquipAll.Checked; numeric.Enabled = !equipIsRatioLimit || minPercent != 100; @@ -190,10 +198,6 @@ { SetEquipmentAmountsFromPercentage(equipAmountNum); } - else if (equipAmountNum == WarFoundryCore.INFINITY) - { - rbEquipAll.Checked = true; - } else { int equipAmount = (int) equipAmountNum; @@ -210,8 +214,6 @@ private void SetEquipmentAmountsFromNumber(int equipAmount) { - rbEquipAll.Checked = (equipAmount == WarFoundryCore.INFINITY); - equipAmount = (equipAmount == WarFoundryCore.INFINITY ? unit.Size : equipAmount); percentage.Value = CalcualtePercentageValueFromNumber(equipAmount); numeric.Value = equipAmount; }