Implement a workaround for the mono 5.0 cursor enumerator bug.
This commit is contained in:
@@ -139,8 +139,15 @@ namespace OpenRA.Orders
|
||||
if (mi.Modifiers.HasModifier(Modifiers.Alt))
|
||||
modifiers |= TargetModifiers.ForceMove;
|
||||
|
||||
// The Select(x => x) is required to work around an issue on mono 5.0
|
||||
// where calling OrderBy* on SelectManySingleSelectorIterator can in some
|
||||
// circumstances (which we were unable to identify) replace entries in the
|
||||
// enumeration with duplicates of other entries.
|
||||
// Other action that replace the SelectManySingleSelectorIterator with a
|
||||
// different enumerator type (e.g. .Where(true) or .ToList()) also work.
|
||||
var orders = self.TraitsImplementing<IIssueOrder>()
|
||||
.SelectMany(trait => trait.Orders.Select(x => new { Trait = trait, Order = x }))
|
||||
.Select(x => x)
|
||||
.OrderByDescending(x => x.Order.OrderPriority);
|
||||
|
||||
for (var i = 0; i < 2; i++)
|
||||
|
||||
Reference in New Issue
Block a user