diff api/Objects/Race.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 9080366031c0
children 46ad6f478203
line wrap: on
line diff
--- a/api/Objects/Race.cs	Wed May 27 19:43:09 2009 +0000
+++ b/api/Objects/Race.cs	Sat Jun 27 18:59:49 2009 +0000
@@ -2,9 +2,9 @@
 //
 // 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.Collections.Generic;
-using System.IO;
+using System;
+using System.Collections.Generic;
+using System.IO;
 using System.Xml;
 using IBBoard.IO;
 using IBBoard.WarFoundry.API.Factories;
@@ -14,13 +14,13 @@
 	public class Race : WarFoundryStagedLoadingObject
 	{		
 		public static string SYSTEM_DEFAULT_RACE_ID = "GameDefault"; 
-		
+		
 		private string subID;
-		private GameSystem system;
-		private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat;
-		private Dictionary<string, UnitType> unitTypes = new Dictionary<string,UnitType>();
+		private GameSystem system;
+		private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat;
+		private Dictionary<string, UnitType> unitTypes = new Dictionary<string,UnitType>();
 		private Dictionary<string, EquipmentItem> equipment = new Dictionary<string,EquipmentItem>();
-		private Dictionary<string, Ability> abilities = new Dictionary<string,Ability>();
+		private Dictionary<string, Ability> abilities = new Dictionary<string,Ability>();
 		private Dictionary<string, Category> categories = new Dictionary<string,Category>();
 		
 		public Race(string raceID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : this(raceID, "", raceName, gameSystem, creatingFactory)
@@ -41,17 +41,17 @@
 		[Obsolete("Use constructor with GameSystem argument instead")]
 		public Race(string raceID, string raceSubID, string raceName, string gameSystemID, IWarFoundryFactory creatingFactory) : this(raceID, raceSubID, raceName, WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID), creatingFactory)
 		{
-		}
-
-		public string SubID
-		{
-			get { return subID; }
-			set { subID = (value == null ? "" : value.Trim()); }
-		}
-
-		public GameSystem GameSystem
-		{
-			get { return system; }
+		}
+
+		public string SubID
+		{
+			get { return subID; }
+			set { subID = (value == null ? "" : value.Trim()); }
+		}
+
+		public GameSystem GameSystem
+		{
+			get { return system; }
 			set
 			{
 				if (value == null)
@@ -60,13 +60,13 @@
 				}
 				
 				system = value;
-			}
+			}
 		}
 		
 		public void AddCategory(Category cat)
 		{
 			categories[cat.ID] = cat;
-		}
+		}
 
 		/// <summary>
 		/// Gets a category from its ID. Attempts to get the category from the race's overrides, or else it falls back to getting the Game System's category with that ID.
@@ -76,8 +76,8 @@
 		/// </param>
 		/// <returns>
 		/// The <code>Category</code> with the specified ID, or null if one doesn't exist. 
-		/// </returns>
-		public Category GetCategory(string id)
+		/// </returns>
+		public Category GetCategory(string id)
 		{
 			EnsureFullyLoaded();
 			Category cat = null;
@@ -88,12 +88,12 @@
 				cat = GameSystem.GetCategory(id);
 			}
 						
-			return cat;
-		}
+			return cat;
+		}
 
-		public Category[] Categories
-		{
-			get 
+		public Category[] Categories
+		{
+			get 
 			{ 
 				EnsureFullyLoaded();
 				Category[] cats;
@@ -106,14 +106,14 @@
 				{
 					cats = DictionaryUtils.ToArray<string, Category>(categories);
 				}
-				
-				return cats;
-			}
-		}
-
-		public bool HasCategoryOverrides()
-		{
-			return categories.Count > 0;
+				
+				return cats;
+			}
+		}
+
+		public bool HasCategoryOverrides()
+		{
+			return categories.Count > 0;
 		}
 
 		public void AddEquipmentItem(EquipmentItem item)
