# HG changeset patch # User IBBoard # Date 1275741808 0 # Node ID 7933d852181eb70beb4c46dd3ee160e3ede3065c # Parent 900adf96a915180f46252936446e6c00d0f68afe Re #289: Double-check extensibility where sets of values are allowed * Remove ArmourType and all usage as it needs rebuilding from scratch to be extensible and isn't widely used yet diff -r 900adf96a915 -r 7933d852181e IBBoard.WarFoundry.API.csproj --- a/IBBoard.WarFoundry.API.csproj Mon May 31 15:33:41 2010 +0000 +++ b/IBBoard.WarFoundry.API.csproj Sat Jun 05 12:43:28 2010 +0000 @@ -58,7 +58,6 @@ - diff -r 900adf96a915 -r 7933d852181e api/Factories/Xml/WarFoundryXmlRaceFactory.cs --- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Mon May 31 15:33:41 2010 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Jun 05 12:43:28 2010 +0000 @@ -469,7 +469,6 @@ string name = elem.GetAttribute("name"); EquipmentItem item = new EquipmentItem(id, name, race); double cost = 0; - ArmourType armourType; try { @@ -479,21 +478,9 @@ { throw new InvalidFileException("Attribute 'cost' of equipment item "+id+" was not a valid number", ex); } - - string armourTypeAttrib = elem.GetAttribute("armourType"); - - try - { - armourType = (ArmourType)Enum.Parse(typeof(ArmourType), armourTypeAttrib); - } - catch(ArgumentException ex) - { - throw new InvalidFileException("Attribute value '"+armourTypeAttrib+"' for 'armourType' of equipment "+id+" was not one of the allowed values", ex); - } - + //TODO: Parse equipment stats if there are any item.Cost = cost; - item.ItemArmourType = armourType; race.AddEquipmentItem(item); return item; } diff -r 900adf96a915 -r 7933d852181e api/Objects/ArmourType.cs --- a/api/Objects/ArmourType.cs Mon May 31 15:33:41 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -// This file (ArmourType.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard. -// -// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. - -using System; - -namespace IBBoard.WarFoundry.API.Objects -{ - public enum ArmourType - { - None = 0, Shield = 1, LightArmour = 2, LightArmourShield = 3, HeavyArmour = 4, HeavyArmourShield = 5, Barding = 8, BardingShield = 9, BardingLightArmour = 10, BardingLightArmourShield = 11, BardingHeavyArmour = 12, BardingHeavyArmourShield = 13 - } -} diff -r 900adf96a915 -r 7933d852181e api/Objects/EquipmentItem.cs --- a/api/Objects/EquipmentItem.cs Mon May 31 15:33:41 2010 +0000 +++ b/api/Objects/EquipmentItem.cs Sat Jun 05 12:43:28 2010 +0000 @@ -14,26 +14,12 @@ { private double cost; private string description; - private ArmourType armourType; private Race equipForRace; public EquipmentItem(string id, string name, Race race) : base(id, name) { equipForRace = race; description = ""; - armourType = ArmourType.None; - } - - [Obsolete("Use the three argument constructor and the appropriate 'set' methods")] - public EquipmentItem(string id, string name, double itemCost, double minimum, double maximum, ArmourType itemArmourType, Race race) : this(id, name, race) - { - ItemArmourType = itemArmourType; - } - - public ArmourType ItemArmourType - { - get { return armourType; } - set { armourType = value; } } public double Cost @@ -61,12 +47,7 @@ public bool CanBeUsedWithItem(EquipmentItem item) { - return CanBeUsedWithArmourType(item.ItemArmourType); - } - - public bool CanBeUsedWithArmourType(ArmourType otherItemType) - { - return (this.ItemArmourType & otherItemType) == 0; + return true; } } } diff -r 900adf96a915 -r 7933d852181e api/Objects/UnitEquipmentItem.cs --- a/api/Objects/UnitEquipmentItem.cs Mon May 31 15:33:41 2010 +0000 +++ b/api/Objects/UnitEquipmentItem.cs Sat Jun 05 12:43:28 2010 +0000 @@ -219,11 +219,6 @@ } } - public ArmourType ItemArmourType - { - get { return EquipmentItem.ItemArmourType; } - } - public string Description { get { return EquipmentItem.Description; } @@ -239,11 +234,6 @@ return EquipmentItem.CanBeUsedWithItem(item); } - public bool CanBeUsedWithArmourType(ArmourType otherItemType) - { - return EquipmentItem.CanBeUsedWithArmourType(otherItemType); - } - [Obsolete("Use UnitEquipmentUtil method instead")] public bool IsMutuallyExclusive(UnitEquipmentItem item) { diff -r 900adf96a915 -r 7933d852181e schemas/race.xsd --- a/schemas/race.xsd Mon May 31 15:33:41 2010 +0000 +++ b/schemas/race.xsd Sat Jun 05 12:43:28 2010 +0000 @@ -261,7 +261,6 @@ - @@ -280,20 +279,4 @@ - - - - - - - - - - - - - - - - \ No newline at end of file