From 4b22436d14b92c4eb559d29706c7f5addac2ba3d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 20 Apr 2015 04:54:38 +1200 Subject: [PATCH] Fix a regression from #7987. --- OpenRA.Game/Player.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index edec9601c9..05a105bc6a 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -71,6 +71,14 @@ namespace OpenRA return selected; } + CountryInfo ChooseDisplayCountry(World world, string race) + { + var countries = world.Map.Rules.Actors["world"].Traits + .WithInterface(); + + return countries.FirstOrDefault(c => c.Race == race) ?? countries.First(); + } + public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr) { World = world; @@ -86,8 +94,7 @@ namespace OpenRA PlayerName = client.Name; botType = client.Bot; Country = ChooseCountry(world, client.Race, !pr.LockRace); - DisplayCountry = world.Map.Rules.Actors["world"].Traits - .WithInterface().First(c => c.Race == client.Race); + DisplayCountry = ChooseDisplayCountry(world, client.Race); } else { @@ -100,8 +107,7 @@ namespace OpenRA Spectating = pr.Spectating; botType = pr.Bot; Country = ChooseCountry(world, pr.Race, false); - DisplayCountry = world.Map.Rules.Actors["world"].Traits - .WithInterface().First(c => c.Race == pr.Race); + DisplayCountry = ChooseDisplayCountry(world, pr.Race); } PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });