changeset 468:95c1b68a600b

Re #359: Add "only contained" attribute to unit types * Exclude "contained only" units from Race's list of available units
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Apr 2012 16:57:34 +0100
parents 750eed630c41
children 2ba1f24eb427
files API/Objects/Race.cs API/Objects/UnitType.cs
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/Race.cs	Sat Mar 31 20:18:42 2012 +0100
+++ b/API/Objects/Race.cs	Sat Apr 14 16:57:34 2012 +0100
@@ -31,7 +31,7 @@
 
 		public Race(string raceID, string raceSubID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID != "" ? "_" + raceSubID : ""), raceName, creatingFactory)
 		{
-			subID = (raceSubID == null ? "" : raceSubID);
+			subID = raceSubID ?? "";
 			system = gameSystem;
 		}
 
@@ -206,6 +206,11 @@
 
 		private void CacheUnitType(UnitType unit)
 		{
+			if (unit.IsContainedOnly)
+			{
+				return;
+			}
+
 			BuildUnitTypesByCategoryCache();
 
 			foreach (Category cat in unit.Categories)
--- a/API/Objects/UnitType.cs	Sat Mar 31 20:18:42 2012 +0100
+++ b/API/Objects/UnitType.cs	Sat Apr 14 16:57:34 2012 +0100
@@ -590,5 +590,7 @@
 		{
 			unitMemberTypes.Add(unitMemberType.ID, unitMemberType);
 		}
+
+		protected internal bool IsContainedOnly { get; set; }
 	}
 }
\ No newline at end of file