diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 5bbba3e2fa..95ec80365a 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -38,7 +38,7 @@ namespace OpenRa.Game if( Info.Traits == null ) throw new InvalidOperationException( "No Actor traits for {0}; add Traits= to units.ini for appropriate unit".F(Info.Name) ); - foreach (var trait in Rules.NewUnitInfo[Info.Name.ToLower()].Traits.Values) + foreach (var trait in Rules.NewUnitInfo[Info.Name.ToLower()].Traits.WithInterface()) traits.Add(trait.Create(this)); } diff --git a/OpenRa.Game/GameRules/NewUnitInfo.cs b/OpenRa.Game/GameRules/NewUnitInfo.cs index 4b660ad71d..3d80aba9f1 100755 --- a/OpenRa.Game/GameRules/NewUnitInfo.cs +++ b/OpenRa.Game/GameRules/NewUnitInfo.cs @@ -9,7 +9,7 @@ namespace OpenRa.Game.GameRules class NewUnitInfo { public readonly string Parent; - public readonly Dictionary Traits; + public readonly TypeDictionary Traits = new TypeDictionary(); public NewUnitInfo( MiniYaml node ) { @@ -20,9 +20,8 @@ namespace OpenRa.Game.GameRules node.Nodes.Remove( "Inherits" ); } - Traits = node.Nodes.ToDictionary( - a => a.Key, - a => LoadTraitInfo( a.Key, a.Value )); + foreach (var t in node.Nodes) + Traits.Add(LoadTraitInfo(t.Key, t.Value)); } static ITraitInfo LoadTraitInfo(string traitName, MiniYaml my)