Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate MapLocations from LoadMaps. #14075

Merged
merged 1 commit into from Sep 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions OpenRA.Game/Map/MapCache.cs
Expand Up @@ -28,6 +28,7 @@ public sealed class MapCache : IEnumerable<MapPreview>, IDisposable
{
public static readonly MapPreview UnknownMap = new MapPreview(null, null, MapGridType.Rectangular, null);
public readonly IReadOnlyDictionary<IReadOnlyPackage, MapClassification> MapLocations;
readonly Dictionary<IReadOnlyPackage, MapClassification> mapLocations = new Dictionary<IReadOnlyPackage, MapClassification>();

readonly Cache<string, MapPreview> previews;
readonly ModData modData;
Expand All @@ -45,8 +46,16 @@ public MapCache(ModData modData)
previews = new Cache<string, MapPreview>(uid => new MapPreview(modData, uid, gridType.Value, this));
sheetBuilder = new SheetBuilder(SheetType.BGRA);

MapLocations = new ReadOnlyDictionary<IReadOnlyPackage, MapClassification>(mapLocations);
}

public void LoadMaps()
{
// Utility mod that does not support maps
if (!modData.Manifest.Contains<MapGrid>())
return;

// Enumerate map directories
var mapLocations = new Dictionary<IReadOnlyPackage, MapClassification>();
foreach (var kv in modData.Manifest.MapFolders)
{
var name = kv.Key;
Expand Down Expand Up @@ -82,15 +91,6 @@ public MapCache(ModData modData)
mapLocations.Add(package, classification);
}

MapLocations = new ReadOnlyDictionary<IReadOnlyPackage, MapClassification>(mapLocations);
}

public void LoadMaps()
{
// Utility mod that does not support maps
if (!modData.Manifest.Contains<MapGrid>())
return;

var mapGrid = modData.Manifest.Get<MapGrid>();
foreach (var kv in MapLocations)
{
Expand Down