diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index ad4a84b7c3..8b9846a5b4 100755 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -22,6 +22,30 @@ namespace OpenRA.Widgets { lastMap = (other as MapPreviewWidget).lastMap; } + + public override bool HandleInput(MouseInput mi) + { + var points = Game.chrome.currentMap.Waypoints + .Select((sp, i) => Pair.New(sp, Game.LobbyInfo.Clients.FirstOrDefault( + c => c.SpawnPoint == i + 1))) + .ToList(); + + var container = new Rectangle(DrawPosition().X, DrawPosition().Y, Parent.Bounds.Width, Parent.Bounds.Height ); + + foreach(var p in points) + { + var pos = Game.chrome.currentMap.ConvertToPreview(p.First.Value, container); + + //todo: check within bounds + if (mi.Location.Equals(pos) && p.Second == null) + { + Game.LobbyInfo.Clients[Game.LocalClient.Index].SpawnPoint = + Game.chrome.currentMap.Waypoints.Keys.ToList().IndexOf(p.First.Value) + 1; + return true; + } + } + return false; + } public override Widget Clone() { return new MapPreviewWidget(this); }