Use out var syntax

This commit is contained in:
teinarss
2020-08-16 10:49:33 +02:00
committed by Paul Chote
parent d52e4793fe
commit 27f1a7ab27
193 changed files with 395 additions and 826 deletions

View File

@@ -218,9 +218,7 @@ namespace OpenRA.Mods.Common.Projectiles
}
// Check for blocking actors
WPos blockedPos;
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, tailPos, headPos,
info.Width, out blockedPos))
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, tailPos, headPos, info.Width, out var blockedPos))
{
headPos = blockedPos;
target = headPos;

View File

@@ -205,9 +205,7 @@ namespace OpenRA.Mods.Common.Projectiles
// Check for walls or other blocking obstacles
var shouldExplode = false;
WPos blockedPos;
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, lastPos, pos, info.Width,
out blockedPos))
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, lastPos, pos, info.Width, out var blockedPos))
{
pos = blockedPos;
shouldExplode = true;

View File

@@ -67,7 +67,6 @@ namespace OpenRA.Mods.Common.Projectiles
public void Tick(World world)
{
// Check for blocking actors
WPos blockedPos;
if (info.Blockable)
{
// If GuidedTarget has become invalid due to getting killed the same tick,
@@ -77,7 +76,7 @@ namespace OpenRA.Mods.Common.Projectiles
target = Target.FromPos(args.PassiveTarget);
if (BlocksProjectiles.AnyBlockingActorsBetween(world, args.Source, target.CenterPosition,
info.Width, out blockedPos))
info.Width, out var blockedPos))
target = Target.FromPos(blockedPos);
}

View File

@@ -158,9 +158,7 @@ namespace OpenRA.Mods.Common.Projectiles
target = args.Weapon.TargetActorCenter ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.PositionClosestTo(source);
// Check for blocking actors
WPos blockedPos;
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, source, target,
info.Width, out blockedPos))
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, source, target, info.Width, out var blockedPos))
{
target = blockedPos;
}

View File

@@ -849,9 +849,7 @@ namespace OpenRA.Mods.Common.Projectiles
// Check for walls or other blocking obstacles
var shouldExplode = false;
WPos blockedPos;
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, lastPos, pos, info.Width,
out blockedPos))
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, lastPos, pos, info.Width, out var blockedPos))
{
pos = blockedPos;
shouldExplode = true;

View File

@@ -148,9 +148,8 @@ namespace OpenRA.Mods.Common.Projectiles
void CalculateVectors()
{
// Check for blocking actors
WPos blockedPos;
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(args.SourceActor.World, target, args.Source,
info.BeamWidth, out blockedPos))
info.BeamWidth, out var blockedPos))
target = blockedPos;
// Note: WAngle.Sin(x) = 1024 * Math.Sin(2pi/1024 * x)