Rewrite yaml merger.

This commit is contained in:
Paul Chote
2016-01-30 03:04:34 +00:00
parent 1581ba951f
commit ab921682c4
15 changed files with 253 additions and 305 deletions

View File

@@ -33,12 +33,7 @@ namespace OpenRA.Graphics
cachedSheets = new Dictionary<string, Sheet>();
cachedSprites = new Dictionary<string, Dictionary<string, Sprite>>();
var partial = chromeFiles
.Select(s => MiniYaml.FromFile(s))
.Aggregate(MiniYaml.MergePartial);
var chrome = MiniYaml.ApplyRemovals(partial);
var chrome = MiniYaml.Merge(chromeFiles.Select(MiniYaml.FromFile));
foreach (var c in chrome)
LoadCollection(c.Key, c.Value);
}

View File

@@ -21,12 +21,8 @@ namespace OpenRA.Graphics
public CursorProvider(ModData modData)
{
var sequenceFiles = modData.Manifest.Cursors;
var partial = sequenceFiles
.Select(s => MiniYaml.FromFile(s))
.Aggregate(MiniYaml.MergePartial);
var sequences = new MiniYaml(null, MiniYaml.Merge(modData.Manifest.Cursors.Select(MiniYaml.FromFile)));
var sequences = new MiniYaml(null, MiniYaml.ApplyRemovals(partial));
var shadowIndex = new int[] { };
var nodesDict = sequences.ToDictionary();

View File

@@ -123,13 +123,7 @@ namespace OpenRA.Graphics
Sequences Load(List<MiniYamlNode> sequenceNodes)
{
var sequenceFiles = modData.Manifest.Sequences;
var partial = sequenceFiles
.Select(s => MiniYaml.FromFile(s))
.Aggregate(sequenceNodes, MiniYaml.MergePartial);
var nodes = MiniYaml.ApplyRemovals(partial);
var nodes = MiniYaml.Merge(modData.Manifest.Sequences.Select(MiniYaml.FromFile).Append(sequenceNodes));
var items = new Dictionary<string, UnitSequences>();
foreach (var n in nodes)
{

View File

@@ -23,11 +23,7 @@ namespace OpenRA.Graphics
{
units = new Dictionary<string, Dictionary<string, Voxel>>();
var partial = voxelFiles
.Select(s => MiniYaml.FromFile(s))
.Aggregate(voxelNodes, MiniYaml.MergePartial);
var sequences = MiniYaml.ApplyRemovals(partial);
var sequences = MiniYaml.Merge(voxelFiles.Select(MiniYaml.FromFile));
foreach (var s in sequences)
LoadVoxelsForUnit(s.Key, s.Value);