comparison api/Objects/UnitType.cs @ 85:46ad6f478203

Re #50: Complete core loading of WarFoundry XML files * Start loading of UnitEquipmentItems * Fix XPath queries for equipment items and abilities * Allow UnitEquipmentItem to be created without a UnitType * Make adding UnitEquipmentItem to UnitType set UnitType of UnitEquipmentItem * Make loading of abilities and equipment items add the item to the race Also: * Code cleanup (line endings) * Make method to get equipment by ID return null instead of throwing "no such key" exception
author IBBoard <dev@ibboard.co.uk>
date Sat, 01 Aug 2009 16:06:25 +0000
parents 3ea0ab04352b
children 729d9e54162c
comparison
equal deleted inserted replaced
84:2b977962302a 85:46ad6f478203
227 return stats.GetStatValue(statName); 227 return stats.GetStatValue(statName);
228 } 228 }
229 229
230 public void AddEquipmentItem(UnitEquipmentItem item) 230 public void AddEquipmentItem(UnitEquipmentItem item)
231 { 231 {
232 equipment.Add(item.ID, item); 232 if (!equipment.ContainsKey(item.ID))
233 equipmentKeyOrder.Add(item.ID); 233 {
234 AddToMutexGroup(item); 234 equipment.Add(item.ID, item);
235 equipmentKeyOrder.Add(item.ID);
236 AddToMutexGroup(item);
237 item.EquipmentForUnit = this;
238 }
235 } 239 }
236 240
237 private void AddToMutexGroup(UnitEquipmentItem item) 241 private void AddToMutexGroup(UnitEquipmentItem item)
238 { 242 {
239 string mutexGroup = item.MutexGroup; 243 string mutexGroup = item.MutexGroup;