Implement IReadOnlyFileSystem on Map.
This commit is contained in:
@@ -107,7 +107,7 @@ namespace OpenRA
|
|||||||
MissionSelector = 4
|
MissionSelector = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Map
|
public class Map : IReadOnlyFileSystem
|
||||||
{
|
{
|
||||||
public const int SupportedMapFormat = 8;
|
public const int SupportedMapFormat = 8;
|
||||||
|
|
||||||
@@ -1174,5 +1174,26 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
return FindTilesInAnnulus(center, 0, maxRange, allowOutsideBounds);
|
return FindTilesInAnnulus(center, 0, maxRange, allowOutsideBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Placeholders for future implementation
|
||||||
|
Stream IReadOnlyFileSystem.Open(string filename)
|
||||||
|
{
|
||||||
|
return Game.ModData.DefaultFileSystem.Open(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IReadOnlyFileSystem.TryGetPackageContaining(string path, out IReadOnlyPackage package, out string filename)
|
||||||
|
{
|
||||||
|
return Game.ModData.DefaultFileSystem.TryGetPackageContaining(path, out package, out filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IReadOnlyFileSystem.TryOpen(string filename, out Stream s)
|
||||||
|
{
|
||||||
|
return Game.ModData.DefaultFileSystem.TryOpen(filename, out s);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IReadOnlyFileSystem.Exists(string filename)
|
||||||
|
{
|
||||||
|
return Game.ModData.DefaultFileSystem.Exists(filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,12 +164,11 @@ namespace OpenRA
|
|||||||
|
|
||||||
// Operate on a copy of the map to avoid gameplay state leaking into the cache
|
// 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(MapCache[uid].Path);
|
||||||
var fileSystem = DefaultFileSystem;
|
|
||||||
|
|
||||||
LoadTranslations(map);
|
LoadTranslations(map);
|
||||||
|
|
||||||
// Reinitialize all our assets
|
// Reinitialize all our assets
|
||||||
InitializeLoaders(fileSystem);
|
InitializeLoaders(map);
|
||||||
ModFiles.LoadFromManifest(Manifest);
|
ModFiles.LoadFromManifest(Manifest);
|
||||||
|
|
||||||
// Mount map package so custom assets can be used.
|
// Mount map package so custom assets can be used.
|
||||||
@@ -183,9 +182,9 @@ namespace OpenRA
|
|||||||
// Load music with map assets mounted
|
// Load music with map assets mounted
|
||||||
using (new Support.PerfTimer("Map.Music"))
|
using (new Support.PerfTimer("Map.Music"))
|
||||||
foreach (var entry in map.Rules.Music)
|
foreach (var entry in map.Rules.Music)
|
||||||
entry.Value.Load(fileSystem);
|
entry.Value.Load(map);
|
||||||
|
|
||||||
VoxelProvider.Initialize(VoxelLoader, fileSystem, Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
|
VoxelProvider.Initialize(VoxelLoader, map, Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
|
||||||
VoxelLoader.Finish();
|
VoxelLoader.Finish();
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
|
|||||||
Reference in New Issue
Block a user