Mercurial > repos > IBBoard.WarFoundry.API
diff API/Objects/UnitType.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 | 51cccccf3669 |
children | 1a70ca80ef41 |
line wrap: on
line diff
--- a/API/Objects/UnitType.cs Mon Apr 25 15:11:20 2011 +0000 +++ b/API/Objects/UnitType.cs Tue Apr 26 19:19:08 2011 +0000 @@ -45,6 +45,31 @@ race = parentRace; } + public override bool Equals (object obj) + { + if (obj == null) + { + return false; + } + else if (!(obj is UnitType)) + { + return false; + } + else + { + UnitType other = (UnitType)obj; + + if (!ID.Equals(other.ID) || !Name.Equals(other.Name) || !Race.Equals(other.Race)) + { + return false; + } + else + { + return true; + } + } + } + public GameSystem GameSystem { get { return Race.GameSystem; }