diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 0d8b72f5a6..cc633692ea 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -62,7 +62,7 @@ namespace OpenRa.Game { get // todo: inline into GetBounds { - var si = Info != null ? Info.Traits.GetOrDefault() : null; + var si = Info.Traits.GetOrDefault(); if (si != null && si.Bounds != null) return new float2(si.Bounds[0], si.Bounds[1]); @@ -100,7 +100,7 @@ namespace OpenRa.Game public RectangleF GetBounds(bool useAltitude) { - var si = Info != null ? Info.Traits.GetOrDefault() : null; + var si = Info.Traits.GetOrDefault(); var size = SelectedSize; var loc = CenterLocation - 0.5f * size; diff --git a/OpenRa.Game/Exts.cs b/OpenRa.Game/Exts.cs index e69d1eed42..25c746a325 100644 --- a/OpenRa.Game/Exts.cs +++ b/OpenRa.Game/Exts.cs @@ -54,7 +54,6 @@ namespace OpenRa.Game public static int GetMaxHP(this Actor self) { - if (self.Info == null) return 0; var oai = self.Info.Traits.GetOrDefault(); if (oai == null) return 0; return oai.HP; diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index dc992e574c..3e8b5a6f65 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -61,7 +61,7 @@ namespace OpenRa.Game world = new World(); Game.world.ActorAdded += a => { - if (a.Owner != null && a.Info != null && a.Info.Traits.Contains()) + if (a.Owner != null && a.Info.Traits.Contains()) a.Owner.Shroud.Explore(a); }; diff --git a/OpenRa.Game/GameRules/TechTree.cs b/OpenRa.Game/GameRules/TechTree.cs index 4c1019c7ff..f65b64a4a7 100755 --- a/OpenRa.Game/GameRules/TechTree.cs +++ b/OpenRa.Game/GameRules/TechTree.cs @@ -23,7 +23,7 @@ namespace OpenRa.Game.GameRules public Cache> GatherBuildings( Player player ) { var ret = new Cache>( x => new List() ); - foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info != null && x.Info.Traits.Contains() ) ) + foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info.Traits.Contains() ) ) { ret[ b.Info.Name ].Add( b ); var buildable = b.Info.Traits.GetOrDefault(); diff --git a/OpenRa.Game/Graphics/Viewport.cs b/OpenRa.Game/Graphics/Viewport.cs index e761e718ed..b52a6f7d7a 100644 --- a/OpenRa.Game/Graphics/Viewport.cs +++ b/OpenRa.Game/Graphics/Viewport.cs @@ -98,8 +98,7 @@ namespace OpenRa.Game.Graphics public void GoToStartLocation() { - Center(Game.world.Actors.Where(a => a.Info != null - && a.traits.Contains() && a.Owner == Game.LocalPlayer)); + Center(Game.world.Actors.Where(a => a.Owner == Game.LocalPlayer && a.traits.Contains())); } } }