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:
@@ -33,7 +33,7 @@ namespace OpenRA
|
||||
{
|
||||
try
|
||||
{
|
||||
var mergedNode = MergeWithParent(node, allUnits).NodesDict;
|
||||
var mergedNode = MergeWithParent(node, allUnits).ToDictionary();
|
||||
|
||||
Name = name;
|
||||
foreach (var t in mergedNode)
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA
|
||||
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||
{
|
||||
MiniYaml inherits;
|
||||
node.NodesDict.TryGetValue( "Inherits", out inherits );
|
||||
node.ToDictionary().TryGetValue( "Inherits", out inherits );
|
||||
if( inherits == null || string.IsNullOrEmpty( inherits.Value ) )
|
||||
return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user