diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index 4e8f2085ee..7231d8cbd6 100644 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -49,8 +49,9 @@ namespace OpenRA.Widgets return true; } - public int2 ConvertToPreview(Map map, int2 point) + public int2 ConvertToPreview(int2 point) { + var map = Map(); return new int2(MapRect.X + (int)(PreviewScale*(point.X - map.Bounds.Left)) , MapRect.Y + (int)(PreviewScale*(point.Y - map.Bounds.Top))); } @@ -94,7 +95,7 @@ namespace OpenRA.Widgets foreach (var p in map.GetSpawnPoints()) { var owned = colors.ContainsKey(p); - var pos = ConvertToPreview(map, p); + var pos = ConvertToPreview(p); var sprite = ChromeProvider.GetImage("spawnpoints", owned ? "owned" : "unowned"); var offset = new int2(-sprite.bounds.Width/2, -sprite.bounds.Height/2); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index dc72414ac2..423a0ed442 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -123,7 +123,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic return; var p = Map.GetSpawnPoints() - .Select((sp, i) => Pair.New(mapPreview.ConvertToPreview(Map, sp), i)) + .Select((sp, i) => Pair.New(mapPreview.ConvertToPreview(sp), i)) .Where(a => (a.First - mi.Location).LengthSquared < 64) .Select(a => a.Second + 1) .FirstOrDefault(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 4c1df9a6fb..562df64386 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic return; var selectedSpawn = Map.GetSpawnPoints() - .Select((sp, i) => Pair.New(mapPreview.ConvertToPreview(Map, sp), i)) + .Select((sp, i) => Pair.New(mapPreview.ConvertToPreview(sp), i)) .Where(a => (a.First - mi.Location).LengthSquared < 64) .Select(a => a.Second + 1) .FirstOrDefault();