comparison API/Objects/Race.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 12a56786120c
children 71fceea2725b
comparison
equal deleted inserted replaced
356:51cccccf3669 357:50d0d3b39a0b
33 { 33 {
34 subID = (raceSubID == null ? "" : raceSubID); 34 subID = (raceSubID == null ? "" : raceSubID);
35 system = gameSystem; 35 system = gameSystem;
36 } 36 }
37 37
38 public override bool Equals (object obj)
39 {
40 if (obj == null)
41 {
42 return false;
43 }
44 else if (!(obj is Race))
45 {
46 return false;
47 }
48 else
49 {
50 Race other = (Race)obj;
51
52 if (!ID.Equals(other.ID) || !SubID.Equals(other.SubID) || !GameSystem.Equals(other.GameSystem))
53 {
54 return false;
55 }
56 else
57 {
58 return true;
59 }
60 }
61 }
62
38 public string SubID 63 public string SubID
39 { 64 {
40 get { return subID; } 65 get { return subID; }
41 set { subID = (value == null ? "" : value.Trim()); } 66 set { subID = (value == null ? "" : value.Trim()); }
42 } 67 }