Eradicate ☠ Mono ☠
Co-Authored-By: Gustas <37534529+punkpun@users.noreply.github.com>
This commit is contained in:
@@ -48,14 +48,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public static Exit NearestExitOrDefault(this Actor actor, WPos pos, string productionType = null, Func<Exit, bool> p = null)
|
||||
{
|
||||
// The .ToList() is required to work around a bug/unexpected behaviour in mono, where
|
||||
// the ThenBy clause makes the FirstOrDefault behave differently than under .NET.
|
||||
// This is important because p may have side-effects that trigger a desync if not
|
||||
// called on the same exits in the same order!
|
||||
var all = Exits(actor, productionType)
|
||||
.OrderByDescending(e => e.Info.Priority)
|
||||
.ThenBy(e => (actor.World.Map.CenterOfCell(actor.Location + e.Info.ExitCell) - pos).LengthSquared)
|
||||
.ToList();
|
||||
.ThenBy(e => (actor.World.Map.CenterOfCell(actor.Location + e.Info.ExitCell) - pos).LengthSquared);
|
||||
|
||||
#pragma warning disable RCS1077 // Optimize LINQ method call.
|
||||
return p != null ? all.FirstOrDefault(p) : all.FirstOrDefault();
|
||||
|
||||
Reference in New Issue
Block a user