diff --git a/OpenRA.Game/GameRules/ActorInfo.cs b/OpenRA.Game/GameRules/ActorInfo.cs index cac0cea4af..a951c6b8f5 100644 --- a/OpenRA.Game/GameRules/ActorInfo.cs +++ b/OpenRA.Game/GameRules/ActorInfo.cs @@ -98,7 +98,7 @@ namespace OpenRA throw new YamlException( "Bogus inheritance -- duplicate inheritance of {0}.".F(kv.Key)); - node = MiniYaml.MergeStrict(node, MergeWithParents(kv.Value, allUnits, allParents)); + node = MiniYaml.Merge(node, MergeWithParents(kv.Value, allUnits, allParents)); } return node; diff --git a/OpenRA.Game/GameRules/RulesetCache.cs b/OpenRA.Game/GameRules/RulesetCache.cs index f2c26e6506..ae57659ed4 100644 --- a/OpenRA.Game/GameRules/RulesetCache.cs +++ b/OpenRA.Game/GameRules/RulesetCache.cs @@ -101,7 +101,7 @@ namespace OpenRA var mergedNodes = files .Select(s => MiniYaml.FromFile(s)) - .Aggregate(nodes, MiniYaml.MergeLiberal); + .Aggregate(nodes, MiniYaml.MergePartial); Func, T> wrap = (wkv, wyy) => { diff --git a/OpenRA.Game/Graphics/ChromeProvider.cs b/OpenRA.Game/Graphics/ChromeProvider.cs index 74fa3bcf0b..d02ad988d9 100644 --- a/OpenRA.Game/Graphics/ChromeProvider.cs +++ b/OpenRA.Game/Graphics/ChromeProvider.cs @@ -33,7 +33,7 @@ namespace OpenRA.Graphics cachedSheets = new Dictionary(); cachedSprites = new Dictionary>(); - var chrome = chromeFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal); + var chrome = chromeFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergePartial); foreach (var c in chrome) LoadCollection(c.Key, c.Value); diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index d8665d01a2..e90fb1ee91 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -25,7 +25,7 @@ namespace OpenRA.Graphics public CursorProvider(ModData modData) { var sequenceFiles = modData.Manifest.Cursors; - var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); + var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergePartial)); var shadowIndex = new int[] { }; var nodesDict = sequences.ToDictionary(); diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs index 198f9ffbc5..f1f2cf20cf 100644 --- a/OpenRA.Game/Graphics/SequenceProvider.cs +++ b/OpenRA.Game/Graphics/SequenceProvider.cs @@ -129,7 +129,7 @@ namespace OpenRA.Graphics var nodes = sequenceFiles .Select(s => MiniYaml.FromFile(s)) - .Aggregate(sequenceNodes, MiniYaml.MergeLiberal); + .Aggregate(sequenceNodes, MiniYaml.MergePartial); var items = new Dictionary(); foreach (var n in nodes) diff --git a/OpenRA.Game/Graphics/VoxelProvider.cs b/OpenRA.Game/Graphics/VoxelProvider.cs index e7ad4b9066..90ab867f9c 100644 --- a/OpenRA.Game/Graphics/VoxelProvider.cs +++ b/OpenRA.Game/Graphics/VoxelProvider.cs @@ -25,7 +25,7 @@ namespace OpenRA.Graphics var sequences = voxelFiles .Select(s => MiniYaml.FromFile(s)) - .Aggregate(voxelNodes, MiniYaml.MergeLiberal); + .Aggregate(voxelNodes, MiniYaml.MergePartial); foreach (var s in sequences) LoadVoxelsForUnit(s.Key, s.Value); diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index 32b2a77203..bf465cfd79 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -262,12 +262,12 @@ namespace OpenRA return FromLines(text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries), fileName); } - public static List MergeStrict(List a, List b) + public static List Merge(List a, List b) { return Merge(a, b, false); } - public static List MergeLiberal(List a, List b) + public static List MergePartial(List a, List b) { return Merge(a, b, true); } @@ -327,12 +327,12 @@ namespace OpenRA return ret; } - public static MiniYaml MergeLiberal(MiniYaml a, MiniYaml b) + public static MiniYaml MergePartial(MiniYaml a, MiniYaml b) { return Merge(a, b, true); } - public static MiniYaml MergeStrict(MiniYaml a, MiniYaml b) + public static MiniYaml Merge(MiniYaml a, MiniYaml b) { return Merge(a, b, false); } diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 8d8da3e391..04128b4992 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -119,10 +119,10 @@ namespace OpenRA return; } - var yaml = Manifest.Translations.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal); + var yaml = Manifest.Translations.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergePartial); Languages = yaml.Select(t => t.Key).ToArray(); - yaml = MiniYaml.MergeLiberal(map.TranslationDefinitions, yaml); + yaml = MiniYaml.MergePartial(map.TranslationDefinitions, yaml); foreach (var y in yaml) { diff --git a/OpenRA.Game/Widgets/ChromeMetrics.cs b/OpenRA.Game/Widgets/ChromeMetrics.cs index 3296ffa8c0..fb7b848eb3 100644 --- a/OpenRA.Game/Widgets/ChromeMetrics.cs +++ b/OpenRA.Game/Widgets/ChromeMetrics.cs @@ -21,7 +21,7 @@ namespace OpenRA.Widgets { data = new Dictionary(); var metrics = yaml.Select(y => MiniYaml.FromFile(y)) - .Aggregate(MiniYaml.MergeLiberal); + .Aggregate(MiniYaml.MergePartial); foreach (var m in metrics) foreach (var n in m.Value.Nodes) diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 83693194a3..5594e01656 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Graphics if (nodes.TryGetValue("Defaults", out defaults)) { nodes.Remove("Defaults"); - nodes = nodes.ToDictionary(kv => kv.Key, kv => MiniYaml.MergeStrict(kv.Value, defaults)); + nodes = nodes.ToDictionary(kv => kv.Key, kv => MiniYaml.Merge(kv.Value, defaults)); // Merge 'Defaults' animation image value. An example follows. // diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 8688f9bb15..262afc462f 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -32,8 +32,8 @@ namespace OpenRA.Mods.Common.Lint this.emitError = emitError; var sequenceSource = map != null ? map.SequenceDefinitions : new List(); - sequenceDefinitions = MiniYaml.MergeLiberal(sequenceSource, - Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal)); + sequenceDefinitions = MiniYaml.MergePartial(sequenceSource, + Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergePartial)); var rules = map == null ? Game.ModData.DefaultRules : map.Rules; var factions = rules.Actors["world"].TraitInfos().Select(f => f.InternalName).ToArray(); diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckSequenceSprites.cs b/OpenRA.Mods.Common/UtilityCommands/CheckSequenceSprites.cs index 2d4d1593c9..c6607b6132 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckSequenceSprites.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckSequenceSprites.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var nodes = sequenceFiles .Select(s => MiniYaml.FromFile(s)) - .Aggregate(MiniYaml.MergeLiberal); + .Aggregate(MiniYaml.MergePartial); foreach (var n in nodes) Game.ModData.SpriteSequenceLoader.ParseSequences(Game.ModData, ts, sc, n); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index 9f25a5f7de..6c264500b6 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Add a group for each campaign if (Game.ModData.Manifest.Missions.Any()) { - var yaml = Game.ModData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal); + var yaml = Game.ModData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergePartial); foreach (var kv in yaml) { diff --git a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs index 7856c700b3..9efd87709b 100644 --- a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs +++ b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs @@ -73,9 +73,9 @@ Root2: // Merge order should not matter // Note: All the Merge* variants are different plumbing over the same - // internal logic. Testing only MergeStrict is sufficient. - TestMixedMerge(MiniYaml.MergeStrict(a, b).First().Value); - TestMixedMerge(MiniYaml.MergeStrict(b, a).First().Value); + // Internal logic. Testing only Merge is sufficient. + TestMixedMerge(MiniYaml.Merge(a, b).First().Value); + TestMixedMerge(MiniYaml.Merge(b, a).First().Value); } void TestMixedMerge(MiniYaml result)