Fixed special owner cases
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1136 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -10,6 +10,7 @@ namespace OpenRa.TechTreeTest
|
||||
[Flags]
|
||||
public enum BuildingRace
|
||||
{
|
||||
None = 0,
|
||||
Allies = 1,
|
||||
Soviet = 2
|
||||
}
|
||||
|
||||
@@ -31,17 +31,25 @@ namespace OpenRa.TechTreeTest
|
||||
string s = section.GetValue("Prerequisite", "").ToUpper();
|
||||
b.Prerequisites = s.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
b.TechLevel = int.Parse(section.GetValue("TechLevel", "-1"));
|
||||
s = section.GetValue("Owner", "allies");
|
||||
if (string.IsNullOrEmpty(s)) continue;
|
||||
string[] frags = s.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (frags.Length > 1)
|
||||
s = section.GetValue("Owner", "");
|
||||
|
||||
if (string.IsNullOrEmpty(s))
|
||||
{
|
||||
b.Owner = BuildingRace.None;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s.Equals("Both", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
b.Owner = BuildingRace.Allies | BuildingRace.Soviet;
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] frags = s.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (frags.Length > 1)
|
||||
b.Owner = BuildingRace.Allies | BuildingRace.Soviet;
|
||||
else
|
||||
{
|
||||
b.Owner = (BuildingRace)Enum.Parse(typeof(BuildingRace), frags[0], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user