clean up ModData package mounting
This commit is contained in:
@@ -29,7 +29,6 @@ namespace OpenRA
|
|||||||
public SheetBuilder SheetBuilder;
|
public SheetBuilder SheetBuilder;
|
||||||
public SpriteLoader SpriteLoader;
|
public SpriteLoader SpriteLoader;
|
||||||
public HardwarePalette Palette { get; private set; }
|
public HardwarePalette Palette { get; private set; }
|
||||||
IFolder previousMapMount = null;
|
|
||||||
|
|
||||||
public ModData( params string[] mods )
|
public ModData( params string[] mods )
|
||||||
{
|
{
|
||||||
@@ -40,21 +39,18 @@ namespace OpenRA
|
|||||||
LoadScreen.Display();
|
LoadScreen.Display();
|
||||||
WidgetLoader = new WidgetLoader( this );
|
WidgetLoader = new WidgetLoader( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadMaps()
|
|
||||||
{
|
|
||||||
AvailableMaps = FindMaps( Manifest.Mods );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadInitialAssets()
|
public void LoadInitialAssets()
|
||||||
{
|
{
|
||||||
// all this manipulation of static crap here is nasty and breaks
|
// all this manipulation of static crap here is nasty and breaks
|
||||||
// horribly when you use ModData in unexpected ways.
|
// horribly when you use ModData in unexpected ways.
|
||||||
|
|
||||||
FileSystem.UnmountAll();
|
FileSystem.UnmountAll();
|
||||||
foreach (var dir in Manifest.Folders)
|
foreach (var dir in Manifest.Folders)
|
||||||
FileSystem.Mount(dir);
|
FileSystem.Mount(dir);
|
||||||
|
|
||||||
ReloadMaps();
|
AvailableMaps = FindMaps(Manifest.Mods);
|
||||||
|
|
||||||
Palette = new HardwarePalette();
|
Palette = new HardwarePalette();
|
||||||
ChromeMetrics.Initialize(Manifest.ChromeMetrics);
|
ChromeMetrics.Initialize(Manifest.ChromeMetrics);
|
||||||
ChromeProvider.Initialize(Manifest.Chrome);
|
ChromeProvider.Initialize(Manifest.Chrome);
|
||||||
@@ -70,17 +66,14 @@ namespace OpenRA
|
|||||||
if (!AvailableMaps.ContainsKey(uid))
|
if (!AvailableMaps.ContainsKey(uid))
|
||||||
throw new InvalidDataException("Invalid map uid: {0}".F(uid));
|
throw new InvalidDataException("Invalid map uid: {0}".F(uid));
|
||||||
var map = new Map(AvailableMaps[uid].Path);
|
var map = new Map(AvailableMaps[uid].Path);
|
||||||
|
|
||||||
// Maps may contain custom assets
|
|
||||||
// TODO: why are they lowest priority? they should be highest.
|
|
||||||
if (previousMapMount != null) FileSystem.Unmount(previousMapMount);
|
|
||||||
previousMapMount = FileSystem.OpenPackage(map.Path, int.MaxValue);
|
|
||||||
FileSystem.Mount(previousMapMount);
|
|
||||||
|
|
||||||
// Reinit all our assets
|
// Reinit all our assets
|
||||||
LoadInitialAssets();
|
LoadInitialAssets();
|
||||||
foreach (var pkg in Manifest.Packages)
|
foreach (var pkg in Manifest.Packages)
|
||||||
FileSystem.Mount(pkg);
|
FileSystem.Mount(pkg);
|
||||||
|
|
||||||
|
// Mount map package so custom assets can be used. TODO: check priority.
|
||||||
|
FileSystem.Mount(FileSystem.OpenPackage(map.Path, int.MaxValue));
|
||||||
|
|
||||||
Rules.LoadRules(Manifest, map);
|
Rules.LoadRules(Manifest, map);
|
||||||
SpriteLoader = new SpriteLoader( Rules.TileSets[map.Tileset].Extensions, SheetBuilder );
|
SpriteLoader = new SpriteLoader( Rules.TileSets[map.Tileset].Extensions, SheetBuilder );
|
||||||
|
|||||||
Reference in New Issue
Block a user