@@ -129,12 +129,12 @@
 			{
 				AddEquipmentItem(item);
 			}
-		}
-
-		public  EquipmentItem GetEquipmentItem(string id)
+		}
+
+		public  EquipmentItem GetEquipmentItem(string id)
 		{
-			EnsureFullyLoaded();
-			return (EquipmentItem)equipment[id];
+			EnsureFullyLoaded();
+			return (EquipmentItem)equipment[id];
 		}
 		
 		public List<EquipmentItem> GetEquipmentList()
@@ -162,9 +162,9 @@
 			{
 				AddUnitType(type);
 			}
-		}
-
-		public UnitType[] GetUnitTypes(Category cat)
+		}
+
+		public UnitType[] GetUnitTypes(Category cat)
 		{		
 			BuildUnitTypesByCategoryCache();
 			Dictionary<string, UnitType> unitTypesDictionary;
@@ -179,21 +179,21 @@
 			{
 				unitTypesArray = DictionaryUtils.ToArray<string, UnitType>(unitTypesDictionary);
 			}
-			
-			return unitTypesArray;
+			
+			return unitTypesArray;
 		}
 
 		private void CacheUnitType(UnitType unit)
 		{
 			BuildUnitTypesByCategoryCache();
-			Dictionary<string,UnitType> catUnitTypes;
-			unitTypesByCat.TryGetValue(unit.MainCategory, out catUnitTypes);
-
-			if (catUnitTypes == null)
-			{
-				throw new InvalidFileException(String.Format("Unit type {0} with name {1} is a unit of an undefined category", unit.ID, unit.Name));
-			}
-
+			Dictionary<string,UnitType> catUnitTypes;
+			unitTypesByCat.TryGetValue(unit.MainCategory, out catUnitTypes);
+
+			if (catUnitTypes == null)
+			{
+				throw new InvalidFileException(String.Format("Unit type {0} with name {1} is a unit of an undefined category", unit.ID, unit.Name));
+			}
+
 			catUnitTypes.Add(unit.ID, unit);
 		}
 		
@@ -209,22 +209,22 @@
 		{
 			unitTypesByCat = new Dictionary<Category,Dictionary<string,UnitType>>();
 				
-			foreach (Category category in Categories)
-			{ 
-				unitTypesByCat.Add(category, new Dictionary<string, UnitType>());
+			foreach (Category category in Categories)
+			{ 
+				unitTypesByCat.Add(category, new Dictionary<string, UnitType>());
 			}
 			
 			foreach (UnitType unit in unitTypes.Values)
 			{
 				CacheUnitType(unit);
 			}
-		}
-
-		public UnitType GetUnitType(string id)
+		}
+
+		public UnitType GetUnitType(string id)
 		{
 			UnitType type = null;
-			unitTypes.TryGetValue(id, out type);
-			return type;
+			unitTypes.TryGetValue(id, out type);
+			return type;
 		}
 		
 		public List<Ability> GetAbilityList()
@@ -255,13 +255,13 @@
 			abilities.TryGetValue(id, out ability);
 			return ability;
 		}
-		
+		
 		protected virtual Dictionary<string, UnitType> RaceUnitTypes
 		{
 			get { return RaceRawUnitTypes; }
 			set	{ RaceRawUnitTypes = value; }
 		}
-		
+		
 		protected virtual Dictionary<string, EquipmentItem> RaceEquipment
 		{
 			get { return RaceRawEquipment; }
@@ -273,13 +273,13 @@
 			get { return RaceRawAbilities; }
 			set { RaceRawAbilities = value; }
 		}
-		
+		
 		protected Dictionary<string, UnitType> RaceRawUnitTypes
 		{
 			get { return unitTypes; }
 			set	{ unitTypes = value; }
 		}
-		
+		
 		protected Dictionary<string, EquipmentItem> RaceRawEquipment
 		{
 			get { return equipment; }