Add FirstNonEmptyBounds method for IDecorationBounds interface.
This provides a more efficient way of determining the bounds by avoiding LINQ. A helper that works directly on arrays prevents allocation of an enumerator when the collection is know to be an array.
This commit is contained in:
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var selected = self.World.Selection.Contains(self);
|
||||
var regularWorld = self.World.Type == WorldType.Regular;
|
||||
var statusBars = Game.Settings.Game.StatusBars;
|
||||
var bounds = decorationBounds.Select(b => b.DecorationBounds(self, wr)).FirstOrDefault(b => !b.IsEmpty);
|
||||
var bounds = decorationBounds.FirstNonEmptyBounds(self, wr);
|
||||
|
||||
// Health bars are shown when:
|
||||
// * actor is selected
|
||||
|
||||
Reference in New Issue
Block a user