changeset 170:3045a168714a WarFoundry_v0.1beta4_Winforms WarFoundry_v0.1beta5_Winforms

* Line ending clean-up no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sun, 11 Oct 2009 19:57:34 +0000
parents ae7915c94747
children 85dc413279a4
files api/Factories/Xml/WarFoundryXmlRaceFactory.cs api/Objects/UnitEquipmentItem.cs api/Objects/UnitType.cs
diffstat 3 files changed, 296 insertions(+), 296 deletions(-) [+]
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Tue Oct 06 18:29:07 2009 +0000
+++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sun Oct 11 19:57:34 2009 +0000
@@ -111,7 +111,7 @@
 		{
 			string name = elem.GetAttribute("typeName");
 			UnitType type = new UnitType(id, name, parentRace);
-			LoadCoreValuesForUnitType(elem, type);
+			LoadCoreValuesForUnitType(elem, type);
 			LoadEquipmentSlotsForUnitType(elem, type);
 			LoadEquipmentForUnitType(elem, type);
 			LoadAbilitiesForUnitType(elem, type);
@@ -151,17 +151,17 @@
 			type.MainCategory = cat;
 			XmlElement statsElement = WarFoundryXmlFactoryUtils.SelectSingleElement(elem, "race:stats");
 			Stats unitStats = ParseUnitStats(statsElement, type.GameSystem);
-			type.SetUnitStats(unitStats);
-		}
-
-		private void LoadEquipmentSlotsForUnitType(XmlElement elem, UnitType type)
-		{
-			foreach (XmlElement equip in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:equipmentSlots/race:equipmentSlot"))
-			{
-				string slotName = equip.GetAttribute("name");
-				int slotLimit = XmlTools.GetIntValueFromAttribute(equip, "limit");
-				type.AddEquipmentSlot(slotName, slotLimit);
-			}
+			type.SetUnitStats(unitStats);
+		}
+
+		private void LoadEquipmentSlotsForUnitType(XmlElement elem, UnitType type)
+		{
+			foreach (XmlElement equip in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:equipmentSlots/race:equipmentSlot"))
+			{
+				string slotName = equip.GetAttribute("name");
+				int slotLimit = XmlTools.GetIntValueFromAttribute(equip, "limit");
+				type.AddEquipmentSlot(slotName, slotLimit);
+			}
 		}
 
 		private void LoadEquipmentForUnitType(XmlElement elem, UnitType type)
@@ -198,20 +198,20 @@
 						mutexGroups = new string[0];
 					}
 
-					UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups);
-
-					string equipSlot = equip.GetAttribute("equipmentSlot");
-
-					if (equipSlot != "")
-					{
-						if (type.HasEquipmentSlot(equipSlot))
-						{
-							unitEquipItem.SlotName = equipSlot;
-						}
-						else
-						{
-							throw new InvalidFileException("Attribute 'equipmentSlot' of unit equipment item " + id + " for " + type.Name + " was not a valid slot name");
-						}
+					UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups);
+
+					string equipSlot = equip.GetAttribute("equipmentSlot");
+
+					if (equipSlot != "")
+					{
+						if (type.HasEquipmentSlot(equipSlot))
+						{
+							unitEquipItem.SlotName = equipSlot;
+						}
+						else
+						{
+							throw new InvalidFileException("Attribute 'equipmentSlot' of unit equipment item " + id + " for " + type.Name + " was not a valid slot name");
+						}
 					}
 
 					unitEquipItem.RoundNumberUp = equip.GetAttribute("roundDirection").Equals("up");
