Remove unnecessary parentheses

This commit is contained in:
Gustas
2023-02-19 17:01:36 +02:00
committed by Pavel Penev
parent 157d1b32dc
commit 8d0fe52dd8
48 changed files with 78 additions and 64 deletions

View File

@@ -250,7 +250,11 @@ namespace OpenRA.Mods.Cnc.FileFormats
{
*op++ = *ip++;
if (t > 2)
{
#pragma warning disable IDE0047
(*op++) = *ip++;
#pragma warning restore IDE0047
}
}
t = *ip++;

View File

@@ -110,13 +110,13 @@ namespace OpenRA.Mods.Cnc.Graphics
static IEnumerable<IFinalizedRenderable> DrawZapWandering(WorldRenderer wr, float2 from, float2 to, ISpriteSequence s, string pal)
{
var dist = to - from;
var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X);
var norm = 1f / dist.Length * new float2(-dist.Y, dist.X);
var renderables = new List<IFinalizedRenderable>();
if (Game.CosmeticRandom.Next(2) != 0)
{
var p1 = from + (1 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
var p2 = from + (2 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
var p1 = from + 1 / 3f * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
var p2 = from + 2 / 3f * 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, p2, s, out p2, pal));
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Cnc.Graphics
}
else
{
var p1 = from + (1 / 2f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
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 _, pal));

View File

@@ -149,7 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits
var minefield = GetMinefieldCells(minefieldStart, cell, Info.MinefieldDepth)
.Where(c => IsCellAcceptable(self, c) && self.Owner.Shroud.IsExplored(c)
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && (movement is Mobile mobile && mobile.CanStayInCell(c)))
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && movement is Mobile mobile && mobile.CanStayInCell(c))
.OrderBy(c => (c - minefieldStart).LengthSquared).ToList();
self.QueueActivity(order.Queued, new LayMines(self, minefield));
@@ -180,7 +180,7 @@ namespace OpenRA.Mods.Cnc.Traits
// TODO: proper endcaps, if anyone cares (which won't happen unless depth is large)
var p = end - start;
var q = new float2(p.Y, -p.X);
q = (start != end) ? (1 / q.Length) * q : new float2(1, 0);
q = (start != end) ? 1 / q.Length * q : new float2(1, 0);
var c = -float2.Dot(q, new float2(start.X, start.Y));
// return all points such that |ax + by + c| < depth

View File

@@ -146,7 +146,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
data.AppendLine($"\t\t\t\tMinColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
data.AppendLine($"\t\t\t\tMaxColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
data.AppendLine($"\t\t\t\tZOffset: {(-tileSize.Height / 2.0f)}");
var zOffset = -tileSize.Height / 2.0f;
data.AppendLine($"\t\t\t\tZOffset: {zOffset}");
data.AppendLine("\t\t\t\tZRamp: 0");
}
}