Fix RCS1089

This commit is contained in:
RoosterDragon
2023-03-18 12:50:55 +00:00
committed by Gustas
parent 4dd787be13
commit eb287d9b8d
17 changed files with 26 additions and 23 deletions

View File

@@ -1004,6 +1004,9 @@ dotnet_diagnostic.RCS1080.severity = warning
# Use coalesce expression instead of conditional expression.
dotnet_diagnostic.RCS1084.severity = warning
# Use --/++ operator instead of assignment.
dotnet_diagnostic.RCS1089.severity = warning
# Remove empty region.
dotnet_diagnostic.RCS1091.severity = warning

View File

@@ -302,9 +302,9 @@ namespace OpenRA
// Adjust for other rounding modes
if (round == ISqrtRoundMode.Nearest && remainder > root)
root += 1;
root++;
else if (round == ISqrtRoundMode.Ceiling && root * root < number)
root += 1;
root++;
return root;
}
@@ -343,9 +343,9 @@ namespace OpenRA
// Adjust for other rounding modes
if (round == ISqrtRoundMode.Nearest && remainder > root)
root += 1;
root++;
else if (round == ISqrtRoundMode.Ceiling && root * root < number)
root += 1;
root++;
return root;
}

View File

@@ -135,12 +135,12 @@ namespace OpenRA
public bool MoveNext()
{
u += 1;
u++;
// Check for column overflow
if (u > r.mapBottomRight.U)
{
v += 1;
v++;
u = r.mapTopLeft.U;
// Check for row overflow

View File

@@ -611,7 +611,7 @@ namespace OpenRA
// Odd-height ramps get bumped up a level to the next even height layer
if ((height & 1) == 1 && Ramp[uv] != 0)
height += 1;
height++;
var candidates = new List<PPos>();

View File

@@ -35,7 +35,7 @@ namespace OpenRA
// Check for column overflow
if (u > r.BottomRight.U)
{
v += 1;
v++;
u = r.TopLeft.U;
// Check for row overflow

View File

@@ -93,12 +93,12 @@ namespace OpenRA
public bool MoveNext()
{
u += 1;
u++;
// Check for column overflow
if (u > r.BottomRight.U)
{
v += 1;
v++;
u = r.TopLeft.U;
// Check for row overflow

View File

@@ -154,7 +154,7 @@ namespace OpenRA.Primitives
// Wrap negative values into [0-1)
if (h < 0)
h += 1;
h++;
var s = delta / rgbMax;
return (h, s, v);

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
public ShpD2Frame(Stream s)
{
var flags = (FormatFlags)s.ReadUInt16();
s.Position += 1;
s.Position++;
var width = s.ReadUInt16();
var height = s.ReadUInt8();
Size = new Size(width, height);

View File

@@ -250,9 +250,9 @@ namespace OpenRA.Mods.Cnc.Traits
// Width and height must be even to avoid rendering glitches
if ((width & 1) == 1)
width += 1;
width++;
if ((height & 1) == 1)
height += 1;
height++;
size = new Size(width, height);
}

View File

@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Projectiles
CycleCount = SourceToTarget.Length / info.HelixPitch.Length;
if (SourceToTarget.Length % info.HelixPitch.Length != 0)
CycleCount += 1; // math.ceil, int version.
CycleCount++; // math.ceil, int version.
// Using ForwardStep * CycleCount, the helix and the main beam gets "out of sync"
// if drawn from source to target. Instead, the main beam is drawn from source to end point of helix.

View File

@@ -41,10 +41,10 @@ namespace OpenRA.Mods.Common.SpriteLoaders
var dataWidth = width;
var dataHeight = height;
if (dataWidth % 2 == 1)
dataWidth += 1;
dataWidth++;
if (dataHeight % 2 == 1)
dataHeight += 1;
dataHeight++;
Offset = new int2(x + (dataWidth - frameSize.Width) / 2, y + (dataHeight - frameSize.Height) / 2);
Size = new Size(dataWidth, dataHeight);

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
try
{
// Require true-color images
s.Position += 1;
s.Position++;
var colorMapType = s.ReadUInt8();
if (colorMapType != 0)
return false;

View File

@@ -197,7 +197,7 @@ namespace OpenRA.Mods.Common.Traits
currentTargetDelay = 0;
}
else
currentTargetDelay += 1;
currentTargetDelay++;
if (capturingToken == Actor.InvalidConditionToken)
capturingToken = self.GrantCondition(info.CapturingCondition);

View File

@@ -714,7 +714,7 @@ namespace OpenRA.Mods.Common.Traits
return;
RemainingCost -= costThisFrame;
RemainingTime -= 1;
RemainingTime--;
if (RemainingTime > 0)
return;

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
// Not a real hash, but things checking this only care about checking when the selection has changed
// For this purpose, having a false positive (forcing a refresh when nothing changed) is much better
// than a false negative (selection state mismatch)
Hash += 1;
Hash++;
}
public virtual void Add(Actor a)

View File

@@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Widgets
// Odd rows are shifted right by 1px
if ((point.V & 1) == 1)
dx += 1;
dx++;
return new int2(mapRect.X + dx, mapRect.Y + dy);
}

View File

@@ -474,7 +474,7 @@ namespace OpenRA.Mods.Common.Widgets
// Odd rows are shifted right by 1px
if (isRectangularIsometric && (uv.V & 1) == 1)
dx += 1;
dx++;
return new int2(mapRect.X + dx, mapRect.Y + dy);
}