# HG changeset patch # User IBBoard # Date 1237841827 0 # Node ID a5855fcd75abc7bb7e1aab17fbbba5f61a985a9b # Parent 75a44b7753d4adf2ad9f4bad3a5afc957c9be745 Re #11 - Document classes and methods * Document methods in UnitType and Category classes diff -r 75a44b7753d4 -r a5855fcd75ab api/Objects/Category.cs --- a/api/Objects/Category.cs Mon Mar 23 20:21:41 2009 +0000 +++ b/api/Objects/Category.cs Mon Mar 23 20:57:07 2009 +0000 @@ -9,7 +9,7 @@ namespace IBBoard.WarFoundry.API.Objects { /// - /// Summary description for Category. + /// A Category is a definition at the or level of a group that 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. /// public class Category : WarFoundryObject { @@ -35,8 +35,11 @@ protected override string DefaultName() { return ""; - } - + } + + /// + /// 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 + /// public int MinimumPoints { get { return minPts; } @@ -46,7 +49,10 @@ CheckMinimumPoints(); } } - + + /// + /// 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 + /// public int MaximumPoints { get { return maxPts; } @@ -55,8 +61,11 @@ maxPts = (value >= 0 ? value : WarFoundryCore.INFINITY); CheckMinimumPoints(); } - } - + } + + /// + /// Makes sure that the minimum points value isn't more than the maximum points value, hence the warning on the properties + /// private void CheckMinimumPoints() { if (MinimumPoints > MaximumPoints && MaximumPoints!=WarFoundryCore.INFINITY) @@ -66,6 +75,9 @@ } } + /// + /// 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 + /// public int MinimumPercentage { get { return minPc; } @@ -74,8 +86,11 @@ minPc = (value >= 0 ? value : 0); CheckMinimumPercentage(); } - } - + } + + /// + /// 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 + /// public int MaximumPercentage { get { return maxPc; } @@ -96,8 +111,11 @@ CheckMinimumPercentage(); } - } - + } + + /// + /// Makes sure that the minimum percentage value isn't more than the maximum points value, hence the warning on the properties + /// private void CheckMinimumPercentage() { if (MinimumPercentage > MaximumPercentage) diff -r 75a44b7753d4 -r a5855fcd75ab api/Objects/UnitType.cs --- a/api/Objects/UnitType.cs Mon Mar 23 20:21:41 2009 +0000 +++ b/api/Objects/UnitType.cs Mon Mar 23 20:57:07 2009 +0000 @@ -12,7 +12,7 @@ namespace IBBoard.WarFoundry.API.Objects { /// - /// Summary description for Unit. + /// A UnitType is a type for a , normally relating to an entry in an army list. The UnitType defines the name, cost, minimum and maximum limits of a unit, and the equipment units of the type can take. /// public class UnitType : WarFoundryObject { @@ -52,12 +52,18 @@ AddRequirement(requirement); } } - + + /// + /// Gets the that this unit belongs to. + /// public Race Race { get { return race; } } - + + /// + /// Gets or sets the that this unit type is a member of. + /// public virtual Category MainCategory { get @@ -69,7 +75,10 @@ mainCat = value; } } - + + /// + /// Gets or sets the minimum size of each unit of this type. Note: This should be set AFTER MaxSize, otherwise an unintended default value may be set for the minimum + /// public int MinSize { get { return minSize; } @@ -79,7 +88,10 @@ CheckMinimumSize(); } } - + + /// + /// Gets or sets the maximum size of each unit of this type. Note: This should be set BEFORE MinSize, otherwise an unintended default value may be set for the minimum + /// public int MaxSize { get { return maxSize; } @@ -89,12 +101,10 @@ CheckMinimumSize(); } } - - public int BaseSize - { - get { return baseSize; } - } - + + /// + /// Gets or sets the minimum number of units of this type that must be taken in an army. Note: This should be set AFTER MaxNumber, otherwise an unintended default value may be set for the minimum + /// public int MinNumber { get { return min; } @@ -104,7 +114,10 @@ CheckMinimumNumber(); } } - + + /// + /// Gets or sets the maximum number of units of this type that can be taken in an army. Note: This should be set BEFORE MinNumber, otherwise an unintended default value may be set for the minimum + /// public int MaxNumber { get { return max; } @@ -114,7 +127,10 @@ CheckMinimumNumber(); } } - + + /// + /// Makes sure that the minimum number isn't more than the maximum number, hence the warning on the properties + /// private void CheckMinimumNumber() { if (MinNumber > MaxNumber && MaxNumber!=WarFoundryCore.INFINITY) @@ -123,7 +139,10 @@ LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum number greater than their maximum number.", Name, ID); } } - + + /// + /// Makes sure that the minimum unit size isn't more than the maximum unit size, hence the warning on the properties + /// private void CheckMinimumSize() { if (MinSize > MaxSize && MaxSize!=WarFoundryCore.INFINITY) @@ -133,12 +152,27 @@ } } + //// + /// Gets or sets the "base size" of a unit, which is the number of troopers the unit has in it for its "base cost". For a lot of units this value will be 0 as the cost is worked out based on the total number of members. + /// + public int BaseSize + { + get { return baseSize; } + set { baseSize = (value >= 0 ? value : 0); } + } + + /// + /// The number of points that a "base unit" of BaseSize models costs. Additional models are charged at CostPerTrooper each. + /// public double BaseUnitCost { get { return baseUnitCost; } set { baseUnitCost = (value >= 0 ? value : 0); } } - + + //// + /// The cost of an individual trooper. This value is the cost for a basic trooper without weapons, which are added on top of the cost before calculating a unit cost. + /// public double CostPerTrooper { get { return costPerTrooper; } @@ -149,7 +183,10 @@ { throw new InvalidOperationException("Unit type with id "+id+" did not have a name specified"); } - + + /// + /// The for the unit in a format that is valid for the game system. + /// public Stats UnitStats { get @@ -164,12 +201,27 @@ } } } - + + /// + /// Gets a for the given ID string, or null if nothing exists for that ID + /// + /// + /// The ID of the UnitEquipmentItem to get + /// + /// + /// The for the given ID string, or null if nothing exists for that ID + /// public UnitEquipmentItem GetEquipmentItem(string id) { return (UnitEquipmentItem)equipment[id]; } - + + /// + /// Gets an array of all available s for this UnitType + /// + /// + /// An array of all available s for this UnitType + /// public UnitEquipmentItem[] GetEquipmentItems() { UnitEquipmentItem[] items = new UnitEquipmentItem[equipment.Count];