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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user