From 821e09877d4590327f08978508b20f8e97c7ef68 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Fri, 28 Aug 2015 02:13:49 +0300 Subject: [PATCH] Remove an assumption from FieldLoader.TryGetValueFromYaml() about the current value not having subnodes. FieldLoader assumed the YAML that is being loaded is a simple value with no subnodes and threw an exception otherwise. This explicitly excluded the possibility of trying to load a Dictionary or another more complex object. --- OpenRA.Game/FieldLoader.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 66c868730e..72d9e778e3 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -110,13 +110,8 @@ namespace OpenRA if (!md.TryGetValue(yamlName, out yaml)) return false; - if (yaml.Nodes.Count == 0) - { - ret = GetValue(field.Name, field.FieldType, yaml.Value, field); - return true; - } - - throw new InvalidOperationException("TryGetValueFromYaml: unable to load field {0} (of type {1})".F(yamlName, field.FieldType)); + ret = GetValue(field.Name, field.FieldType, yaml, field); + return true; } public static T Load(MiniYaml y) where T : new()