diff api/Objects/Category.cs @ 38:548cfc776f54

Fixes #34 - Remove "Choices" and "Base/Increment" from Category * Remove Choices and Base/Increment from code Re #47: Remove magic numbers * Replace "-1" magic number with WarFoundryCore.INFINITY * Use INFINITY instead of -1 in code * Use INF in schemas instead of -1 * Handle and parse INF as a special value in XML Factory
author IBBoard <dev@ibboard.co.uk>
date Thu, 19 Mar 2009 20:11:07 +0000
parents 306558904c2a
children a5855fcd75ab
line wrap: on
line diff
--- a/api/Objects/Category.cs	Mon Mar 16 20:53:22 2009 +0000
+++ b/api/Objects/Category.cs	Thu Mar 19 20:11:07 2009 +0000
@@ -14,14 +14,9 @@
 	public class Category : WarFoundryObject
 	{
 		private int minPts = 0;
-		private int maxPts = -1;
+		private int maxPts = WarFoundryCore.INFINITY;
 		private int minPc = 0;
 		private int maxPc = 100;
-		private int minChoice = 0;
-		private int maxChoice = -1;
-		private int baseVal = 0;
-		private int incVal = 0;
-		private int incAmount = 0;
 
 		
 		public Category(string id, string name) : base(id, name)
@@ -35,9 +30,6 @@
 			MaximumPoints = maxPoints;
 			MinimumPercentage = minPercent;
 			MaximumPercentage = maxPercent;
-			BaseValue = baseValue;
-			IncrementValue = incrementValue;
-			IncrementAmount = incrementAmount;
 		}
 
 		protected override string DefaultName()
@@ -60,14 +52,14 @@
 			get { return maxPts; }
 			set
 			{
-				maxPts = (value >= -1 ? value : -1);
+				maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY);
 				CheckMinimumPoints();
 			}
 		}
 
 		private void CheckMinimumPoints()
 		{
-			if (MinimumPoints > MaximumPoints && MaximumPoints!=-1)
+			if (MinimumPoints > MaximumPoints && MaximumPoints!=WarFoundryCore.INFINITY)
 			{
 				MinimumPoints = MaximumPoints;
 				LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum points limit greater than its maximum points limit.", Name, ID);
@@ -114,52 +106,5 @@
 				LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum percentage limit greater than its maximum percentage limit.", Name, ID);
 			}
 		}
-
-		public int MinimumChoices
-		{
-			get { return minChoice; }
-			set
-			{
-				minChoice = (value >= 0 ? value : 0);
-				CheckMinimumChoices();
-			}
-		}
-
-		public int MaximumChoices
-		{
-			get { return maxChoice; }
-			set
-			{
-				maxChoice = (value >= -1 ? value : -1);
-				CheckMinimumChoices();
-			}
-		}
-
-		private void CheckMinimumChoices()
-		{
-			if (MinimumPercentage > MaximumPercentage && MaximumPercentage!=-1)
-			{
-				MinimumPercentage = MaximumPercentage;
-				LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum number of choices greater than its maximum number of choices.", Name, ID);
-			}
-		}
-
-		public int BaseValue
-		{
-			get { return baseVal; }
-			set { baseVal = (value >= 0 ? value : 0); }
-		}
-
-		public int IncrementValue
-		{
-			get { return incVal; }
-			set { incVal = (value >= 0 ? value : 0); }
-		}
-
-		public int IncrementAmount
-		{
-			get { return incAmount; }
-			set { incAmount = (value >= 0 ? value : 0); }
-		}
 	}
 }