Store map packages in MapPreview.
This commit is contained in:
@@ -60,11 +60,9 @@ namespace OpenRA
|
||||
{
|
||||
using (new Support.PerfTimer(path.Key))
|
||||
{
|
||||
using (var package = modData.ModFiles.OpenPackage(path.Key))
|
||||
{
|
||||
var uid = Map.ComputeUID(package);
|
||||
previews[uid].UpdateFromMap(package, path.Value, modData.Manifest.MapCompatibility, mapGrid.Type);
|
||||
}
|
||||
var package = modData.ModFiles.OpenPackage(path.Key);
|
||||
var uid = Map.ComputeUID(package);
|
||||
previews[uid].UpdateFromMap(package, path.Value, modData.Manifest.MapCompatibility, mapGrid.Type);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -189,7 +187,7 @@ namespace OpenRA
|
||||
if (bitmap == null)
|
||||
{
|
||||
createdPreview = true;
|
||||
var map = new Map(p.Path);
|
||||
var map = new Map(modData, p.Package);
|
||||
bitmap = Minimap.RenderMapPreview(modData.DefaultRules.TileSets[map.Tileset], map, modData.DefaultRules, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA
|
||||
MapCache cache;
|
||||
|
||||
public readonly string Uid;
|
||||
public string Path { get; private set; }
|
||||
public IReadOnlyPackage Package { get; private set; }
|
||||
|
||||
public string Title { get; private set; }
|
||||
public string Type { get; private set; }
|
||||
@@ -126,7 +126,7 @@ namespace OpenRA
|
||||
yaml = new MiniYaml(null, MiniYaml.FromStream(yamlStream, "map.yaml")).ToDictionary();
|
||||
}
|
||||
|
||||
Path = p.Name;
|
||||
Package = p;
|
||||
GridType = gridType;
|
||||
Class = classification;
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace OpenRA
|
||||
throw new InvalidDataException("Invalid map uid: {0}".F(uid));
|
||||
|
||||
// Operate on a copy of the map to avoid gameplay state leaking into the cache
|
||||
var map = new Map(MapCache[uid].Path);
|
||||
var map = new Map(this, MapCache[uid].Package);
|
||||
|
||||
LoadTranslations(map);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user