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. # Use coalesce expression instead of conditional expression.
dotnet_diagnostic.RCS1084.severity = warning dotnet_diagnostic.RCS1084.severity = warning
# Use --/++ operator instead of assignment.
dotnet_diagnostic.RCS1089.severity = warning
# Remove empty region. # Remove empty region.
dotnet_diagnostic.RCS1091.severity = warning dotnet_diagnostic.RCS1091.severity = warning

View File

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

View File

@@ -135,12 +135,12 @@ namespace OpenRA
public bool MoveNext() public bool MoveNext()
{ {
u += 1; u++;
// Check for column overflow // Check for column overflow
if (u > r.mapBottomRight.U) if (u > r.mapBottomRight.U)
{ {
v += 1; v++;
u = r.mapTopLeft.U; u = r.mapTopLeft.U;
// Check for row overflow // 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 // Odd-height ramps get bumped up a level to the next even height layer
if ((height & 1) == 1 && Ramp[uv] != 0) if ((height & 1) == 1 && Ramp[uv] != 0)
height += 1; height++;
var candidates = new List<PPos>(); var candidates = new List<PPos>();

View File

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

View File

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

View File

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

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
public ShpD2Frame(Stream s) public ShpD2Frame(Stream s)
{ {
var flags = (FormatFlags)s.ReadUInt16(); var flags = (FormatFlags)s.ReadUInt16();
s.Position += 1; s.Position++;
var width = s.ReadUInt16(); var width = s.ReadUInt16();
var height = s.ReadUInt8(); var height = s.ReadUInt8();
Size = new Size(width, height); 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 // Width and height must be even to avoid rendering glitches
if ((width & 1) == 1) if ((width & 1) == 1)
width += 1; width++;
if ((height & 1) == 1) if ((height & 1) == 1)
height += 1; height++;
size = new Size(width, height); size = new Size(width, height);
} }

View File

@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Projectiles
CycleCount = SourceToTarget.Length / info.HelixPitch.Length; CycleCount = SourceToTarget.Length / info.HelixPitch.Length;
if (SourceToTarget.Length % info.HelixPitch.Length != 0) 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" // 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. // 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 dataWidth = width;
var dataHeight = height; var dataHeight = height;
if (dataWidth % 2 == 1) if (dataWidth % 2 == 1)
dataWidth += 1; dataWidth++;
if (dataHeight % 2 == 1) if (dataHeight % 2 == 1)
dataHeight += 1; dataHeight++;
Offset = new int2(x + (dataWidth - frameSize.Width) / 2, y + (dataHeight - frameSize.Height) / 2); Offset = new int2(x + (dataWidth - frameSize.Width) / 2, y + (dataHeight - frameSize.Height) / 2);
Size = new Size(dataWidth, dataHeight); Size = new Size(dataWidth, dataHeight);

View File

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

View File

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

View File

@@ -714,7 +714,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
RemainingCost -= costThisFrame; RemainingCost -= costThisFrame;
RemainingTime -= 1; RemainingTime--;
if (RemainingTime > 0) if (RemainingTime > 0)
return; 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 // 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 // For this purpose, having a false positive (forcing a refresh when nothing changed) is much better
// than a false negative (selection state mismatch) // than a false negative (selection state mismatch)
Hash += 1; Hash++;
} }
public virtual void Add(Actor a) public virtual void Add(Actor a)

View File

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