diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index da0eace73c..bd6e01b0ff 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -174,7 +174,8 @@ namespace OpenRA if (bitmap == null) { createdPreview = true; - bitmap = Minimap.RenderMapPreview(modData.DefaultRules.TileSets[p.Map.Tileset], p.Map, modData.DefaultRules, true); + var map = new Map(p.Path); + bitmap = Minimap.RenderMapPreview(modData.DefaultRules.TileSets[map.Tileset], map, modData.DefaultRules, true); } Game.RunAfterTick(() => diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 363ee31180..11b0908e3a 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -67,7 +67,6 @@ namespace OpenRA public MapGridType GridType { get; private set; } public Rectangle Bounds { get; private set; } public Bitmap CustomPreview { get; private set; } - public Map Map { get; private set; } public MapStatus Status { get; private set; } public MapClassification Class { get; private set; } public MapVisibility Visibility { get; private set; } @@ -117,7 +116,6 @@ namespace OpenRA public void UpdateFromMap(Map m, MapClassification classification) { - Map = m; Path = m.Path; Title = m.Title; Type = m.Type; diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 12c695b705..21581d2c40 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -926,7 +926,7 @@ namespace OpenRA.Mods.Common.Server static void LoadMap(S server) { - server.Map = server.ModData.MapCache[server.LobbyInfo.GlobalSettings.Map].Map; + server.Map = new Map(server.ModData.MapCache[server.LobbyInfo.GlobalSettings.Map].Path); server.MapPlayers = new MapPlayers(server.Map.PlayerDefinitions); server.LobbyInfo.Slots = server.MapPlayers.Players diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs index 57aa5497a5..e00e712621 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Game.ModData.MapCache.LoadMaps(); maps.AddRange(Game.ModData.MapCache .Where(m => m.Status == MapStatus.Available) - .Select(m => m.Map)); + .Select(m => new Map(m.Path))); } else maps.Add(new Map(args[1])); diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeModCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeModCommand.cs index 99cab44484..1b35b63570 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeModCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeModCommand.cs @@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine("Processing Maps:"); var maps = Game.ModData.MapCache .Where(m => m.Status == MapStatus.Available) - .Select(m => m.Map); + .Select(m => new Map(m.Path)); foreach (var map in maps) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index 3b50f68acd..34a19ea172 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var maps = modData.MapCache .Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(Path.GetFullPath(p.Path))) - .Select(p => p.Map) + .Select(p => new Map(p.Path)) .OrderBy(m => missionMapPaths.IndexOf(Path.GetFullPath(m.Path))); CreateMissionGroup(kv.Key, maps); @@ -115,8 +115,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Add an additional group for loose missions var looseMissions = modData.MapCache - .Where(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector) && !allMaps.Contains(p.Map)) - .Select(p => p.Map); + .Where(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector) && !allMaps.Any(m => m.Uid == p.Uid)) + .Select(p => new Map(p.Path)); if (looseMissions.Any()) {