Skip to content

Commit fa86118

Browse files
committed
Fix Government definition parsing
1 parent b0cfb25 commit fa86118

1 file changed

Lines changed: 30 additions & 25 deletions

File tree

DataDefinitions/Government.cs

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ static Government()
1212
resourceManager.IgnoreCase = true;
1313
missingEDNameHandler = (edname) => new Government(edname);
1414

15-
None = new Government("$government_None;");
16-
Anarchy = new Government("$government_Anarchy;");
17-
Carrier = new Government( "$government_Carrier;" );
18-
Colony = new Government("$government_Colony;");
19-
Communism = new Government("$government_Communism;");
20-
Confederacy = new Government("$government_Confederacy;");
21-
Construction = new Government("$government_Megaconstruction;");
22-
Cooperative = new Government("$government_Cooperative;");
23-
Corporate = new Government("$government_Corporate;");
24-
Democracy = new Government("$government_Democracy;");
25-
Dictatorship = new Government("$government_Dictatorship;");
26-
Feudal = new Government("$government_Feudal;");
27-
Imperial = new Government("$government_Imperial;"); // Might not exist? I've never encountered this one.
28-
Patronage = new Government("$government_Patronage;");
29-
Prison = new Government("$government_Prison;");
30-
PrisonColony = new Government("$government_PrisonColony;");
31-
Theocracy = new Government("$government_Theocracy;");
32-
Workshop = new Government("$government_Workshop;");
33-
Engineer = new Government("$government_engineer;");
15+
None = new Government("None");
16+
Anarchy = new Government("Anarchy");
17+
Carrier = new Government( "Carrier" );
18+
Colony = new Government("Colony");
19+
Communism = new Government("Communism");
20+
Confederacy = new Government("Confederacy");
21+
Construction = new Government("Megaconstruction");
22+
Cooperative = new Government("Cooperative");
23+
Corporate = new Government("Corporate");
24+
Democracy = new Government("Democracy");
25+
Dictatorship = new Government("Dictatorship");
26+
Feudal = new Government("Feudal");
27+
Imperial = new Government("Imperial"); // Might not exist? I've never encountered this one.
28+
Patronage = new Government("Patronage");
29+
Prison = new Government("Prison");
30+
PrisonColony = new Government("PrisonColony");
31+
Theocracy = new Government("Theocracy");
32+
Workshop = new Government("Workshop");
33+
Engineer = new Government("engineer");
3434
}
3535

3636
public static readonly Government None;
@@ -57,19 +57,24 @@ static Government()
5757
public Government () : this("")
5858
{ }
5959

60-
private Government(string edname) : base(edname, edname.Replace("$government_", "").Replace(";", ""))
60+
private Government(string edname) : base(edname, edname)
6161
{ }
6262

63+
new public static Government FromEDName ( string from )
64+
{
65+
if ( from is null ) { return None; }
66+
67+
var tidiedFrom = from.Replace("$government_", "").Replace(";", "");
68+
return ResourceBasedLocalizedEDName<Government>.FromEDName( tidiedFrom );
69+
}
70+
6371
new public static Government FromName(string from)
6472
{
65-
if (from is null)
66-
{
67-
return None;
68-
}
73+
if (from is null) { return None; }
6974

7075
// EDSM uses a special string to describe engineering workshops, standardize here.
7176
from = from.Replace("Workshop (Engineer)", "engineer");
72-
return ResourceBasedLocalizedEDName<Government>.FromName(from);
77+
return ResourceBasedLocalizedEDName<Government>.FromName( from );
7378
}
7479
}
7580
}

0 commit comments

Comments
 (0)