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:
@@ -68,10 +68,9 @@ namespace OpenRA.Mods.RA.AI
|
||||
|
||||
static object LoadList<T>(MiniYaml y, string field)
|
||||
{
|
||||
return y.NodesDict.ContainsKey(field)
|
||||
? y.NodesDict[field].NodesDict.ToDictionary(
|
||||
a => a.Key,
|
||||
a => FieldLoader.GetValue<T>(field, a.Value.Value))
|
||||
var nd = y.ToDictionary();
|
||||
return nd.ContainsKey(field)
|
||||
? nd[field].ToDictionary(my => FieldLoader.GetValue<T>(field, my.Value))
|
||||
: new Dictionary<string, T>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user