Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison api/Objects/UnitEquipmentItem.cs @ 161:81abc04b3dbe
Re #192: Improve "clean coding" practice
* Move some calculation methods for equipment out of the encapsulation objects
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 04 Oct 2009 12:00:16 +0000 |
parents | 6ff68daab5dc |
children | 91f7b8da0b53 |
comparison
equal
deleted
inserted
replaced
160:41b927998a41 | 161:81abc04b3dbe |
---|---|
2 // | 2 // |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | 3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
4 | 4 |
5 using System; | 5 using System; |
6 using IBBoard.Lang; | 6 using IBBoard.Lang; |
7 using IBBoard.WarFoundry.API.Util; | |
7 | 8 |
8 namespace IBBoard.WarFoundry.API.Objects | 9 namespace IBBoard.WarFoundry.API.Objects |
9 { | 10 { |
10 /// <summary> | 11 /// <summary> |
11 /// Summary description for UnitEquipmentItem. | 12 /// Summary description for UnitEquipmentItem. |
227 public bool CanBeUsedWithArmourType(ArmourType otherItemType) | 228 public bool CanBeUsedWithArmourType(ArmourType otherItemType) |
228 { | 229 { |
229 return EquipmentItem.CanBeUsedWithArmourType(otherItemType); | 230 return EquipmentItem.CanBeUsedWithArmourType(otherItemType); |
230 } | 231 } |
231 | 232 |
232 /// <summary> | 233 [Obsolete("Use UnitEquipmentUtil method instead")] |
233 /// Checks the "mutex" (mutual exclusion) groups of the other item against its own and determines whether the two items are mutually exclusive (share at least one mutex group) | |
234 /// </summary> | |
235 /// <param name="item">the item to check against</param> | |
236 /// <returns><code>true</code> if the two items share at least one mutex group, else <code>false</code></returns> | |
237 public bool IsMutuallyExclusive(UnitEquipmentItem item) | 234 public bool IsMutuallyExclusive(UnitEquipmentItem item) |
238 { | 235 { |
239 bool areMutex = false; | 236 return UnitEquipmentUtil.ItemsAreMutuallyExclusive(this, item); |
240 | |
241 foreach (string mutex in MutexGroups) | |
242 { | |
243 foreach (string otherMutex in item.MutexGroups) | |
244 { | |
245 if (mutex.Equals(otherMutex)) | |
246 { | |
247 areMutex = true; | |
248 goto postLoop; | |
249 } | |
250 } | |
251 } | |
252 postLoop: | |
253 | |
254 return areMutex; | |
255 } | 237 } |
256 } | 238 } |
257 } | 239 } |