Remove unnecessary value assignment (IDE0059)
This commit is contained in:
committed by
Gustas
parent
757c4d84c7
commit
6bd631618c
@@ -66,7 +66,6 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (!targetIsHiddenActor && target.Type == TargetType.Actor)
|
||||
lastVisibleTarget = Target.FromTargetPositions(target);
|
||||
|
||||
var oldUseLastVisibleTarget = useLastVisibleTarget;
|
||||
useLastVisibleTarget = targetIsHiddenActor || !target.IsValidFor(self);
|
||||
|
||||
// Cancel immediately if the target died while we were entering it
|
||||
|
||||
@@ -355,13 +355,12 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
var tarDistVec = targetPosition + offset - pos;
|
||||
var relTarHorDist = tarDistVec.HorizontalLength;
|
||||
|
||||
int predClfHgt = 0;
|
||||
int predClfDist = 0;
|
||||
int lastHtChg = 0;
|
||||
int lastHt = 0;
|
||||
var predClfHgt = 0;
|
||||
var predClfDist = 0;
|
||||
var lastHt = 0;
|
||||
|
||||
if (info.TerrainHeightAware)
|
||||
InclineLookahead(world, relTarHorDist, out predClfHgt, out predClfDist, out lastHtChg, out lastHt);
|
||||
InclineLookahead(world, relTarHorDist, out predClfHgt, out predClfDist, out _, out lastHt);
|
||||
|
||||
// Height difference between the incline height and missile height
|
||||
var diffClfMslHgt = predClfHgt - pos.Z;
|
||||
@@ -590,7 +589,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
int HomingInnerTick(int predClfDist, int diffClfMslHgt, int relTarHorDist, int lastHtChg, int lastHt,
|
||||
int relTarHgt, int vFacing, bool targetPassedBy)
|
||||
{
|
||||
int desiredVFacing = vFacing;
|
||||
int desiredVFacing;
|
||||
|
||||
// Incline coming up -> attempt to reach the incline so that after predClfDist
|
||||
// the height above the terrain is positive but as close to 0 as possible
|
||||
|
||||
@@ -54,8 +54,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
|
||||
protected static Actor FindDefenselessTarget(Squad owner)
|
||||
{
|
||||
Actor target = null;
|
||||
FindSafePlace(owner, out target, true);
|
||||
FindSafePlace(owner, out var target, true);
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly AircraftInfo aircraftInfo;
|
||||
readonly Aircraft aircraft;
|
||||
readonly BodyOrientation body;
|
||||
readonly IMove move;
|
||||
readonly IFacing facing;
|
||||
readonly Actor self;
|
||||
|
||||
@@ -125,7 +124,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
aircraftInfo = self.Info.TraitInfoOrDefault<AircraftInfo>();
|
||||
aircraft = self.Trait<Aircraft>();
|
||||
body = self.Trait<BodyOrientation>();
|
||||
move = self.Trait<IMove>();
|
||||
facing = self.Trait<IFacing>();
|
||||
this.self = self;
|
||||
|
||||
@@ -347,7 +345,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!aircraftInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
|
||||
return;
|
||||
|
||||
var targetLocation = move.NearestMoveableCell(cell);
|
||||
self.QueueActivity(order.Queued, new DeliverUnit(self, order.Target, Info.DropRange, Info.TargetLineColor));
|
||||
self.ShowTargetLines();
|
||||
}
|
||||
@@ -435,9 +432,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!info.AllowDropOff || !modifiers.HasModifier(TargetModifiers.ForceMove))
|
||||
return false;
|
||||
|
||||
cursor = info.DropOffCursor;
|
||||
var type = target.Type;
|
||||
|
||||
if ((type == TargetType.Actor && target.Actor.Info.HasTraitInfo<BuildingInfo>())
|
||||
|| (target.Type == TargetType.FrozenActor && target.FrozenActor.Info.HasTraitInfo<BuildingInfo>()))
|
||||
{
|
||||
|
||||
@@ -38,8 +38,6 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var modId = modData.Manifest.Id;
|
||||
|
||||
foreach (var bo in actorNode.ChildrenMatching("BodyOrientation"))
|
||||
{
|
||||
var usesClassicFacings = false;
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var modId = modData.Manifest.Id;
|
||||
|
||||
foreach (var sh in actorNode.ChildrenMatching("SelfHealing"))
|
||||
{
|
||||
sh.RenameChildrenMatching("HealIfBelow", "StartIfBelow");
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var palette = new ImmutablePalette(args[1], new[] { 0 }, Array.Empty<int>());
|
||||
|
||||
SequenceProvider sequences = null;
|
||||
SequenceProvider sequences;
|
||||
var mapPackage = new Folder(Platform.EngineDir).OpenPackage(args[2], modData.ModFiles);
|
||||
if (mapPackage != null)
|
||||
sequences = new Map(modData, mapPackage).Rules.Sequences;
|
||||
|
||||
@@ -118,8 +118,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
var iniFormat = basicSection.GetValue("NewINIFormat", "0");
|
||||
|
||||
var iniFormatVersion = 0;
|
||||
Exts.TryParseIntegerInvariant(iniFormat, out iniFormatVersion);
|
||||
Exts.TryParseIntegerInvariant(iniFormat, out var iniFormatVersion);
|
||||
|
||||
return iniFormatVersion;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ using OpenRA.Mods.Common.UpdateRules;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
using YamlFileSet = List<(IReadWritePackage, string, List<MiniYamlNode>)>;
|
||||
|
||||
class UpdateMapCommand : IUtilityCommand
|
||||
{
|
||||
string IUtilityCommand.Name => "--update-map";
|
||||
@@ -102,15 +100,23 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var externalFilenames = new HashSet<string>();
|
||||
foreach (var rule in rules)
|
||||
{
|
||||
Console.WriteLine("{0}: {1}", rule.GetType().Name, rule.Name);
|
||||
var mapFiles = new YamlFileSet();
|
||||
var manualSteps = new List<string>();
|
||||
|
||||
Console.WriteLine($"{rule.GetType().Name}: {rule.Name}");
|
||||
Console.Write(" Updating map... ");
|
||||
|
||||
try
|
||||
{
|
||||
manualSteps = UpdateUtils.UpdateMap(modData, mapPackage, rule, out mapFiles, externalFilenames);
|
||||
var manualSteps = UpdateUtils.UpdateMap(modData, mapPackage, rule, out var mapFiles, externalFilenames);
|
||||
|
||||
// Files are saved after each successful automated rule update
|
||||
mapFiles.Save();
|
||||
Console.WriteLine("COMPLETE");
|
||||
|
||||
if (manualSteps.Count > 0)
|
||||
{
|
||||
Console.WriteLine(" Manual changes are required to complete this update:");
|
||||
foreach (var manualStep in manualSteps)
|
||||
Console.WriteLine(" * " + manualStep.Replace("\n", "\n "));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -119,24 +125,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" The automated changes for this rule were not applied because of an error.");
|
||||
Console.WriteLine(" After the issue reported below is resolved you should run the updater");
|
||||
Console.WriteLine(" with SOURCE set to {0} to retry these changes", rule.GetType().Name);
|
||||
Console.WriteLine($" with SOURCE set to {rule.GetType().Name} to retry these changes");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" The exception reported was:");
|
||||
Console.WriteLine(" " + ex.ToString().Replace("\n", "\n "));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Files are saved after each successful automated rule update
|
||||
mapFiles.Save();
|
||||
Console.WriteLine("COMPLETE");
|
||||
|
||||
if (manualSteps.Count > 0)
|
||||
{
|
||||
Console.WriteLine(" Manual changes are required to complete this update:");
|
||||
foreach (var manualStep in manualSteps)
|
||||
Console.WriteLine(" * " + manualStep.Replace("\n", "\n "));
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
foreach (var rule in rules)
|
||||
{
|
||||
var manualSteps = new List<string>();
|
||||
var allFiles = new YamlFileSet();
|
||||
YamlFileSet allFiles;
|
||||
|
||||
LogLine(logWriter, "{0}: {1}", rule.GetType().Name, rule.Name);
|
||||
LogLine(logWriter, $"{rule.GetType().Name}: {rule.Name}");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user