Mercurial > repos > IBBoard.WarFoundry.API
annotate api/Objects/Race.cs @ 232:f5009a00a50d
Re #236: Handle null game system in race
* Fix error message text
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 24 Dec 2009 14:57:32 +0000 |
parents | d39de20f2ba1 |
children | a54da5a8b5bb |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
1 // This file (Race.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard. |
0 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
0 | 4 |
82 | 5 using System; |
6 using System.Collections.Generic; | |
7 using System.IO; | |
0 | 8 using System.Xml; |
9 using IBBoard.IO; | |
10 using IBBoard.WarFoundry.API.Factories; | |
11 | |
12 namespace IBBoard.WarFoundry.API.Objects | |
13 { | |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
14 public class Race : WarFoundryStagedLoadingObject |
0 | 15 { |
16 public static string SYSTEM_DEFAULT_RACE_ID = "GameDefault"; | |
82 | 17 |
0 | 18 private string subID; |
82 | 19 private GameSystem system; |
20 private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat; | |
21 private Dictionary<string, UnitType> unitTypes = new Dictionary<string,UnitType>(); | |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
22 private Dictionary<string, EquipmentItem> equipment = new Dictionary<string,EquipmentItem>(); |
82 | 23 private Dictionary<string, Ability> abilities = new Dictionary<string,Ability>(); |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
24 private Dictionary<string, Category> categories = new Dictionary<string,Category>(); |
0 | 25 |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
26 public Race(string raceID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : this(raceID, "", raceName, gameSystem, creatingFactory) |
0 | 27 { |
28 } | |
29 | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
30 public Race(string raceID, string raceSubID, string raceName, GameSystem gameSystem, IWarFoundryFactory creatingFactory) : base(raceID + (raceSubID!="" ? "_"+raceSubID : ""), raceName, creatingFactory) |
0 | 31 { |
32 subID = (raceSubID == null ? "" : raceSubID); | |
54
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
33 system = gameSystem; |
3a90f70dac73
Re #61 - Complete structure of WarFoundry API objects
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
34 } |
82 | 35 |
36 public string SubID | |
37 { | |
38 get { return subID; } | |
39 set { subID = (value == null ? "" : value.Trim()); } | |
40 } | |
41 | |
42 public GameSystem GameSystem | |
43 { | |
44 get { return system; } | |
0 | 45 set |
46 { | |
47 if (value == null) | |
48 { | |
49 throw new ArgumentException("Game system for a race cannot be null"); | |
50 } | |
51 | |
52 system = value; | |
82 | 53 } |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
54 } |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
55 |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
56 public void AddCategory(Category cat) |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
57 { |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
58 categories[cat.ID] = cat; |
82 | 59 } |
0 | 60 |
61 /// <summary> | |
62 /// Gets a category from its ID. Attempts to get the category from the race's overrides, or else it falls back to getting the Game System's category with that ID. | |
63 /// </summary> | |
64 /// <param name="id"> | |
65 /// The ID of the category to get | |
66 /// </param> | |
67 /// <returns> | |
68 /// The <code>Category</code> with the specified ID, or null if one doesn't exist. | |
82 | 69 /// </returns> |
70 public Category GetCategory(string id) | |
0 | 71 { |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
72 EnsureFullyLoaded(); |
0 | 73 Category cat = null; |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
74 categories.TryGetValue(id, out cat); |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
75 |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
76 if (cat == null) |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
77 { |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
78 cat = GameSystem.GetCategory(id); |
0 | 79 } |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
80 |
82 | 81 return cat; |
82 } | |
0 | 83 |
82 | 84 public Category[] Categories |
85 { | |
86 get | |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
87 { |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
88 EnsureFullyLoaded(); |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
89 Category[] cats; |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
90 |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
91 if (!HasCategoryOverrides()) |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
92 { |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
93 cats = GameSystem.Categories; |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
94 } |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
95 else |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
96 { |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
97 cats = DictionaryUtils.ToArray<string, Category>(categories); |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
98 } |
82 | 99 |
100 return cats; | |
101 } | |
102 } | |
103 | |
104 public bool HasCategoryOverrides() | |
105 { | |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
106 EnsureFullyLoaded(); |
82 | 107 return categories.Count > 0; |
0 | 108 } |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
109 |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
110 public void AddEquipmentItem(EquipmentItem item) |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
111 { |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
112 //TODO: Throw DuplicateItemException |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
113 equipment.Add(item.ID, item); |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
114 } |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
115 |
85
46ad6f478203
Re #50: Complete core loading of WarFoundry XML files
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
116 public EquipmentItem GetEquipmentItem(string id) |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
117 { |
82 | 118 EnsureFullyLoaded(); |
85
46ad6f478203
Re #50: Complete core loading of WarFoundry XML files
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
119 return DictionaryUtils.GetValue(equipment, id); |
0 | 120 } |
121 | |
122 public List<EquipmentItem> GetEquipmentList() | |
123 { | |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
124 EnsureFullyLoaded(); |
0 | 125 List<EquipmentItem> items = new List<EquipmentItem>(); |
126 | |
127 foreach (EquipmentItem item in equipment.Values) | |
128 { | |
129 items.Add(item); | |
130 } | |
131 | |
132 return items; | |
133 } | |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
134 |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
135 public void AddUnitType(UnitType type) |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
136 { |
13 | 137 CacheUnitType(type); |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
138 unitTypes.Add(type.ID, type); |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
139 } |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
140 |
82 | 141 public UnitType[] GetUnitTypes(Category cat) |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
142 { |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
143 EnsureFullyLoaded(); |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
144 BuildUnitTypesByCategoryCache(); |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
145 Dictionary<string, UnitType> unitTypesDictionary; |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
146 unitTypesByCat.TryGetValue(cat, out unitTypesDictionary); |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
147 UnitType[] unitTypesArray; |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
148 |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
149 if (unitTypesDictionary == null) |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
150 { |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
151 unitTypesArray = new UnitType[0]; |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
152 } |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
153 else |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
154 { |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
155 unitTypesArray = DictionaryUtils.ToArray<string, UnitType>(unitTypesDictionary); |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
156 } |
82 | 157 |
158 return unitTypesArray; | |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
159 } |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
160 |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
161 private void CacheUnitType(UnitType unit) |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
162 { |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
163 BuildUnitTypesByCategoryCache(); |
82 | 164 Dictionary<string,UnitType> catUnitTypes; |
165 unitTypesByCat.TryGetValue(unit.MainCategory, out catUnitTypes); | |
166 | |
167 if (catUnitTypes == null) | |
168 { | |
169 throw new InvalidFileException(String.Format("Unit type {0} with name {1} is a unit of an undefined category", unit.ID, unit.Name)); | |
170 } | |
171 | |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
172 catUnitTypes.Add(unit.ID, unit); |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
173 } |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
174 |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
175 private void BuildUnitTypesByCategoryCache() |
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
176 { |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
177 if (unitTypesByCat == null) |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
178 { |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
179 DoBuildUnitTypesByCategoryCache(); |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
180 } |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
181 } |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
182 |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
183 private void DoBuildUnitTypesByCategoryCache() |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
184 { |
8
613bc5eaac59
Re #9 - Make WarFoundry loading granular
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
185 unitTypesByCat = new Dictionary<Category,Dictionary<string,UnitType>>(); |
0 | 186 |
82 | 187 foreach (Category category in Categories) |
188 { | |
189 unitTypesByCat.Add(category, new Dictionary<string, UnitType>()); | |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
190 } |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
191 |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
192 foreach (UnitType unit in unitTypes.Values) |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
193 { |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
194 CacheUnitType(unit); |
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
195 } |
82 | 196 } |
197 | |
198 public UnitType GetUnitType(string id) | |
11
5a1df00b0359
Re #9 - Make WarFoundry API load files in small methods
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
199 { |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
200 EnsureFullyLoaded(); |
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
201 return DictionaryUtils.GetValue(unitTypes, id); |
0 | 202 } |
203 | |
204 public List<Ability> GetAbilityList() | |
205 { | |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
206 EnsureFullyLoaded(); |
0 | 207 List<Ability> items = new List<Ability>(); |
55
9080366031c0
Re #9 - Refactor for small methods
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
208 items.AddRange(abilities.Values); |
0 | 209 return items; |
210 } | |
211 | |
47
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
212 public void AddAbility(Ability newAbility) |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
213 { |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
214 //TODO: Throw DuplicateItemException |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
215 abilities.Add(newAbility.ID, newAbility); |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
216 } |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
217 |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
218 [Obsolete("Use AddAbility method instead")] |
0 | 219 public void SetAbilities(Dictionary<string, Ability> newAbilities) |
220 { | |
47
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
221 foreach (Ability ability in newAbilities.Values) |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
222 { |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
223 AddAbility(ability); |
85f2b9c3609c
Re #13 - Use XPath for file loading
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
224 } |
0 | 225 } |
226 | |
227 public Ability GetAbility(string id) | |
228 { | |
118
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
229 EnsureFullyLoaded(); |
d39de20f2ba1
Re #54: Add army loading support
IBBoard <dev@ibboard.co.uk>
parents:
104
diff
changeset
|
230 return DictionaryUtils.GetValue(abilities, id); |
0 | 231 } |
82 | 232 |
0 | 233 protected virtual Dictionary<string, UnitType> RaceUnitTypes |
234 { | |
235 get { return RaceRawUnitTypes; } | |
236 set { RaceRawUnitTypes = value; } | |
237 } | |
82 | 238 |
0 | 239 protected virtual Dictionary<string, EquipmentItem> RaceEquipment |
240 { | |
241 get { return RaceRawEquipment; } | |
242 set { RaceRawEquipment = value; } | |
243 } | |
244 | |
245 protected virtual Dictionary<string, Ability> RaceAbilities | |
246 { | |
247 get { return RaceRawAbilities; } | |
248 set { RaceRawAbilities = value; } | |
249 } | |
82 | 250 |
0 | 251 protected Dictionary<string, UnitType> RaceRawUnitTypes |
252 { | |
253 get { return unitTypes; } | |
254 set { unitTypes = value; } | |
255 } | |
82 | 256 |
0 | 257 protected Dictionary<string, EquipmentItem> RaceRawEquipment |
258 { | |
259 get { return equipment; } | |
260 set { equipment = value; } | |
261 } | |
262 | |
263 protected Dictionary<string, Ability> RaceRawAbilities | |
264 { | |
265 get { return abilities; } | |
266 set { abilities = value; } | |
267 } | |
268 } | |
269 } |