diff 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
line wrap: on
line diff
--- a/api/Objects/UnitEquipmentItem.cs	Sun Oct 04 10:49:17 2009 +0000
+++ b/api/Objects/UnitEquipmentItem.cs	Sun Oct 04 12:00:16 2009 +0000
@@ -3,7 +3,8 @@
 // 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.
 
 using System;
-using IBBoard.Lang;
+using IBBoard.Lang;
+using IBBoard.WarFoundry.API.Util;
 
 namespace IBBoard.WarFoundry.API.Objects
 {
@@ -229,29 +230,10 @@
 			return EquipmentItem.CanBeUsedWithArmourType(otherItemType);
 		}
 
-		/// <summary>
-		/// 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)
-		/// </summary>
-		/// <param name="item">the item to check against</param>
-		/// <returns><code>true</code> if the two items share at least one mutex group, else <code>false</code></returns>
+		[Obsolete("Use UnitEquipmentUtil method instead")]
 		public bool IsMutuallyExclusive(UnitEquipmentItem item)
-		{
-			bool areMutex = false;
-
-			foreach (string mutex in MutexGroups)
-			{
-				foreach (string otherMutex in item.MutexGroups)
-				{
-					if (mutex.Equals(otherMutex))
-					{
-						areMutex = true;
-						goto postLoop;
-					}
-				}
-			}
-			postLoop:
-
-			return areMutex;
+		{
+			return UnitEquipmentUtil.ItemsAreMutuallyExclusive(this, item);
 		}
 	}
 }