--- a/api/Objects/UnitEquipmentItem.cs	Tue Oct 06 18:29:07 2009 +0000
+++ b/api/Objects/UnitEquipmentItem.cs	Sun Oct 11 19:57:34 2009 +0000
@@ -10,245 +10,245 @@
 {
 	/// <summary>
 	/// Summary description for UnitEquipmentItem.
-	/// </summary>
-	public class UnitEquipmentItem : WarFoundryObject
-	{
-		private EquipmentItem item;
-		private bool required;
-		private bool roundUp;
-		private int minNum;
-		private int maxNum;
-		private double minPercentage;
-		private double maxPercentage;
-		private double costMultiplier;
-		private RoundType roundType;
-		private string[] mutexGroups;
-		private UnitType unitType;
-		private string slotName = "";
-
-		public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor)
-			: this(equipmentItem, equipmentFor, new string[0])
-		{
-			//Do nothing extra
-		}
-
-		public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor, params string[] mutexGroups)
-		{
-			item = equipmentItem;
-			unitType = equipmentFor;
-			this.mutexGroups = mutexGroups;
-			unitType.AddEquipmentItem(this);
-		}
-
-		public override string Name
-		{
-			get
-			{
-				return item.Name;
-			}
-			set
-			{
-				base.Name = value;
-			}
-		}
-
-		public override string ID
-		{
-			get
-			{
-				return (EquipmentForUnit == null ? base.ID : EquipmentForUnit.ID) + EquipmentItemID;
-			}
-			set
-			{
-				base.ID = value;
-			}
-		}
-
-
-		public string EquipmentItemID
-		{
-			get { return item.ID; }
-		}
-
-		public double Cost
-		{
-			get
-			{
-				return IBBMath.Round(EquipmentItem.Cost * CostMultiplier, CostRoundType);
-			}
-		}
-
-		public double CostMultiplier
-		{
-			get { return costMultiplier; }
-			set
-			{
-				costMultiplier = value;
-			}
-		}
-
-		public RoundType CostRoundType
-		{
-			get { return roundType; }
-			set
-			{
-				roundType = value;
-			}
-		}
-
-		public bool IsRequired
-		{
-			get { return required; }
-			set { required = value; }
-		}
-
-		public bool RoundNumberUp
-		{
-			get { return roundUp; }
-			set { roundUp = value; }
-		}
-
-		[Obsolete("Use MutexGroups instead for greater flexibility")]
-		public string MutexGroup
-		{
-			get { return (mutexGroups.Length == 0 ? "" : mutexGroups[0]); }
-		}
-
-		public String[] MutexGroups
-		{
-			get { return (string[]) mutexGroups.Clone(); }
-		}
-
-		public UnitType EquipmentForUnit
-		{
-			get { return unitType; }
-		}
-
-		public bool IsRatioLimit
-		{
-			get { return minPercentage != 100 || maxPercentage != 100; }
-		}
-
-		public int MinNumber
-		{
-			get { return minNum; }
-			set
-			{
-				if (value >= 0 || value == WarFoundryCore.INFINITY)
-				{
-					minNum = value;
-				}
-				//TODO: Check Min<Max
-			}
-		}
-
-		public int MaxNumber
-		{
-			get { return maxNum; }
-			set
-			{
-				if (value >= 0 || value == WarFoundryCore.INFINITY)
-				{
-					maxNum = value;
-				}
-				//TODO: Check Min<Max
-			}
-		}
-
-		public double MinPercentage
-		{
-			get { return minPercentage; }
-			set
-			{
-				if (value >= 0 && value <= 100)
-				{
-					minPercentage = value;
-				}
-				//TODO: Check Min<Max
-			}
-		}
-
-		public double MaxPercentage
-		{
-			get { return maxPercentage; }
-			set
-			{
-				if (value >= 0 && value <= 100)
-				{
-					maxPercentage = value;
-				}
-				//TODO: Check Min<Max
-			}
-		}
-
-		public EquipmentItem EquipmentItem
-		{
-			get { return item; }
-		}
-
-		public override string ToString()
-		{
-			return EquipmentItem.Name + " (" + Cost + "pts each)";
-		}
-
-		public bool HasAlternatives()
-		{
-			if (MutexGroups.Length == 0)
-			{
-				return false;
-			}
-			else if (EquipmentForUnit == null)
-			{
-				return false;
-			}
-			else
-			{
-				//If the number of items in the MutEx group is greater than one then it must be this item plus another
-				return EquipmentForUnit.GetEquipmentItemsByExclusionGroups(MutexGroups).Length > 1;
-			}
-		}
-
-		public ArmourType ItemArmourType
-		{
-			get { return EquipmentItem.ItemArmourType; }
-		}
-
-		public string Description
-		{
-			get { return EquipmentItem.Description; }
-		}
-
-		public Race EquipmentForRace
-		{
-			get { return EquipmentItem.EquipmentForRace; }
-		}
-
-		public bool CanBeUsedWithItem(EquipmentItem item)
-		{
-			return EquipmentItem.CanBeUsedWithItem(item);
-		}
-
-		public bool CanBeUsedWithArmourType(ArmourType otherItemType)
-		{
-			return EquipmentItem.CanBeUsedWithArmourType(otherItemType);
-		}
-
-		[Obsolete("Use UnitEquipmentUtil method instead")]
-		public bool IsMutuallyExclusive(UnitEquipmentItem item)
-		{
-			return UnitEquipmentUtil.ItemsAreMutuallyExclusive(this, item);
-		}
-
-		public string SlotName
-		{
-			get { return slotName; }
-			set
-			{
-				if (value != null && value != "")
-				{
-					slotName = value;
-				}
-			}
-		}
+	/// </summary>
+	public class UnitEquipmentItem : WarFoundryObject
+	{
+		private EquipmentItem item;
+		private bool required;
+		private bool roundUp;
+		private int minNum;
+		private int maxNum;
+		private double minPercentage;
+		private double maxPercentage;
+		private double costMultiplier;
+		private RoundType roundType;
+		private string[] mutexGroups;
+		private UnitType unitType;
+		private string slotName = "";
+
+		public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor)
+			: this(equipmentItem, equipmentFor, new string[0])
+		{
+			//Do nothing extra
+		}
+
+		public UnitEquipmentItem(EquipmentItem equipmentItem, UnitType equipmentFor, params string[] mutexGroups)
+		{
+			item = equipmentItem;
+			unitType = equipmentFor;
+			this.mutexGroups = mutexGroups;
+			unitType.AddEquipmentItem(this);
+		}
+
+		public override string Name
+		{
+			get
+			{
+				return item.Name;
+			}
+			set
+			{
+				base.Name = value;
+			}
+		}
+
+		public override string ID
+		{
+			get
+			{
+				return (EquipmentForUnit == null ? base.ID : EquipmentForUnit.ID) + EquipmentItemID;
+			}
+			set
+			{
+				base.ID = value;
+			}
+		}
+
+
+		public string EquipmentItemID
+		{
+			get { return item.ID; }
+		}
+
+		public double Cost
+		{
+			get
+			{
+				return IBBMath.Round(EquipmentItem.Cost * CostMultiplier, CostRoundType);
+			}
+		}
+
+		public double CostMultiplier
+		{
+			get { return costMultiplier; }
+			set
+			{
+				costMultiplier = value;
+			}
+		}
+
+		public RoundType CostRoundType
+		{
+			get { return roundType; }
+			set
+			{
+				roundType = value;
+			}
+		}
+
+		public bool IsRequired
+		{
+			get { return required; }
+			set { required = value; }
+		}
+
+		public bool RoundNumberUp
+		{
+			get { return roundUp; }
+			set { roundUp = value; }
+		}
+
+		[Obsolete("Use MutexGroups instead for greater flexibility")]
+		public string MutexGroup
+		{
+			get { return (mutexGroups.Length == 0 ? "" : mutexGroups[0]); }
+		}
+
+		public String[] MutexGroups
+		{
+			get { return (string[]) mutexGroups.Clone(); }
+		}
+
+		public UnitType EquipmentForUnit
+		{
+			get { return unitType; }
+		}
+
+		public bool IsRatioLimit
+		{
+			get { return minPercentage != 100 || maxPercentage != 100; }
+		}
+
+		public int MinNumber
+		{
+			get { return minNum; }
+			set
+			{
+				if (value >= 0 || value == WarFoundryCore.INFINITY)
+				{
+					minNum = value;
+				}
+				//TODO: Check Min<Max
+			}
+		}
+
+		public int MaxNumber
+		{
+			get { return maxNum; }
+			set
+			{
+				if (value >= 0 || value == WarFoundryCore.INFINITY)
+				{
+					maxNum = value;
+				}
+				//TODO: Check Min<Max
+			}
+		}
+
+		public double MinPercentage
+		{
+			get { return minPercentage; }
+			set
+			{
+				if (value >= 0 && value <= 100)
+				{
+					minPercentage = value;
+				}
+				//TODO: Check Min<Max
+			}
+		}
+
+		public double MaxPercentage
+		{
+			get { return maxPercentage; }
+			set
+			{
+				if (value >= 0 && value <= 100)
+				{
+					maxPercentage = value;
+				}
+				//TODO: Check Min<Max
+			}
+		}
+
+		public EquipmentItem EquipmentItem
+		{
+			get { return item; }
+		}
+
+		public override string ToString()
+		{
+			return EquipmentItem.Name + " (" + Cost + "pts each)";
+		}
+
+		public bool HasAlternatives()
+		{
+			if (MutexGroups.Length == 0)
+			{
+				return false;
+			}
+			else if (EquipmentForUnit == null)
+			{
+				return false;
+			}
+			else
+			{
+				//If the number of items in the MutEx group is greater than one then it must be this item plus another
+				return EquipmentForUnit.GetEquipmentItemsByExclusionGroups(MutexGroups).Length > 1;
+			}
+		}
+
+		public ArmourType ItemArmourType
+		{
+			get { return EquipmentItem.ItemArmourType; }
+		}
+
+		public string Description
+		{
+			get { return EquipmentItem.Description; }
+		}
+
+		public Race EquipmentForRace
+		{
+			get { return EquipmentItem.EquipmentForRace; }
+		}
+
+		public bool CanBeUsedWithItem(EquipmentItem item)
+		{
+			return EquipmentItem.CanBeUsedWithItem(item);
+		}
+
+		public bool CanBeUsedWithArmourType(ArmourType otherItemType)
+		{
+			return EquipmentItem.CanBeUsedWithArmourType(otherItemType);
+		}
+
+		[Obsolete("Use UnitEquipmentUtil method instead")]
+		public bool IsMutuallyExclusive(UnitEquipmentItem item)
+		{
+			return UnitEquipmentUtil.ItemsAreMutuallyExclusive(this, item);
+		}
+
+		public string SlotName
+		{
+			get { return slotName; }
+			set
+			{
+				if (value != null && value != "")
+				{
+					slotName = value;
+				}
+			}
+		}
 	}
 }
