changeset 184:cedf8bba1d52

Re #198: Add equipment slots * Alter handling of setting one limit and other limit matching by checking on Get instead of Set
author IBBoard <dev@ibboard.co.uk>
date Tue, 27 Oct 2009 20:09:40 +0000
parents 36adabb1c3ea
children 3577bfb7702b
files api/Objects/UnitEquipmentItem.cs
diffstat 1 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/api/Objects/UnitEquipmentItem.cs	Mon Oct 26 20:55:04 2009 +0000
+++ b/api/Objects/UnitEquipmentItem.cs	Tue Oct 27 20:09:40 2009 +0000
@@ -135,18 +135,27 @@
 		{
 			get
 			{
-				return (minLimit == null ? new UnlimitedLimit() : minLimit);
+				AbstractLimit limit = minLimit;
+				
+				if (limit == null)
+				{
+					if (maxLimit != null)
+					{
+						limit = maxLimit;
+					}
+					else
+					{
+						limit = new UnlimitedLimit();
+					}
+				}
+				
+				return limit;
 			}
 			set
 			{
 				if (value != null)
 				{
-					minLimit = value;			
-					
-					if (maxLimit == null)
-					{
-						maxLimit = minLimit;
-					}
+					minLimit = value;
 				}
 			}
 		}
@@ -158,18 +167,27 @@
 		{
 			get
 			{
-				return (maxLimit == null ? new UnlimitedLimit() : maxLimit);
+				AbstractLimit limit = maxLimit;
+				
+				if (limit == null)
+				{
+					if (minLimit != null)
+					{
+						limit = minLimit;
+					}
+					else
+					{
+						limit = new UnlimitedLimit();
+					}
+				}
+				
+				return limit;
 			}
 			set
 			{
 				if (value != null)
 				{
-					maxLimit = value;					
-					
-					if (minLimit == null)
-					{
-						minLimit = maxLimit;
-					}
+					maxLimit = value;
 				}
 			}
 		}