changeset 83:6d5cb8c7b6ed

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"
author IBBoard <dev@ibboard.co.uk>
date Fri, 30 Oct 2009 21:00:04 +0000
parents 9dc22147c2db
children 1e85a0687e4d
files UI/EquipmentAmountControl.cs
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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;
 		}