# HG changeset patch # User IBBoard # Date 1334419054 -3600 # Node ID 95c1b68a600b0be8f767b57550dc0b319a02f98a # Parent 750eed630c41a7ec26a43c4195b8c1179bbab437 Re #359: Add "only contained" attribute to unit types * Exclude "contained only" units from Race's list of available units diff -r 750eed630c41 -r 95c1b68a600b API/Objects/Race.cs --- 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) diff -r 750eed630c41 -r 95c1b68a600b API/Objects/UnitType.cs --- 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