Mercurial > repos > IBBoard.WarFoundry.API
comparison API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirement.cs @ 356:51cccccf3669
Re #27: Unit requirements
* Initial work to try to make unit types return requirements for count limits
* Add requirements when limits aren't defaults
* Start adding equality/hash code methods
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 25 Apr 2011 15:11:20 +0000 |
parents | 44a6539fadf9 |
children | 50d0d3b39a0b |
comparison
equal
deleted
inserted
replaced
355:47712a323cf2 | 356:51cccccf3669 |
---|---|
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 return canAdd; | 112 return canAdd; |
113 } | 113 } |
114 | |
115 public override bool Equals(object obj) | |
116 { | |
117 if (obj == null) | |
118 { | |
119 return false; | |
120 } | |
121 else if (!(obj is RequiresNoMoreThanNOfUnitTypeRequirement)) | |
122 { | |
123 return false; | |
124 } | |
125 else | |
126 { | |
127 RequiresNoMoreThanNOfUnitTypeRequirement other = (RequiresNoMoreThanNOfUnitTypeRequirement)obj; | |
128 | |
129 if (limitedTypes.Count != other.limitedTypes.Count) | |
130 { | |
131 return false; | |
132 } | |
133 else | |
134 { | |
135 foreach (UnitCountRequirementData req in limitedTypes) | |
136 { | |
137 if (!other.limitedTypes.Contains(req)) | |
138 { | |
139 | |
140 } | |
141 } | |
142 | |
143 return true; | |
144 } | |
145 } | |
146 } | |
147 | |
148 public override int GetHashCode() | |
149 { | |
150 return base.GetHashCode (); | |
151 } | |
114 } | 152 } |
115 } | 153 } |
116 | 154 |