git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1930 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2008-03-13 05:24:42 +00:00
parent f06bac7134
commit 9dc6383a6c
5 changed files with 20 additions and 12 deletions

View File

@@ -9,6 +9,9 @@ namespace OpenRa.TechTree
{
public class TechTree
{
static IniFile rules;
static IniFile Rules { get { return rules ?? (rules = new IniFile(FileSystem.Open("rules.ini"))); } }
Dictionary<string, Item> objects = new Dictionary<string, Item>();
public ICollection<string> built = new List<string>();
@@ -54,13 +57,12 @@ namespace OpenRa.TechTree
void LoadRules()
{
IniFile rulesFile = new IniFile(FileSystem.Open("rules.ini"));
IEnumerable<Tuple<string, string, bool>> definitions = Concat(
Lines("buildings.txt", true),
Lines("units.txt", false));
foreach (Tuple<string, string, bool> p in definitions)
objects.Add(p.a, new Item(p.a, p.b, rulesFile.GetSection(p.a), p.c));
objects.Add(p.a, new Item(p.a, p.b, Rules.GetSection(p.a), p.c));
}
public bool Build(string key, bool force)