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:
RoosterDragon
2014-05-22 01:30:48 +01:00
parent db08357e36
commit 0ea3509ee4
16 changed files with 90 additions and 47 deletions

View File

@@ -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);