diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 51494174c1..289d574928 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -184,7 +184,12 @@ namespace OpenRA.Traits public interface IWorldLoaded { void WorldLoaded(World w); } public interface ICreatePlayers { void CreatePlayers(World w); } - public interface IBot { void Activate(Player p); } + public interface IBotInfo { string Name { get; } } + public interface IBot + { + void Activate(Player p); + IBotInfo Info { get; } + } public interface IActivity { diff --git a/OpenRA.Mods.RA/CreateMPPlayers.cs b/OpenRA.Mods.RA/CreateMPPlayers.cs index 2ead882f7c..681becbbd4 100644 --- a/OpenRA.Mods.RA/CreateMPPlayers.cs +++ b/OpenRA.Mods.RA/CreateMPPlayers.cs @@ -59,10 +59,11 @@ namespace OpenRA.Mods.RA var player = new Player(w, w.Map.Players[slot.MapPlayer], playerIndex++); w.AddPlayer(player); - /* todo: only activate the bot option that's selected! */ + /* activate the bot option that's selected! */ if (Game.IsHost) - foreach (var bot in player.PlayerActor.TraitsImplementing()) - bot.Activate(player); + player.PlayerActor.TraitsImplementing() + .Single(b => b.Info.Name == slot.Bot) + .Activate(player); /* a bit of a hack */ player.IsBot = true; diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 8e94c88144..de375ce120 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -33,11 +33,6 @@ using XRandom = OpenRA.Thirdparty.Random; namespace OpenRA.Mods.RA { - interface IBotInfo - { - string Name { get; } - } - class HackyAIInfo : IBotInfo, ITraitInfo { [FieldLoader.Load] @@ -84,6 +79,7 @@ namespace OpenRA.Mods.RA BaseBuilder[] builders; World world { get { return p.PlayerActor.World; } } + IBotInfo IBot.Info { get { return this.Info; } } readonly HackyAIInfo Info; public HackyAI(HackyAIInfo Info) diff --git a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs index 6d35b6ff08..3abb275ef8 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs @@ -14,7 +14,7 @@ using System.Drawing; using System.Linq; using OpenRA.FileFormats; using OpenRA.Network; -using OpenRA.Graphics; +using OpenRA.Traits; using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Delegates