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

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
bool opportunityForceAttack;
bool opportunityTargetIsPersistentTarget;
public void SetRequestedTarget(Actor self, Target target, bool isForceAttack = false)
public void SetRequestedTarget(Actor self, in Target target, bool isForceAttack = false)
{
RequestedTarget = target;
requestedForceAttack = isForceAttack;
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
base.Created(self);
}
protected bool CanAimAtTarget(Actor self, Target target, bool forceAttack)
protected bool CanAimAtTarget(Actor self, in Target target, bool forceAttack)
{
if (target.Type == TargetType.Actor && !target.Actor.CanBeViewedByPlayer(self.Owner))
return false;
@@ -154,12 +154,12 @@ namespace OpenRA.Mods.Common.Traits
base.Tick(self);
}
public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
{
return new AttackActivity(self, newTarget, allowMove, forceAttack, targetLineColor);
}
public override void OnResolveAttackOrder(Actor self, Activity activity, Target target, bool queued, bool forceAttack)
public override void OnResolveAttackOrder(Actor self, Activity activity, in Target target, bool queued, bool forceAttack)
{
// We can improve responsiveness for turreted actors by preempting
// the last order (usually a move) and setting the target immediately
@@ -228,7 +228,7 @@ namespace OpenRA.Mods.Common.Traits
bool wasMovingWithinRange;
bool hasTicked;
public AttackActivity(Actor self, Target target, bool allowMove, bool forceAttack, Color? targetLineColor = null)
public AttackActivity(Actor self, in Target target, bool allowMove, bool forceAttack, Color? targetLineColor = null)
{
attack = self.Trait<AttackFollow>();
move = allowMove ? self.TraitOrDefault<IMove>() : null;