diff api/Objects/GameSystem.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 b271a2252758
children 2f3cafb69799
line wrap: on
line diff
--- a/api/Objects/GameSystem.cs	Wed May 27 19:43:09 2009 +0000
+++ b/api/Objects/GameSystem.cs	Sat Jun 27 18:59:49 2009 +0000
@@ -2,26 +2,26 @@
 //
 // 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.Xml;
-using System.IO;
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
 using IBBoard.Logging;
-using IBBoard.WarFoundry.API.Factories;
+using IBBoard.WarFoundry.API.Factories;
 using ICSharpCode.SharpZipLib.Zip;
-
-namespace IBBoard.WarFoundry.API.Objects
-{
-	/// <summary>
-	/// Summary description for GameSystem.
-	/// </summary>
-	public class GameSystem : WarFoundryStagedLoadingObject
-	{
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	/// <summary>
+	/// Summary description for GameSystem.
+	/// </summary>
+	public class GameSystem : WarFoundryStagedLoadingObject
+	{
 		private bool warnOnError;
-		private bool allowAllies;
-		private Dictionary<string, Category> categories = new Dictionary<string,Category>();
+		private bool allowAllies;
+		private Dictionary<string, Category> categories = new Dictionary<string,Category>();
 		private Dictionary<string, SystemStats> stats = new Dictionary<string,SystemStats>();
-		private string defaultStats;
+		private string defaultStats;
 
 		public GameSystem(string systemID, string systemName, IWarFoundryFactory creatingFactory) : base(systemID, systemName, creatingFactory)
 		{
@@ -37,37 +37,37 @@
 		public void AddCategory(Category cat)
 		{
 			RawCategories[cat.ID] = cat;
-		}
-
-		public Category GetCategory(string id)
+		}
+
+		public Category GetCategory(string id)
 		{
 			EnsureFullyLoaded();
 			Category cat = null;
 			RawCategories.TryGetValue(id, out cat);
-			return cat;
-		}
-
-		public Category[] Categories
-		{
-			get 
+			return cat;
+		}
+
+		public Category[] Categories
+		{
+			get 
 			{ 
-				EnsureFullyLoaded();
-				return DictionaryUtils.ToArray<string, Category>(RawCategories); 
-			}
+				EnsureFullyLoaded();
+				return DictionaryUtils.ToArray<string, Category>(RawCategories); 
+			}
 		}
 		
 		protected Dictionary<string, Category> RawCategories
 		{
 			get { return categories; }
-		}
-
-		public bool WarnOnError
-		{
+		}
+
+		public bool WarnOnError
+		{
 			get
 			{
 				return warnOnError;
-			}
-			set { warnOnError = value; }
+			}
+			set { warnOnError = value; }
 		}
 		
 		public void AddSystemStats(SystemStats sysStats)
@@ -98,17 +98,17 @@
 					defaultStats = value;
 				}
 			}
-		}
-
-		public SystemStats[] SystemStats
-		{
-			get 
+		}
+
+		public SystemStats[] SystemStats
+		{
+			get 
 			{ 
 				EnsureFullyLoaded();
 				SystemStats[] statsArray = new SystemStats[stats.Count];
-				stats.Values.CopyTo(statsArray, 0);
-				return statsArray;
-			}
+				stats.Values.CopyTo(statsArray, 0);
+				return statsArray;
+			}
 		}
 		
 		public SystemStats GetSystemStatsForID(string id)
@@ -122,50 +122,50 @@
 		public Race SystemDefaultRace
 		{
 			get { return WarFoundryLoader.GetDefault().GetRace(this, Race.SYSTEM_DEFAULT_RACE_ID); }
-		}
-
-		public bool Matches(GameSystem otherSystem)
-		{
-			if (otherSystem==null)
-			{
-				return false;
-			}
-
-			return this.ID == otherSystem.ID;
-		}
-
-		public override bool Equals(object obj)
+		}
+
+		public bool Matches(GameSystem otherSystem)
+		{
+			if (otherSystem==null)
+			{
+				return false;
+			}
+
+			return this.ID == otherSystem.ID;
+		}
+
+		public override bool Equals(object obj)
 		{
 			if (obj == null)
 			{
 				return false;		
 			}
-			
-			if (obj.GetType().Equals(this.GetType()))
-			{
-				GameSystem otherSystem = (GameSystem)obj;
-
-				return this.ID == otherSystem.ID && this.Name == otherSystem.Name && ((this.RawCategories == null && otherSystem.RawCategories == null) || this.RawCategories.Equals(otherSystem.RawCategories));
-			}
-			else
-			{
-				return false;
-			}
-		}
-
-		public override int GetHashCode()
-		{
-			return ID.GetHashCode() + Name.GetHashCode() + (RawCategories!=null ? RawCategories.GetHashCode() : 0) + warnOnError.GetHashCode();
-		}
-
-		public bool UnitTypeMaxed(UnitType unitType, Army army)
-		{
-			return unitType.MaxNumber!=WarFoundryCore.INFINITY && army.GetUnitTypeCount(unitType) >= unitType.MaxNumber;
-		}
-
-		public bool UnitTypeMinned(UnitType unitType, Army army)
-		{
-			return army.GetUnitTypeCount(unitType) <= unitType.MinNumber;
+			
+			if (obj.GetType().Equals(this.GetType()))
+			{
+				GameSystem otherSystem = (GameSystem)obj;
+
+				return this.ID == otherSystem.ID && this.Name == otherSystem.Name && ((this.RawCategories == null && otherSystem.RawCategories == null) || this.RawCategories.Equals(otherSystem.RawCategories));
+			}
+			else
+			{
+				return false;
+			}
+		}
+
+		public override int GetHashCode()
+		{
+			return ID.GetHashCode() + Name.GetHashCode() + (RawCategories!=null ? RawCategories.GetHashCode() : 0) + warnOnError.GetHashCode();
+		}
+
+		public bool UnitTypeMaxed(UnitType unitType, Army army)
+		{
+			return unitType.MaxNumber!=WarFoundryCore.INFINITY && army.GetUnitTypeCount(unitType) >= unitType.MaxNumber;
+		}
+
+		public bool UnitTypeMinned(UnitType unitType, Army army)
+		{
+			return army.GetUnitTypeCount(unitType) <= unitType.MinNumber;
 		}
 		
 		public List<EquipmentItem> GetSystemEquipmentList()
@@ -244,6 +244,6 @@
 			}
 			
 			return ability;
-		}
-	}
-}
+		}
+	}
+}