diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 5e29730e79..4df143e0b8 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -47,12 +47,13 @@ namespace OpenRA public readonly bool Playable = true; public readonly int ClientIndex; public readonly PlayerReference PlayerReference; + public readonly bool IsBot; + public readonly string BotType; /// The faction (including Random, etc) that was selected in the lobby. public readonly FactionInfo DisplayFaction; public WinState WinState = WinState.Undefined; - public bool IsBot; public int SpawnPoint; public bool HasObjectives = false; public bool Spectating; @@ -94,8 +95,6 @@ namespace OpenRA public Player(World world, Session.Client client, PlayerReference pr) { - string botType; - World = world; InternalName = pr.Name; PlayerReference = pr; @@ -113,7 +112,7 @@ namespace OpenRA else PlayerName = client.Name; - botType = client.Bot; + BotType = client.Bot; Faction = ChooseFaction(world, client.Faction, !pr.LockFaction); DisplayFaction = ChooseDisplayFaction(world, client.Faction); } @@ -126,7 +125,7 @@ namespace OpenRA NonCombatant = pr.NonCombatant; Playable = pr.Playable; Spectating = pr.Spectating; - botType = pr.Bot; + BotType = pr.Bot; Faction = ChooseFaction(world, pr.Faction, false); DisplayFaction = ChooseDisplayFaction(world, pr.Faction); } @@ -137,12 +136,12 @@ namespace OpenRA fogVisibilities = PlayerActor.TraitsImplementing().ToArray(); // Enable the bot logic on the host - IsBot = botType != null; + IsBot = BotType != null; if (IsBot && Game.IsHost) { - var logic = PlayerActor.TraitsImplementing().FirstOrDefault(b => b.Info.Name == botType); + var logic = PlayerActor.TraitsImplementing().FirstOrDefault(b => b.Info.Name == BotType); if (logic == null) - Log.Write("debug", "Invalid bot type: {0}", botType); + Log.Write("debug", "Invalid bot type: {0}", BotType); else logic.Activate(this); }