Use Tuple syntax

This commit is contained in:
teinarss
2020-08-02 13:41:03 +02:00
committed by Paul Chote
parent 8a74f6ea18
commit 19b02875c7
90 changed files with 738 additions and 826 deletions

View File

@@ -50,15 +50,15 @@ namespace OpenRA.Mods.Common.Activities
this.unloadRange = unloadRange;
}
public Pair<CPos, SubCell>? ChooseExitSubCell(Actor passenger)
public (CPos Cell, SubCell SubCell)? ChooseExitSubCell(Actor passenger)
{
var pos = passenger.Trait<IPositionable>();
return cargo.CurrentAdjacentCells
.Shuffle(self.World.SharedRandom)
.Select(c => Pair.New(c, pos.GetAvailableSubCell(c)))
.Cast<Pair<CPos, SubCell>?>()
.FirstOrDefault(s => s.Value.Second != SubCell.Invalid);
.Select(c => (c, pos.GetAvailableSubCell(c)))
.Cast<(CPos, SubCell SubCell)?>()
.FirstOrDefault(s => s.Value.SubCell != SubCell.Invalid);
}
IEnumerable<CPos> BlockedExitCells(Actor passenger)
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Activities
var move = actor.Trait<IMove>();
var pos = actor.Trait<IPositionable>();
pos.SetPosition(actor, exitSubCell.Value.First, exitSubCell.Value.Second);
pos.SetPosition(actor, exitSubCell.Value.Cell, exitSubCell.Value.SubCell);
pos.SetVisualPosition(actor, spawn);
actor.CancelActivity();