--- a/api/Objects/UnitType.cs	Tue Oct 06 18:29:07 2009 +0000
+++ b/api/Objects/UnitType.cs	Sun Oct 11 19:57:34 2009 +0000
@@ -29,8 +29,8 @@
 		private Dictionary<string, Ability> requiredAbilities = new Dictionary<string, Ability>();
 		private Dictionary<string, Ability> optionalAbilities = new Dictionary<string, Ability>();
 		private String notes = "";
-		private List<UnitType> containedTypes = new List<UnitType>();
-		private Dictionary<string, string> extraData = new Dictionary<string, string>();
+		private List<UnitType> containedTypes = new List<UnitType>();
+		private Dictionary<string, string> extraData = new Dictionary<string, string>();
 		private Dictionary<string, int> slotLimits = new Dictionary<string, int>();
 
 
@@ -447,34 +447,34 @@
 			get
 			{
 				return stats.StatsID;
-			}
-		}
-
-		public void AddEquipmentSlot(string slotName, int slotLimit)
-		{
-			slotLimits.Add(slotName, slotLimit);
-		}
-
-		public bool HasEquipmentSlot(string slotName)
-		{
-			return slotLimits.ContainsKey(slotName);
-		}
-
-		/// <summary>
-		/// Gets the maximum number of items allowed in a single slot
-		/// </summary>
-		/// <param name="slotName">The name of the equipment slot to get the limit for the named slot</param>
-		/// <returns>The maximum number of items allowed in a slot, or <code>-1</code> if the slot is the default one or has not been specified</returns>
-		public int GetEquipmentSlotLimit(string slotName)
-		{
-			int slotLimit = -1;
-
-			if (HasEquipmentSlot(slotName))
-			{
-				slotLimit = DictionaryUtils.GetValue(slotLimits, slotName);
-			}
-
-			return slotLimit;
+			}
+		}
+
+		public void AddEquipmentSlot(string slotName, int slotLimit)
+		{
+			slotLimits.Add(slotName, slotLimit);
+		}
+
+		public bool HasEquipmentSlot(string slotName)
+		{
+			return slotLimits.ContainsKey(slotName);
+		}
+
+		/// <summary>
+		/// Gets the maximum number of items allowed in a single slot
+		/// </summary>
+		/// <param name="slotName">The name of the equipment slot to get the limit for the named slot</param>
+		/// <returns>The maximum number of items allowed in a slot, or <code>-1</code> if the slot is the default one or has not been specified</returns>
+		public int GetEquipmentSlotLimit(string slotName)
+		{
+			int slotLimit = -1;
+
+			if (HasEquipmentSlot(slotName))
+			{
+				slotLimit = DictionaryUtils.GetValue(slotLimits, slotName);
+			}
+
+			return slotLimit;
 		}
 	}
 }
\ No newline at end of file