git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1133 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -46,6 +46,12 @@ namespace OpenRa.TechTreeTest
|
|||||||
|
|
||||||
public bool ShouldMakeBuildable(IEnumerable<string> buildings)
|
public bool ShouldMakeBuildable(IEnumerable<string> buildings)
|
||||||
{
|
{
|
||||||
|
if (techLevel > 10 || techLevel < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (prerequisites.Length == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
List<string> p = new List<string>(prerequisites);
|
List<string> p = new List<string>(prerequisites);
|
||||||
foreach (string b in buildings)
|
foreach (string b in buildings)
|
||||||
p.Remove(b);
|
p.Remove(b);
|
||||||
@@ -55,6 +61,9 @@ namespace OpenRa.TechTreeTest
|
|||||||
|
|
||||||
public bool ShouldMakeUnbuildable(IEnumerable<string> buildings)
|
public bool ShouldMakeUnbuildable(IEnumerable<string> buildings)
|
||||||
{
|
{
|
||||||
|
if (prerequisites.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
List<string> p = new List<string>(prerequisites);
|
List<string> p = new List<string>(prerequisites);
|
||||||
foreach (string b in buildings)
|
foreach (string b in buildings)
|
||||||
p.Remove(b);
|
p.Remove(b);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRa.TechTreeTest
|
|||||||
IniSection section = rulesFile.GetSection(key);
|
IniSection section = rulesFile.GetSection(key);
|
||||||
Building b = buildings[key];
|
Building b = buildings[key];
|
||||||
string s = section.GetValue("Prerequisite", "").ToUpper();
|
string s = section.GetValue("Prerequisite", "").ToUpper();
|
||||||
b.Prerequisites = s.Split(',');
|
b.Prerequisites = s.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
b.TechLevel = int.Parse(section.GetValue("TechLevel", "-1"));
|
b.TechLevel = int.Parse(section.GetValue("TechLevel", "-1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user