Use in parameter for Target

This commit is contained in:
teinarss
2020-08-19 20:47:59 +02:00
committed by abcdefg30
parent 13a8b6bda2
commit 13581c030d
113 changed files with 259 additions and 240 deletions

View File

@@ -31,13 +31,13 @@ namespace OpenRA.Mods.Common.Activities
bool useLastVisibleTarget;
readonly List<WPos> positionBuffer = new List<WPos>();
public Fly(Actor self, Target t, WDist nearEnough, WPos? initialTargetPosition = null, Color? targetLineColor = null)
public Fly(Actor self, in Target t, WDist nearEnough, WPos? initialTargetPosition = null, Color? targetLineColor = null)
: this(self, t, initialTargetPosition, targetLineColor)
{
this.nearEnough = nearEnough;
}
public Fly(Actor self, Target t, WPos? initialTargetPosition = null, Color? targetLineColor = null)
public Fly(Actor self, in Target t, WPos? initialTargetPosition = null, Color? targetLineColor = null)
{
aircraft = self.Trait<Aircraft>();
target = t;
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
lastVisibleTarget = Target.FromPos(initialTargetPosition.Value);
}
public Fly(Actor self, Target t, WDist minRange, WDist maxRange,
public Fly(Actor self, in Target t, WDist minRange, WDist maxRange,
WPos? initialTargetPosition = null, Color? targetLineColor = null)
: this(self, t, initialTargetPosition, targetLineColor)
{

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Activities
bool hasTicked;
bool returnToBase;
public FlyAttack(Actor self, AttackSource source, Target target, bool forceAttack, Color? targetLineColor)
public FlyAttack(Actor self, AttackSource source, in Target target, bool forceAttack, Color? targetLineColor)
{
this.source = source;
this.target = target;
@@ -211,7 +211,7 @@ namespace OpenRA.Mods.Common.Activities
WDist exitRange;
bool targetIsVisibleActor;
public FlyAttackRun(Actor self, Target t, WDist exitRange)
public FlyAttackRun(Actor self, in Target t, WDist exitRange)
{
ChildHasPriority = false;
@@ -254,7 +254,7 @@ namespace OpenRA.Mods.Common.Activities
WDist exitRange;
readonly AttackAircraft attackAircraft;
public StrafeAttackRun(Actor self, AttackAircraft attackAircraft, Target t, WDist exitRange)
public StrafeAttackRun(Actor self, AttackAircraft attackAircraft, in Target t, WDist exitRange)
{
ChildHasPriority = false;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Activities
bool useLastVisibleTarget;
bool wasMovingWithinRange;
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange,
public FlyFollow(Actor self, in Target target, WDist minRange, WDist maxRange,
WPos? initialTargetPosition, Color? targetLineColor = null)
{
this.target = target;

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Activities
this.endingDelay = endingDelay;
}
public FlyOffMap(Actor self, Target target, int endingDelay = 25)
public FlyOffMap(Actor self, in Target target, int endingDelay = 25)
: this(self, endingDelay)
{
this.target = target;

View File

@@ -40,16 +40,16 @@ namespace OpenRA.Mods.Common.Activities
assignTargetOnFirstRun = true;
}
public Land(Actor self, Target target, WAngle? facing = null, Color? targetLineColor = null)
public Land(Actor self, in Target target, WAngle? facing = null, Color? targetLineColor = null)
: this(self, target, new WDist(-1), WVec.Zero, facing, targetLineColor: targetLineColor) { }
public Land(Actor self, Target target, WDist landRange, WAngle? facing = null, Color? targetLineColor = null)
public Land(Actor self, in Target target, WDist landRange, WAngle? facing = null, Color? targetLineColor = null)
: this(self, target, landRange, WVec.Zero, facing, targetLineColor: targetLineColor) { }
public Land(Actor self, Target target, WVec offset, WAngle? facing = null, Color? targetLineColor = null)
public Land(Actor self, in Target target, WVec offset, WAngle? facing = null, Color? targetLineColor = null)
: this(self, target, WDist.Zero, offset, facing, targetLineColor: targetLineColor) { }
public Land(Actor self, Target target, WDist landRange, WVec offset, WAngle? facing = null, CPos[] clearCells = null, Color? targetLineColor = null)
public Land(Actor self, in Target target, WDist landRange, WVec offset, WAngle? facing = null, CPos[] clearCells = null, Color? targetLineColor = null)
{
aircraft = self.Trait<Aircraft>();
this.target = target;