Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Objects/Category.cs @ 46:a5855fcd75ab
Re #11 - Document classes and methods
* Document methods in UnitType and Category classes
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 23 Mar 2009 20:57:07 +0000 |
parents | 548cfc776f54 |
children | 3ea0ab04352b |
comparison
equal
deleted
inserted
replaced
45:75a44b7753d4 | 46:a5855fcd75ab |
---|---|
7 using IBBoard.Logging; | 7 using IBBoard.Logging; |
8 | 8 |
9 namespace IBBoard.WarFoundry.API.Objects | 9 namespace IBBoard.WarFoundry.API.Objects |
10 { | 10 { |
11 /// <summary> | 11 /// <summary> |
12 /// Summary description for Category. | 12 /// A Category is a definition at the <see cref=" GameSystem"/> or <see cref=" Race"/> level of a group that <see cref=" UnitType"/>s belong to. Each category has a name and a min/max limit on points or percentage of a total army cost that units in the category can total. |
13 /// </summary> | 13 /// </summary> |
14 public class Category : WarFoundryObject | 14 public class Category : WarFoundryObject |
15 { | 15 { |
16 private int minPts = 0; | 16 private int minPts = 0; |
17 private int maxPts = WarFoundryCore.INFINITY; | 17 private int maxPts = WarFoundryCore.INFINITY; |
34 | 34 |
35 protected override string DefaultName() | 35 protected override string DefaultName() |
36 { | 36 { |
37 return ""; | 37 return ""; |
38 } | 38 } |
39 | 39 |
40 /// <value> | |
41 /// Gets or sets the minimum number of points that the units of this category can cost. Note: This should be set AFTER MaximumPoints, otherwise an unintended default value may be set for the minimum | |
42 /// </value> | |
40 public int MinimumPoints | 43 public int MinimumPoints |
41 { | 44 { |
42 get { return minPts; } | 45 get { return minPts; } |
43 set | 46 set |
44 { | 47 { |
45 minPts = (value >= 0 ? value : 0); | 48 minPts = (value >= 0 ? value : 0); |
46 CheckMinimumPoints(); | 49 CheckMinimumPoints(); |
47 } | 50 } |
48 } | 51 } |
49 | 52 |
53 /// <value> | |
54 /// Gets or sets the maximum number of points that the units of this category can cost. Note: This should be set BEFORE MinimumPoints, otherwise an unintended default value may be set for the minimum | |
55 /// </value> | |
50 public int MaximumPoints | 56 public int MaximumPoints |
51 { | 57 { |
52 get { return maxPts; } | 58 get { return maxPts; } |
53 set | 59 set |
54 { | 60 { |
55 maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY); | 61 maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY); |
56 CheckMinimumPoints(); | 62 CheckMinimumPoints(); |
57 } | 63 } |
58 } | 64 } |
59 | 65 |
66 /// <summary> | |
67 /// Makes sure that the minimum points value isn't more than the maximum points value, hence the warning on the properties | |
68 /// </summary> | |
60 private void CheckMinimumPoints() | 69 private void CheckMinimumPoints() |
61 { | 70 { |
62 if (MinimumPoints > MaximumPoints && MaximumPoints!=WarFoundryCore.INFINITY) | 71 if (MinimumPoints > MaximumPoints && MaximumPoints!=WarFoundryCore.INFINITY) |
63 { | 72 { |
64 MinimumPoints = MaximumPoints; | 73 MinimumPoints = MaximumPoints; |
65 LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum points limit greater than its maximum points limit.", Name, ID); | 74 LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum points limit greater than its maximum points limit.", Name, ID); |
66 } | 75 } |
67 } | 76 } |
68 | 77 |
78 /// <value> | |
79 /// Gets or sets the minimum percentage of the total army points value that the units of this category can cost. Note: This should be set AFTER MaximumPercentage, otherwise an unintended default value may be set for the minimum | |
80 /// </value> | |
69 public int MinimumPercentage | 81 public int MinimumPercentage |
70 { | 82 { |
71 get { return minPc; } | 83 get { return minPc; } |
72 set | 84 set |
73 { | 85 { |
74 minPc = (value >= 0 ? value : 0); | 86 minPc = (value >= 0 ? value : 0); |
75 CheckMinimumPercentage(); | 87 CheckMinimumPercentage(); |
76 } | 88 } |
77 } | 89 } |
78 | 90 |
91 /// <value> | |
92 /// Gets or sets the maximum percentage of the total army points value that the units of this category can cost. Note: This should be set BEFORE MinimumPercentage, otherwise an unintended default value may be set for the minimum | |
93 /// </value> | |
79 public int MaximumPercentage | 94 public int MaximumPercentage |
80 { | 95 { |
81 get { return maxPc; } | 96 get { return maxPc; } |
82 set | 97 set |
83 { | 98 { |
95 } | 110 } |
96 | 111 |
97 CheckMinimumPercentage(); | 112 CheckMinimumPercentage(); |
98 } | 113 } |
99 } | 114 } |
100 | 115 |
116 /// <summary> | |
117 /// Makes sure that the minimum percentage value isn't more than the maximum points value, hence the warning on the properties | |
118 /// </summary> | |
101 private void CheckMinimumPercentage() | 119 private void CheckMinimumPercentage() |
102 { | 120 { |
103 if (MinimumPercentage > MaximumPercentage) | 121 if (MinimumPercentage > MaximumPercentage) |
104 { | 122 { |
105 MinimumPercentage = MaximumPercentage; | 123 MinimumPercentage = MaximumPercentage; |