diff api/Objects/UnitType.cs @ 254:cdda78975be1

Fixes #268: Restructure stats for re-use * Present new stats through Unit * Add property to get array of type IDs
author IBBoard <dev@ibboard.co.uk>
date Sun, 02 May 2010 15:45:31 +0000
parents 79943fcf4de2
children 958ecd7b2844
line wrap: on
line diff
--- a/api/Objects/UnitType.cs	Mon Apr 26 19:49:51 2010 +0000
+++ b/api/Objects/UnitType.cs	Sun May 02 15:45:31 2010 +0000
@@ -225,7 +225,7 @@
 		{
 			get
 			{
-				Stat[][] statsArray = null;
+				Stat[][] statsArray;
 				
 				if (stats != null)
 				{
@@ -253,6 +253,36 @@
 				return statsArray;
 			}
 		}
+		
+		public string[] UnitStatsArrayIDs
+		{
+			get 
+			{
+				string[] ids;
+				
+				if (stats != null)
+				{
+					ids = new string[]{ stats.StatsID };
+				}
+				else if (unitMemberTypes.Count > 0)
+				{
+					ids = new string[unitMemberTypes.Count];
+					int i = 0;
+					
+					foreach (UnitMemberType memType in unitMemberTypes.Values)
+					{
+						ids[i] = memType.StatsID;
+						i++;
+					}
+				}
+				else
+				{
+					ids = new string[]{ GameSystem.StandardSystemStatsID };
+				}
+				
+				return ids;
+			}
+		}
 
 		//// <value>
 		/// The array of <see cref="Stat"/>s for each of the unit's stat lines including an additional column that contains the unit type name