diff API/Objects/GameSystem.cs @ 357:50d0d3b39a0b

Re #140: Add equality methods * Add equality method for RequiresAtLeastNUnitsRequirement * Update equality method on GameSystem and No More Than limit to use new helper class * Add equality methods on Race and UnitType as a dependent of equality of requirements
author IBBoard <dev@ibboard.co.uk>
date Tue, 26 Apr 2011 19:19:08 +0000
parents 3c4a6403a88c
children 5733e3b957cc
line wrap: on
line diff
--- a/API/Objects/GameSystem.cs	Mon Apr 25 15:11:20 2011 +0000
+++ b/API/Objects/GameSystem.cs	Tue Apr 26 19:19:08 2011 +0000
@@ -4,6 +4,7 @@
 
 using System.Collections.Generic;
 using IBBoard.WarFoundry.API.Factories;
+using Col = IBBoard.Collections;
 
 namespace IBBoard.WarFoundry.API.Objects
 {
@@ -221,8 +222,14 @@
 			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));
+				if (!ID.Equals(otherSystem.ID) || !Name.Equals(otherSystem.Name) || !Col.Collections.AreEqual(RawCategories, otherSystem.RawCategories))
+				{
+					return false;
+				}
+				else
+				{
+					return true;
+				}
 			}
 			else
 			{