Mercurial > repos > snowblizz-super-API-ideas
changeset 66:d100ca4bd0c1
Re #61 - Update classes to match schema
* Add "extra data" methods to UnitType, since it may be used for requirements and we can't guarantee that the data can be fetched at the time of requirement creation
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 11 Apr 2009 14:53:45 +0000 |
parents | aa2d05a9c635 |
children | e6200220ece3 |
files | api/Objects/UnitType.cs |
diffstat | 1 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Objects/UnitType.cs Thu Apr 09 18:27:51 2009 +0000 +++ b/api/Objects/UnitType.cs Sat Apr 11 14:53:45 2009 +0000 @@ -29,7 +29,8 @@ private Dictionary<string, Ability> requiredAbilities = new Dictionary<string, Ability>(); private Dictionary<string, Ability> optionalAbilities = new Dictionary<string, Ability>(); private List<String> notes = new List<string>(); - private List<UnitType> containedTypes = new List<UnitType>(); + private List<UnitType> containedTypes = new List<UnitType>(); + private Dictionary<string, string> extraData = new Dictionary<string, string>(); public UnitType(string id, string typeName, Race parentRace) : base(id, typeName) @@ -217,8 +218,7 @@ if (mutexGroup!="" && mutexGroup!=null) { - List<UnitEquipmentItem> items = null; - equipmentExclusionGroups.TryGetValue(mutexGroup, out items); + List<UnitEquipmentItem> items = DictionaryUtils.GetValue(equipmentExclusionGroups, mutexGroup); if (items == null) { @@ -241,9 +241,7 @@ /// </returns> public UnitEquipmentItem GetEquipmentItem(string id) { - UnitEquipmentItem equipItem = null; - equipment.TryGetValue(id, out equipItem); - return equipItem; + return DictionaryUtils.GetValue(equipment, id); } /// <summary> @@ -273,8 +271,7 @@ public UnitEquipmentItem[] GetEquipmentItemsByExclusionGroup(string group) { - List<UnitEquipmentItem> list = null; - equipmentExclusionGroups.TryGetValue(group, out list); + List<UnitEquipmentItem> list = nDictionaryUtils.GetValue(equipmentExclusionGroups, group); if (list == null) { @@ -403,6 +400,16 @@ public void AddContainedUnitType(UnitType containedType) { containedTypes.Add(containedType); + } + + public void AddExtraData(string id, string data) + { + extraData[id] = data; + } + + public string GetExtraData(string id) + { + return DictionaryUtils.GetValue(extraData, id); } } -} +} \ No newline at end of file