From 6e39a5e264aec0cc3044f92ab0eebe538f5cae4d Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Sat, 19 Sep 2015 12:38:16 -0500 Subject: [PATCH] Replace .WithInterface().Any() => .HasTraitInfo() --- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs | 4 ++-- OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs | 4 ++-- OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 6fc8a5a684..7e27d05a83 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -279,7 +279,7 @@ namespace OpenRA.Traits [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")] public interface Requires where T : class, ITraitInfo { } [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")] - public interface UsesInit where T : IActorInit { } + public interface UsesInit : ITraitInfo where T : IActorInit { } public interface INotifySelected { void Selected(Actor self); } public interface INotifySelection { void SelectionChanged(); } diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs index 69eb40d190..dc86985f34 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs @@ -96,13 +96,13 @@ namespace OpenRA.Mods.Common.Widgets var facing = underCursor.Init(); if (facing != null) underCursor.ReplaceInit(new FacingInit((facing.Value(world) + mi.ScrollDelta) % 256)); - else if (underCursor.Info.Traits.WithInterface>().Any()) + else if (underCursor.Info.HasTraitInfo>()) underCursor.ReplaceInit(new FacingInit(mi.ScrollDelta)); var turret = underCursor.Init(); if (turret != null) underCursor.ReplaceInit(new TurretFacingInit((turret.Value(world) + mi.ScrollDelta) % 256)); - else if (underCursor.Info.Traits.WithInterface>().Any()) + else if (underCursor.Info.HasTraitInfo>()) underCursor.ReplaceInit(new TurretFacingInit(mi.ScrollDelta)); } } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs b/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs index e95bedf61d..5efa1dba2a 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits this.info = info; manager = self.Trait(); checkTerrainType = info.AllowedTerrainTypes.Count > 0; - canTurn = self.Info.Traits.WithInterface().Any(); + canTurn = self.Info.HasTraitInfo(); body = Exts.Lazy(self.TraitOrDefault); } @@ -168,4 +168,4 @@ namespace OpenRA.Mods.Common.Traits manager.RevokeUpgrade(self, up, this); } } -} \ No newline at end of file +} diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 22738ad709..fdfd1d74d1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -241,7 +241,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var assets = template.Get("ASSETS"); assets.GetText = () => "$" + world.Actors - .Where(a => a.Owner == player && !a.IsDead && a.Info.Traits.WithInterface().Any()) + .Where(a => a.Owner == player && !a.IsDead && a.Info.HasTraitInfo()) .Sum(a => a.Info.Traits.WithInterface().First().Cost); var harvesters = template.Get("HARVESTERS");