comparison API/Objects/Race.cs @ 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 71fceea2725b
children
comparison
equal deleted inserted replaced
467:750eed630c41 468:95c1b68a600b
29 { 29 {
30 } 30 }
31 31
32 public Race(string raceID, string raceSubID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID != "" ? "_" + raceSubID : ""), raceName, creatingFactory) 32 public Race(string raceID, string raceSubID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID != "" ? "_" + raceSubID : ""), raceName, creatingFactory)
33 { 33 {
34 subID = (raceSubID == null ? "" : raceSubID); 34 subID = raceSubID ?? "";
35 system = gameSystem; 35 system = gameSystem;
36 } 36 }
37 37
38 public override bool Equals (object obj) 38 public override bool Equals (object obj)
39 { 39 {
204 return unitTypesArray; 204 return unitTypesArray;
205 } 205 }
206 206
207 private void CacheUnitType(UnitType unit) 207 private void CacheUnitType(UnitType unit)
208 { 208 {
209 if (unit.IsContainedOnly)
210 {
211 return;
212 }
213
209 BuildUnitTypesByCategoryCache(); 214 BuildUnitTypesByCategoryCache();
210 215
211 foreach (Category cat in unit.Categories) 216 foreach (Category cat in unit.Categories)
212 { 217 {
213 Dictionary<string, UnitType> catUnitTypes = DictionaryUtils.GetValue(unitTypesByCat, cat); 218 Dictionary<string, UnitType> catUnitTypes = DictionaryUtils.GetValue(unitTypesByCat, cat);