From 2be8cedddf8f92992042cd88587fce4d9cfa64cc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 23 Jan 2017 20:22:46 +0000 Subject: [PATCH 1/2] Add StringComparison arguments to StartsWith. --- OpenRA.Game/MiniYaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index c34b876ac3..6f92c48a4a 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -302,7 +302,7 @@ namespace OpenRA foreach (var n in node.Nodes) { - if (n.Key == "Inherits" || n.Key.StartsWith("Inherits@")) + if (n.Key == "Inherits" || n.Key.StartsWith("Inherits@", StringComparison.Ordinal)) { MiniYaml parent; if (!tree.TryGetValue(n.Value.Value, out parent)) @@ -317,7 +317,7 @@ namespace OpenRA foreach (var r in ResolveInherits(n.Key, parent, tree, inherited)) MergeIntoResolved(r, resolved, tree, inherited); } - else if (n.Key.StartsWith("-")) + else if (n.Key.StartsWith("-", StringComparison.Ordinal)) { var removed = n.Key.Substring(1); if (resolved.RemoveAll(r => r.Key == removed) == 0) From b803034cefc19be7af5411e67325544655930626 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 24 Jan 2017 22:15:34 +0000 Subject: [PATCH 2/2] Resolve yaml removals in weapon definitions. --- OpenRA.Game/GameRules/WeaponInfo.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index c32bf92569..c5a8fd46f3 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -68,6 +68,9 @@ namespace OpenRA.GameRules public WeaponInfo(string name, MiniYaml content) { + // Resolve any weapon-level yaml inheritance or removals + // HACK: The "Defaults" sequence syntax prevents us from doing this generally during yaml parsing + content.Nodes = MiniYaml.Merge(new[] { content.Nodes }); FieldLoader.Load(this, content); }