changeset 263:7933d852181e

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
author IBBoard <dev@ibboard.co.uk>
date Sat, 05 Jun 2010 12:43:28 +0000
parents 900adf96a915
children 68af2cd41e2f
files IBBoard.WarFoundry.API.csproj api/Factories/Xml/WarFoundryXmlRaceFactory.cs api/Objects/ArmourType.cs api/Objects/EquipmentItem.cs api/Objects/UnitEquipmentItem.cs schemas/race.xsd
diffstat 6 files changed, 2 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
     <Compile Include="api\Factories\Xml\WarFoundryXmlSaver.cs" />
     <Compile Include="api\FileLoadFailure.cs" />
     <Compile Include="api\Objects\Ability.cs" />
-    <Compile Include="api\Objects\ArmourType.cs" />
     <Compile Include="api\Objects\Army.cs" />
     <Compile Include="api\Objects\ArmyCategory.cs" />
     <Compile Include="api\Objects\Category.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;
 		}
--- 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
-	}
-}
--- 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;
 		}
 	}
 }
--- 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)
 		{
--- 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 @@
 				<xs:attribute name="id" type="xs:ID" use="required"/>
 				<xs:attribute name="name" type="xs:string" use="required"/>
 				<xs:attribute name="cost" type="core:nonNegativeNonInfiniteDouble" use="required"/>
-				<xs:attribute name="armourType" type="armourtype" default="None"/>
 				<xs:anyAttribute processContents="lax"/>
 			</xs:complexType>
 		</xs:element>
@@ -280,20 +279,4 @@
 		<xs:enumeration value="BankerToHalf"/>
 	</xs:restriction>
 </xs:simpleType>
-<xs:simpleType name="armourtype">
-	<xs:restriction base="xs:string">
-		<xs:enumeration value="None"/>
-		<xs:enumeration value="Shield"/>
-		<xs:enumeration value="LightArmour"/>
-		<xs:enumeration value="LightArmourShield"/>
-		<xs:enumeration value="HeavyArmour"/>
-		<xs:enumeration value="HeavyArmourShield"/>
-		<xs:enumeration value="Barding"/>
-		<xs:enumeration value="BardingShield"/>
-		<xs:enumeration value="BardingLightArmour"/>
-		<xs:enumeration value="BardingLightArmourShield"/>
-		<xs:enumeration value="BardingHeavyArmour"/>
-		<xs:enumeration value="BardingHeavyArmourShield"/>
-	</xs:restriction>
-</xs:simpleType>
 </xs:schema>
\ No newline at end of file