Remove unnecessary value assignment (IDE0059)

This commit is contained in:
Matthias Mailänder
2022-09-18 10:02:00 +02:00
committed by Gustas
parent 757c4d84c7
commit 6bd631618c
19 changed files with 38 additions and 60 deletions

View File

@@ -224,13 +224,11 @@ namespace OpenRA.Mods.Cnc.FileFormats
uint nTwoByteLen, bit;
int nTwoBitLen;
var j = 0;
InitBigNum(nTmp, 0, len);
InitBigNum(n1, 0, len);
nTwoBitLen = (int)BitLenBigNum(n2, len);
bit = 1U << (nTwoBitLen % 32);
j = ((nTwoBitLen + 32) / 32) - 1;
var j = ((nTwoBitLen + 32) / 32) - 1;
nTwoByteLen = (uint)((nTwoBitLen - 1) / 32) * 4;
nTmp[nTwoByteLen / 4] |= 1U << ((nTwoBitLen - 1) & 0x1f);

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
Width = stream.ReadUInt16();
Height = stream.ReadUInt16();
var delta = stream.ReadUInt16() + 37;
/*var delta = */stream.ReadUInt16(); /* + 37*/
var flags = stream.ReadUInt16();
frameOffsets = new uint[FrameCount + 2];

View File

@@ -109,7 +109,6 @@ namespace OpenRA.Mods.Cnc.Graphics
static IEnumerable<IFinalizedRenderable> DrawZapWandering(WorldRenderer wr, float2 from, float2 to, ISpriteSequence s, string pal)
{
var z = float2.Zero; /* hack */
var dist = to - from;
var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X);
@@ -121,14 +120,14 @@ namespace OpenRA.Mods.Cnc.Graphics
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2, pal));
renderables.AddRange(DrawZap(wr, p2, to, s, out z, pal));
renderables.AddRange(DrawZap(wr, p2, to, s, out _, pal));
}
else
{
var p1 = from + (1 / 2f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
renderables.AddRange(DrawZap(wr, p1, to, s, out z, pal));
renderables.AddRange(DrawZap(wr, p1, to, s, out _, pal));
}
return renderables;

View File

@@ -162,7 +162,7 @@ namespace OpenRA.Mods.Cnc.Traits
if (!Disguised || self.Owner.IsAlliedWith(self.World.RenderPlayer))
return color;
return color = Game.Settings.Game.UsePlayerStanceColors ? AsPlayer.PlayerRelationshipColor(self) : AsPlayer.Color;
return Game.Settings.Game.UsePlayerStanceColors ? AsPlayer.PlayerRelationshipColor(self) : AsPlayer.Color;
}
public void DisguiseAs(Actor target)

View File

@@ -621,8 +621,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
}
// Merge Ground into Ambient
float ground = 0;
if (parsed.TryGetValue("Ground", out ground))
if (parsed.TryGetValue("Ground", out var ground))
{
if (!parsed.ContainsKey("Ambient"))
parsed["Ambient"] = 1f;

View File

@@ -40,15 +40,15 @@ namespace OpenRA.Mods.Cnc.VideoLoaders
if (frames <= 1) // TODO: find a better way to differentiate .shp icons
return false;
var x = s.ReadUInt16();
var y = s.ReadUInt16();
/* var x = */ s.ReadUInt16();
/* var y = */ s.ReadUInt16();
var width = s.ReadUInt16();
var height = s.ReadUInt16();
if (width <= 0 || height <= 0)
return false;
var delta = s.ReadUInt16() + 37;
/*var delta = */ s.ReadUInt16(); /* + 37;*/
var flags = s.ReadUInt16();
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Cnc.VideoLoaders
if (flags == 1)
{
var palette = s.ReadBytes(768);
/* var palette = */ s.ReadBytes(768);
for (var i = 0; i < offsets.Length; i++)
offsets[i] += 768;
}