Fix a regression from #7987.

This commit is contained in:
Paul Chote
2015-04-20 04:54:38 +12:00
parent 322801247f
commit 4b22436d14

View File

@@ -71,6 +71,14 @@ namespace OpenRA
return selected; return selected;
} }
CountryInfo ChooseDisplayCountry(World world, string race)
{
var countries = world.Map.Rules.Actors["world"].Traits
.WithInterface<CountryInfo>();
return countries.FirstOrDefault(c => c.Race == race) ?? countries.First();
}
public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr) public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr)
{ {
World = world; World = world;
@@ -86,8 +94,7 @@ namespace OpenRA
PlayerName = client.Name; PlayerName = client.Name;
botType = client.Bot; botType = client.Bot;
Country = ChooseCountry(world, client.Race, !pr.LockRace); Country = ChooseCountry(world, client.Race, !pr.LockRace);
DisplayCountry = world.Map.Rules.Actors["world"].Traits DisplayCountry = ChooseDisplayCountry(world, client.Race);
.WithInterface<CountryInfo>().First(c => c.Race == client.Race);
} }
else else
{ {
@@ -100,8 +107,7 @@ namespace OpenRA
Spectating = pr.Spectating; Spectating = pr.Spectating;
botType = pr.Bot; botType = pr.Bot;
Country = ChooseCountry(world, pr.Race, false); Country = ChooseCountry(world, pr.Race, false);
DisplayCountry = world.Map.Rules.Actors["world"].Traits DisplayCountry = ChooseDisplayCountry(world, pr.Race);
.WithInterface<CountryInfo>().First(c => c.Race == pr.Race);
} }
PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) }); PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });