Fix IDE0048

This commit is contained in:
RoosterDragon
2023-02-28 19:27:42 +00:00
committed by Pavel Penev
parent 65e28d5562
commit 8ee6957e6a
23 changed files with 46 additions and 37 deletions

View File

@@ -304,8 +304,8 @@ namespace OpenRA.Mods.Common.Widgets
for (var x = previousCell.X; x <= nextCell.X; x += terrainTemplate.Size.X)
{
PaintSingleCell(new CPos(x, queuedCell.Y));
var upperCell = new CPos(x, queuedCell.Y - (1 * terrainTemplate.Size.Y));
var lowerCell = new CPos(x, queuedCell.Y + (1 * terrainTemplate.Size.Y));
var upperCell = new CPos(x, queuedCell.Y - 1 * terrainTemplate.Size.Y);
var lowerCell = new CPos(x, queuedCell.Y + 1 * terrainTemplate.Size.Y);
if (ShouldPaint(upperCell))
MaybeEnqueue(upperCell);

View File

@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.FileFormats
{
this.channels = channels;
numBlocks = dataSize / blockAlign;
blockDataSize = blockAlign - (channels * 4);
blockDataSize = blockAlign - channels * 4;
outputSize = uncompressedSize * channels * 2;
predictor = new int[channels];
index = new int[channels];
@@ -268,7 +268,7 @@ namespace OpenRA.Mods.Common.FileFormats
// This code contains elements from libsndfile
short DecodeNibble(short nibble, byte bpred, ref short idelta, ref short s1, ref short s2)
{
var predict = ((s1 * AdaptCoeff1[bpred]) + (s2 * AdaptCoeff2[bpred])) >> 8;
var predict = (s1 * AdaptCoeff1[bpred] + s2 * AdaptCoeff2[bpred]) >> 8;
var twosCompliment = (nibble & 0x8) > 0
? nibble - 0x10

View File

@@ -376,7 +376,7 @@ namespace OpenRA.Mods.Common.Graphics
for (var frame = 0; frame < length; frame++)
{
var i = transpose ? frame % length * facings + facing :
(facing * stride) + (frame % length);
facing * stride + frame % length;
usedFrames.Add(frames != null ? frames[i] : start + i);
}
@@ -530,7 +530,7 @@ namespace OpenRA.Mods.Common.Graphics
for (var frame = 0; frame < length; frame++)
{
var i = transpose ? frame % length * facings + facing :
(facing * stride) + (frame % length);
facing * stride + frame % length;
var s = frames != null ? sprites[frames[i]] : sprites[start + i];
if (!s.Bounds.IsEmpty)
yield return new Rectangle(
@@ -574,7 +574,7 @@ namespace OpenRA.Mods.Common.Graphics
f = (facings - f) % facings;
var i = transpose ? frame % length * facings + f :
(f * stride) + (frame % length);
f * stride + frame % length;
var j = frames != null ? frames[i] : start + i;
if (sprites[j] == null)

View File

@@ -699,8 +699,8 @@ namespace OpenRA.Mods.Common.Pathfinder
static CPos GetGridTopLeft(CPos cellInGrid, Grid mapBounds)
{
return new CPos(
((cellInGrid.X - mapBounds.TopLeft.X) / GridSize * GridSize) + mapBounds.TopLeft.X,
((cellInGrid.Y - mapBounds.TopLeft.Y) / GridSize * GridSize) + mapBounds.TopLeft.Y,
(cellInGrid.X - mapBounds.TopLeft.X) / GridSize * GridSize + mapBounds.TopLeft.X,
(cellInGrid.Y - mapBounds.TopLeft.Y) / GridSize * GridSize + mapBounds.TopLeft.Y,
cellInGrid.Layer);
}

View File

@@ -223,8 +223,8 @@ namespace OpenRA.Mods.Common.Traits
bool HasSufficientPowerForActor(ActorInfo actorInfo)
{
return playerPower == null || (actorInfo.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault)
.Sum(p => p.Amount) + playerPower.ExcessPower) >= baseBuilder.Info.MinimumExcessPower;
return playerPower == null || actorInfo.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault)
.Sum(p => p.Amount) + playerPower.ExcessPower >= baseBuilder.Info.MinimumExcessPower;
}
ActorInfo ChooseBuildingToBuild(ProductionQueue queue)

View File

@@ -186,11 +186,11 @@ namespace OpenRA.Mods.Common.Traits
var checkRadius = powerDecision.CoarseScanRadius;
var fineCheck = powerDecision.FineScanRadius;
for (var i = 0 - extendedRange; i <= (checkRadius + extendedRange); i += fineCheck)
for (var i = 0 - extendedRange; i <= checkRadius + extendedRange; i += fineCheck)
{
var x = checkPos.X + i;
for (var j = 0 - extendedRange; j <= (checkRadius + extendedRange); j += fineCheck)
for (var j = 0 - extendedRange; j <= checkRadius + extendedRange; j += fineCheck)
{
var y = checkPos.Y + j;
var pos = world.Map.CenterOfCell(new CPos(x, y));

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
public override int GetSelectionShares(Actor collector)
{
var pr = collector.Owner.PlayerActor.Trait<PlayerResources>();
if (info.Amount < 0 && (pr.Cash + pr.Resources) == 0)
if (info.Amount < 0 && pr.Cash + pr.Resources == 0)
return 0;
return base.GetSelectionShares(collector);

View File

@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets
var xAxisText = GetXAxisValueFormat().F(n / XAxisTicksPerLabel);
var xAxisTickTextWidth = labelFont.Measure(xAxisText).X;
var xLocation = x - (xAxisTickTextWidth / 2);
var xLocation = x - xAxisTickTextWidth / 2;
labelFont.DrawTextWithShadow(xAxisText, graphOrigin + new float2(xLocation, 2), Color.White, BackgroundColorDark, BackgroundColorLight, 1);
}

View File

@@ -58,8 +58,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
layerPreview.ResourceType = resourceType;
layerPreview.Bounds.Width = size.Width;
layerPreview.Bounds.Height = size.Height;
newResourcePreviewTemplate.Bounds.Width = size.Width + (layerPreview.Bounds.X * 2);
newResourcePreviewTemplate.Bounds.Height = size.Height + (layerPreview.Bounds.Y * 2);
newResourcePreviewTemplate.Bounds.Width = size.Width + layerPreview.Bounds.X * 2;
newResourcePreviewTemplate.Bounds.Height = size.Height + layerPreview.Bounds.Y * 2;
newResourcePreviewTemplate.IsVisible = () => true;
newResourcePreviewTemplate.GetTooltipText = () => resourceType;

View File

@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrollDown != null)
{
scrollDown.OnClick = palette.ScrollDown;
scrollDown.IsVisible = () => palette.TotalIconCount > (palette.MaxIconRowOffset * palette.Columns);
scrollDown.IsVisible = () => palette.TotalIconCount > palette.MaxIconRowOffset * palette.Columns;
scrollDown.IsDisabled = () => !palette.CanScrollDown;
}
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrollUp != null)
{
scrollUp.OnClick = palette.ScrollUp;
scrollUp.IsVisible = () => palette.TotalIconCount > (palette.MaxIconRowOffset * palette.Columns);
scrollUp.IsVisible = () => palette.TotalIconCount > palette.MaxIconRowOffset * palette.Columns;
scrollUp.IsDisabled = () => !palette.CanScrollUp;
}
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Check if icon heights exceed y resolution
var maxItemsHeight = screenHeight - sidebarProductionHeight;
var maxIconRowOffest = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
var maxIconRowOffest = maxItemsHeight / productionPalette.IconSize.Y - 1;
productionPalette.MaxIconRowOffset = Math.Min(maxIconRowOffest, productionPalette.MaximumRows);
}
}

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var power = actor.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault).Sum(i => i.Amount);
powerLabel.Text = power.ToString();
powerLabel.GetColor = () => ((pm.PowerProvided - pm.PowerDrained) >= -power || power > 0)
powerLabel.GetColor = () => (pm.PowerProvided - pm.PowerDrained >= -power || power > 0)
? Color.White : Color.Red;
powerLabel.Visible = power != 0;
powerIcon.Visible = power != 0;

