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.
This commit is contained in:
Pavel Penev
2015-08-28 02:13:49 +03:00
parent 0f9ef4036e
commit 821e09877d

View File

@@ -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<T>(MiniYaml y) where T : new()