Added MinBy, MaxBy, MinByOrDefault and MaxByOrDefault methods and replaced calls of the style OrderBy[Descending]().First[OrDefault]() which is not as performant.
This commit is contained in:
@@ -106,8 +106,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
var underCursor = world.ScreenMap.ActorsAt(worldRenderer.Viewport.ViewToWorldPx(Viewport.LastMousePos))
|
||||
.Where(a => !world.FogObscures(a) && a.HasTrait<IToolTip>())
|
||||
.OrderByDescending(a => a.Info.SelectionPriority())
|
||||
.FirstOrDefault();
|
||||
.WithHighestSelectionPriority();
|
||||
|
||||
if (underCursor != null)
|
||||
{
|
||||
@@ -118,8 +117,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
var frozen = world.ScreenMap.FrozenActorsAt(world.RenderPlayer, worldRenderer.Viewport.ViewToWorldPx(Viewport.LastMousePos))
|
||||
.Where(a => a.TooltipName != null)
|
||||
.OrderByDescending(a => a.Info.SelectionPriority())
|
||||
.FirstOrDefault();
|
||||
.WithHighestSelectionPriority();
|
||||
|
||||
if (frozen != null)
|
||||
{
|
||||
|
||||
@@ -93,8 +93,7 @@ namespace OpenRA.Widgets
|
||||
if (multiClick)
|
||||
{
|
||||
var unit = World.ScreenMap.ActorsAt(xy)
|
||||
.OrderByDescending(a => a.Info.SelectionPriority())
|
||||
.FirstOrDefault();
|
||||
.WithHighestSelectionPriority();
|
||||
|
||||
var newSelection2 = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
||||
a => unit != null && a.Info.Name == unit.Info.Name && a.Owner == unit.Owner);
|
||||
|
||||
Reference in New Issue
Block a user