Changed MiniYaml.NodesDict property into a method.
Method is now called ToDictionary. - Cached a few invocations into locals which should prevent some redundant evaluation. - Added ToDictionary overloads that take projection functions for the keys and elements, since several callsites were doing a subsequent Linq.ToDictionary call to get this.
This commit is contained in:
@@ -28,10 +28,9 @@ namespace OpenRA.GameRules
|
||||
|
||||
static Dictionary<string, string[]> Load(MiniYaml y, string name)
|
||||
{
|
||||
return y.NodesDict.ContainsKey(name)
|
||||
? y.NodesDict[name].NodesDict.ToDictionary(
|
||||
a => a.Key,
|
||||
a => FieldLoader.GetValue<string[]>("(value)", a.Value.Value))
|
||||
var nd = y.ToDictionary();
|
||||
return nd.ContainsKey(name)
|
||||
? nd[name].ToDictionary(my => FieldLoader.GetValue<string[]>("(value)", my.Value))
|
||||
: new Dictionary<string, string[]>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user