diff api/Util/UnitEquipmentUtil.cs @ 196:4bbf5624ced6

* Only check current amount of equipment when the slot isn't unlimited (needs unit test writing) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Fri, 30 Oct 2009 20:58:19 +0000
parents 1412a42190a1
children 4d7ff70bb109
line wrap: on
line diff
--- a/api/Util/UnitEquipmentUtil.cs	Fri Oct 30 20:31:00 2009 +0000
+++ b/api/Util/UnitEquipmentUtil.cs	Fri Oct 30 20:58:19 2009 +0000
@@ -144,9 +144,9 @@
 		{
 			double limit = 0;
 			AbstractLimit slotLimit = GetSlotLimitForItem(unit, equip);
-			
-			
-			if (!(slotLimit is IPercentageLimit || slotLimit is UnlimitedLimit) || unit.GetEquipmentAmountInSlot (equip.SlotName) != 0)
+
+
+			if (!(slotLimit is IPercentageLimit || slotLimit is UnlimitedLimit) || (!(slotLimit is UnlimitedLimit) && unit.GetEquipmentAmountInSlotWithoutItem(equip) != 0))
 			{
 				limit = (GetMaxEquipmentCount(unit, equip) / (double)unit.Size) * 100.0;
 			}
@@ -177,7 +177,7 @@
 			AbstractLimit slotLimit = GetSlotLimitForItem(unit, equip);
 			
 			
-			if (!(slotLimit is IPercentageLimit || slotLimit is UnlimitedLimit) || unit.GetEquipmentAmountInSlot (equip.SlotName) != 0)
+			if (!(slotLimit is IPercentageLimit || slotLimit is UnlimitedLimit) || (!(slotLimit is UnlimitedLimit) && unit.GetEquipmentAmountInSlotWithoutItem(equip) != 0))
 			{
 				limit = (GetMinEquipmentCount(unit, equip) / (double)unit.Size) * 100.0;
 			}