Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff 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 |
line wrap: on
line diff
--- a/api/Objects/UnitType.cs Sun Jul 05 09:50:40 2009 +0000 +++ b/api/Objects/UnitType.cs Sat Aug 01 16:06:25 2009 +0000 @@ -229,9 +229,13 @@ public void AddEquipmentItem(UnitEquipmentItem item) { - equipment.Add(item.ID, item); - equipmentKeyOrder.Add(item.ID); - AddToMutexGroup(item); + if (!equipment.ContainsKey(item.ID)) + { + equipment.Add(item.ID, item); + equipmentKeyOrder.Add(item.ID); + AddToMutexGroup(item); + item.EquipmentForUnit = this; + } } private void AddToMutexGroup(UnitEquipmentItem item)