diff FrmEditUnitEquipment.cs @ 34:3ceb0efd261f

Re #118: Allow equipment amounts of "ratio" equipment to be define as absolute or ratio amounts * Use new commands created in previous revision Re #122: Make usage of percentage or ratio common * Make sure all usage of percentages are correct Re #117: Add percentage and number boxes to equipment item dialogs * Fix some enable/disable inconsistencies for percentage amounts * Fix problems where fixed limits weren't honoured by widgets
author IBBoard <dev@ibboard.co.uk>
date Thu, 13 Aug 2009 21:16:21 +0000
parents 7c366fe55635
children 6ab7ddc038f9
line wrap: on
line diff
--- a/FrmEditUnitEquipment.cs	Sun Aug 09 12:05:24 2009 +0000
+++ b/FrmEditUnitEquipment.cs	Thu Aug 13 21:16:21 2009 +0000
@@ -46,9 +46,9 @@
 
 			if (equipItem.IsRatioLimit)
 			{
-				numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
-				numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
-				numEquipAmount.Value = (decimal)Math.Round(equipAmount * 100, 2);
+				numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinPercentage, 2);
+				numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxPercentage, 2);
+				numEquipAmount.Value = (decimal)Math.Round(equipAmount, 2);
 				cbEquipAll.Enabled = false;
 				lblPercent.Visible = true;
 				numEquipAmount.Width = 120;
@@ -210,18 +210,18 @@
 			{
 				if (equipAmount != WarFoundryCore.INFINITY)
 				{
-					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, WarFoundryCore.INFINITY));
+					commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, equipItem, WarFoundryCore.INFINITY));
 				}
 			}
 			else if (numEquipAmount.Value != (decimal)equipAmount)
 			{
 				if (equipItem.IsRatioLimit)
 				{
-					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, ((double)numEquipAmount.Value / 100.0)));
+					commandStack.Execute(new SetUnitEquipmentRatioAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
 				}
 				else
-				{
-					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
+				{
+					commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, equipItem, (int)numEquipAmount.Value));
 				}
 			}