comparison api/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 152:0c0e14f03785

Re #180: Add multiple mutex groups * Add multiple mutex groups to UnitEquipmentItem * Add new attribute to Race schema * Make everywhere handle multiple groups instead of assuming one * Make factory load new attribute then fall back to old (deprecated) attribute * Add method to Unit to get the blocking items (useful for future UI work to say "replace X and Y with Z") * Add IsMutuallyExclusive method to UnitEquipmentItem to determine whether mutex groups overlap
author IBBoard <dev@ibboard.co.uk>
date Sat, 26 Sep 2009 19:51:11 +0000
parents c11c0da01bbc
children 4a02c07278e7
comparison
equal deleted inserted replaced
151:1d13820b3d96 152:0c0e14f03785
152 string id = equip.GetAttribute("id"); 152 string id = equip.GetAttribute("id");
153 EquipmentItem equipItem = type.Race.GetEquipmentItem(id); 153 EquipmentItem equipItem = type.Race.GetEquipmentItem(id);
154 154
155 if (equipItem!=null) 155 if (equipItem!=null)
156 { 156 {
157 string mutexGroup = equip.GetAttribute("exclusivityGroup"); 157 string mutexGroupString = equip.GetAttribute("exclusivityGroups");
158 UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroup); 158 string[] mutexGroups;
159
160 if (mutexGroupString == "")
161 {
162 mutexGroupString = equip.GetAttribute("exclusivityGroup");
163 }
164
165 if (mutexGroupString != "")
166 {
167 string[] groups = mutexGroupString.Split(',');
168 int groupCount = groups.Length;
169
170 for (int i = 0; i < groupCount; i++)
171 {
172 groups[i] = groups[i].Trim();
173 }
174
175 mutexGroups = groups;
176 }
177 else
178 {
179 mutexGroups = new string[0];
180 }
181
182 UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups);
159 unitEquipItem.RoundNumberUp = equip.GetAttribute("roundDirection").Equals("up"); 183 unitEquipItem.RoundNumberUp = equip.GetAttribute("roundDirection").Equals("up");
160 184
161 185
162 try 186 try
163 { 187 {