View File

@@ -843,7 +843,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (game.State == (int)ServerState.WaitingPlayers && !filters.HasFlag(MPGameFilters.Waiting) && game.Players != 0)
return true;
if ((game.Players + game.Spectators) == 0 && !filters.HasFlag(MPGameFilters.Empty))
if (game.Players + game.Spectators == 0 && !filters.HasFlag(MPGameFilters.Empty))
return true;
if (!game.IsCompatible && !filters.HasFlag(MPGameFilters.Incompatible))

View File

@@ -372,7 +372,7 @@ namespace OpenRA.Mods.Common.Widgets
var thumbHeight = ContentHeight == 0 ? 0 : Math.Max(MinimumThumbSize, (int)(scrollbarHeight * Math.Min(rb.Height * 1f / ContentHeight, 1f)));
var oldOffset = currentListOffset;
var newOffset = currentListOffset + ((int)((lastMouseLocation.Y - mi.Location.Y) * (ContentHeight - rb.Height) * 1f / (scrollbarHeight - thumbHeight)));
var newOffset = currentListOffset + (int)((lastMouseLocation.Y - mi.Location.Y) * (ContentHeight - rb.Height) * 1f / (scrollbarHeight - thumbHeight));
newOffset = Math.Min(0, Math.Max(rb.Height - ContentHeight, newOffset));
SetListOffset(newOffset, false);

View File

@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Widgets
for (var i = 0; i < Ticks; i++)
{
var tickPos = new float2(
trackOrigin + (i * (trackRect.Width - (int)tick.Size.X) / (Ticks - 1)) - tick.Size.X / 2,
trackOrigin + i * (trackRect.Width - (int)tick.Size.X) / (Ticks - 1) - tick.Size.X / 2,
trackRect.Bottom);
WidgetUtils.DrawSprite(tick, tickPos);

View File

@@ -584,7 +584,7 @@ namespace OpenRA.Mods.Common.Widgets
var highlightEndX = font.Measure(apparentText.Substring(0, visualSelectionEndIndex)).X;
WidgetUtils.FillRectWithColor(
new Rectangle(textPos.X + highlightStartX, textPos.Y, highlightEndX - highlightStartX, Bounds.Height - (verticalMargin * 2)), TextColorHighlight);
new Rectangle(textPos.X + highlightStartX, textPos.Y, highlightEndX - highlightStartX, Bounds.Height - verticalMargin * 2), TextColorHighlight);
}
var color =