Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Objects/Category.cs @ 82:3ea0ab04352b
* Fix line terminators
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Jun 2009 18:59:49 +0000 |
parents | a5855fcd75ab |
children | 2f3cafb69799 |
line wrap: on
line diff
--- a/api/Objects/Category.cs Wed May 27 19:43:09 2009 +0000 +++ b/api/Objects/Category.cs Sat Jun 27 18:59:49 2009 +0000 @@ -2,27 +2,27 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Xml; -using IBBoard.Logging; - -namespace IBBoard.WarFoundry.API.Objects -{ - /// <summary> - /// 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. - /// </summary> - public class Category : WarFoundryObject - { - private int minPts = 0; - private int maxPts = WarFoundryCore.INFINITY; - private int minPc = 0; - private int maxPc = 100; - - - public Category(string id, string name) : base(id, name) - { +using System; +using System.Xml; +using IBBoard.Logging; + +namespace IBBoard.WarFoundry.API.Objects +{ + /// <summary> + /// 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. + /// </summary> + public class Category : WarFoundryObject + { + private int minPts = 0; + private int maxPts = WarFoundryCore.INFINITY; + private int minPc = 0; + private int maxPc = 100; + + + public Category(string id, string name) : base(id, name) + { } - + [Obsolete("Use the two argument constructor and the appropriate 'set' methods")] public Category(string id, string name, int minPoints, int maxPoints, int minPercent, int maxPercent, int minChoices, int maxChoices, int baseValue, int incrementValue, int incrementAmount) : base(id, name) { @@ -30,99 +30,99 @@ MaximumPoints = maxPoints; MinimumPercentage = minPercent; MaximumPercentage = maxPercent; - } - - protected override string DefaultName() - { - return ""; + } + + protected override string DefaultName() + { + return ""; } /// <value> /// 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 - /// </value> - public int MinimumPoints - { - get { return minPts; } - set - { - minPts = (value >= 0 ? value : 0); - CheckMinimumPoints(); - } - } + /// </value> + public int MinimumPoints + { + get { return minPts; } + set + { + minPts = (value >= 0 ? value : 0); + CheckMinimumPoints(); + } + } /// <value> /// 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 - /// </value> - public int MaximumPoints - { - get { return maxPts; } - set - { - maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY); - CheckMinimumPoints(); - } + /// </value> + public int MaximumPoints + { + get { return maxPts; } + set + { + maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY); + CheckMinimumPoints(); + } } /// <summary> /// Makes sure that the minimum points value isn't more than the maximum points value, hence the warning on the properties - /// </summary> - private void CheckMinimumPoints() - { + /// </summary> + private void CheckMinimumPoints() + { 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); - } + } } /// <value> /// 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 /// </value> - public int MinimumPercentage - { - get { return minPc; } - set - { - minPc = (value >= 0 ? value : 0); - CheckMinimumPercentage(); - } + public int MinimumPercentage + { + get { return minPc; } + set + { + minPc = (value >= 0 ? value : 0); + CheckMinimumPercentage(); + } } /// <value> /// 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 - /// </value> - public int MaximumPercentage - { - get { return maxPc; } - set - { - if (value < 0) - { - maxPc = 0; - } - else if (value > 100) - { - maxPc = 100; - } - else - { - maxPc = value; - } - - CheckMinimumPercentage(); - } + /// </value> + public int MaximumPercentage + { + get { return maxPc; } + set + { + if (value < 0) + { + maxPc = 0; + } + else if (value > 100) + { + maxPc = 100; + } + else + { + maxPc = value; + } + + CheckMinimumPercentage(); + } } /// <summary> /// Makes sure that the minimum percentage value isn't more than the maximum points value, hence the warning on the properties - /// </summary> - private void CheckMinimumPercentage() - { + /// </summary> + private void CheckMinimumPercentage() + { if (MinimumPercentage > MaximumPercentage) { MinimumPercentage = MaximumPercentage; LogNotifier.WarnFormat(GetType(), "Category {0} ({1}) had a minimum percentage limit greater than its maximum percentage limit.", Name, ID); - } - } - } -} + } + } + } +}