diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 481a066edb..b26156d9ae 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -159,7 +159,7 @@ namespace OpenRA static object ParseColor(string fieldName, Type fieldType, string value, MemberInfo field) { if (value != null && Color.TryParse(value, out var color)) - return color; + return color; return InvalidValueAction(value, fieldType, fieldName); } diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index 8ed57cdb02..13c94a7272 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -97,7 +97,7 @@ namespace OpenRA.Graphics public Sprite Add(Png src, float scale = 1f) { - var rect = Allocate(new Size(src.Width, src.Height), scale); + var rect = Allocate(new Size(src.Width, src.Height), scale); Util.FastCopyIntoSprite(rect, src); current.CommitBufferedData(); return rect; diff --git a/OpenRA.Game/Map/MapGrid.cs b/OpenRA.Game/Map/MapGrid.cs index b2457738a7..5af9ff279d 100644 --- a/OpenRA.Game/Map/MapGrid.cs +++ b/OpenRA.Game/Map/MapGrid.cs @@ -29,7 +29,10 @@ namespace OpenRA public readonly WVec[][] Polygons; public readonly WRot Orientation; - public CellRamp(MapGridType type, WRot orientation, RampCornerHeight tl = RampCornerHeight.Low, RampCornerHeight tr = RampCornerHeight.Low, RampCornerHeight br = RampCornerHeight.Low, RampCornerHeight bl = RampCornerHeight.Low, RampSplit split = RampSplit.Flat) + public CellRamp(MapGridType type, WRot orientation, + RampCornerHeight tl = RampCornerHeight.Low, RampCornerHeight tr = RampCornerHeight.Low, + RampCornerHeight br = RampCornerHeight.Low, RampCornerHeight bl = RampCornerHeight.Low, + RampSplit split = RampSplit.Flat) { Orientation = orientation; if (type == MapGridType.RectangularIsometric) diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index b8b8365be2..5878465147 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -77,14 +77,14 @@ namespace OpenRA.Support case '9': return CharClass.Digit; - // Fast-track normal whitespace + // Fast-track normal whitespace case ' ': case '\t': case '\n': case '\r': return CharClass.Whitespace; - // Should other whitespace be tested? + // Should other whitespace be tested? default: return char.IsWhiteSpace(c) ? CharClass.Whitespace : CharClass.Id; } diff --git a/OpenRA.Game/Traits/World/DebugVisualizations.cs b/OpenRA.Game/Traits/World/DebugVisualizations.cs index 90eaf6ab3c..d1b720c12a 100644 --- a/OpenRA.Game/Traits/World/DebugVisualizations.cs +++ b/OpenRA.Game/Traits/World/DebugVisualizations.cs @@ -31,8 +31,8 @@ namespace OpenRA.Traits get => depthBuffer; set { - depthBuffer = value; - depthBufferDirty = true; + depthBuffer = value; + depthBufferDirty = true; } } diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs index 91f16b72b8..bf32d35f37 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs @@ -20,7 +20,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits.Render { - public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires + public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires { public readonly string Sequence = "idle"; diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index 44f7d36694..5ad2d1eedb 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Cnc.Traits Facing = Facing == Left ? Right : Left; } - int MovementSpeed => OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); + int MovementSpeed => Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); public (CPos, SubCell)[] OccupiedCells() { return new[] { (TopLeft, SubCell.FullCell) }; } diff --git a/OpenRA.Mods.Common/FileFormats/Blast.cs b/OpenRA.Mods.Common/FileFormats/Blast.cs index d4f7011abb..b05ed0793f 100644 --- a/OpenRA.Mods.Common/FileFormats/Blast.cs +++ b/OpenRA.Mods.Common/FileFormats/Blast.cs @@ -277,8 +277,8 @@ namespace OpenRA.Mods.Common.FileFormats var left = 1; // one possible code of zero length for (var len = 1; len <= Blast.MAXBITS; len++) { - left <<= 1; // one more bit, double codes left - left -= Count[len]; // deduct count from possible codes + left <<= 1; // one more bit, double codes left + left -= Count[len]; // deduct count from possible codes if (left < 0) throw new InvalidDataException("over subscribed code set"); } diff --git a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs index bb73f2cb1a..2088319330 100644 --- a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs +++ b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs @@ -433,11 +433,11 @@ namespace OpenRA.Mods.Common.FileFormats { if (version <= 5) { - header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2 + i * 4; - header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + header.ReadUInt32(); + header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2 + i * 4; + header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + header.ReadUInt32(); } else - header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2 + i * 0x57; + header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2 + i * 0x57; var file = new FileDescriptor(header, i, cabDescriptorOffset + cabDescriptor.FileTableOffset, version); var path = $"{fileGroup.Name}\\{directories[file.DirectoryIndex].Name}\\{file.Filename}"; diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs index 9c00d84937..5be5401333 100644 --- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs @@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Graphics return; var displayValue = health.DisplayHP != health.HP ? (float?)health.DisplayHP / health.MaxHP : null; - DrawBar(wr, (float)health.HP / health.MaxHP, GetHealthColor(health), 0, displayValue, Color.OrangeRed); + DrawBar(wr, (float)health.HP / health.MaxHP, GetHealthColor(health), 0, displayValue, Color.OrangeRed); } if (DisplayExtra) diff --git a/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs b/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs index ab559ab3a7..3559ed751b 100644 --- a/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs +++ b/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Pathfinder void ReturnLayer(CellLayer layer) { lock (pool) - if (pool.Count < MaxPoolSize) + if (pool.Count < MaxPoolSize) pool.Push(layer); } diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 054e68c4fb..897be9b123 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -573,7 +573,7 @@ namespace OpenRA.Mods.Common.Projectiles && (predClfDist <= loopRadius * (1024 - WAngle.FromFacing(vFacing).Sin()) / 1024 // When evaluating this the incline will be *not* be hit before vertical facing attains 64 - // At current speed target too close to hit without passing it by + // At current speed target too close to hit without passing it by || relTarHorDist <= 2 * loopRadius * (2048 - WAngle.FromFacing(vFacing).Sin()) / 1024 - predClfDist)) || (desiredVFacing == 0 // Upper part of incline surmounting manoeuvre @@ -630,7 +630,8 @@ namespace OpenRA.Mods.Common.Projectiles if (targetPassedBy) desiredVFacing = desiredVFacing.Clamp(-info.VerticalRateOfTurn.Facing, info.VerticalRateOfTurn.Facing); else if (lastHt == 0) - { // Before the target is passed by, missile speed should be changed + { + // Before the target is passed by, missile speed should be changed // Target's height above loop's center var tarHgt = (loopRadius * WAngle.FromFacing(vFacing).Cos() / 1024 - System.Math.Abs(relTarHgt)).Clamp(0, loopRadius); diff --git a/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs b/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs index d77bd93ca8..66c36b128e 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits public static IEnumerable<(CPos Cell, Actor Actor)> GetLineBuildCells(World world, CPos cell, ActorInfo ai, BuildingInfo bi, Player owner) { var lbi = ai.TraitInfo(); - var topLeft = cell; // 1x1 assumption! + var topLeft = cell; // 1x1 assumption! if (world.IsCellBuildable(topLeft, ai, bi)) yield return (topLeft, null); diff --git a/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs b/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs index bbf932040f..bf0f264791 100644 --- a/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs +++ b/OpenRA.Mods.Common/Traits/Player/HarvesterAttackNotifier.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits // Don't track healing if (e.Damage.Value < 0) - return; + return; // Only track last hit against our harvesters if (!self.Info.HasTraitInfo()) diff --git a/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs index 892542e991..420c990048 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs @@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits.Render return; if (isSmoking) return; - if (e.Damage.Value < 0) return; /* getting healed */ + if (e.Damage.Value < 0) return; /* getting healed */ if (e.DamageState < info.MinimumDamageState) return; if (e.DamageState > info.MaximumDamageState) return; diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index 6049500912..6b7906ce3c 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits .ToDictionary(t => t.Id, t => Game.ModData.Translation.GetString(t.Name)); if (techLevels.Count > 0) - yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder, + yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder, techLevels, TechLevel, TechLevelDropdownLocked); var gameSpeeds = Game.ModData.Manifest.Get(); diff --git a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs index 2c292f64d2..d9e395aee1 100644 --- a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs @@ -67,12 +67,12 @@ namespace OpenRA.Mods.Common.Widgets { var c = (int*)cc; for (var s = 0; s < 256; s++) - for (var h = 0; h < 256; h++) - { - #pragma warning disable IDE0047 - (*(c + s * 256 + h)) = Color.FromAhsv(h / 255f, 1 - s / 255f, V).ToArgb(); - #pragma warning restore IDE0047 - } + for (var h = 0; h < 256; h++) + { + #pragma warning disable IDE0047 + (*(c + s * 256 + h)) = Color.FromAhsv(h / 255f, 1 - s / 255f, V).ToArgb(); + #pragma warning restore IDE0047 + } } } diff --git a/OpenRA.Mods.Common/Widgets/LineGraphWidget.cs b/OpenRA.Mods.Common/Widgets/LineGraphWidget.cs index 8e32d69085..2702fa88cf 100644 --- a/OpenRA.Mods.Common/Widgets/LineGraphWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LineGraphWidget.cs @@ -174,7 +174,9 @@ namespace OpenRA.Mods.Common.Widgets } // Draw x axis - axisFont.DrawTextWithShadow(xAxisLabel, new float2(graphOrigin.X, origin.Y) + new float2(width / 2 - xAxisLabelSize.X / 2, -(xAxisLabelSize.Y + Padding)), Color.White, BackgroundColorDark, BackgroundColorLight, 1); + axisFont.DrawTextWithShadow(xAxisLabel, + new float2(graphOrigin.X, origin.Y) + new float2(width / 2 - xAxisLabelSize.X / 2, -(xAxisLabelSize.Y + Padding)), + Color.White, BackgroundColorDark, BackgroundColorLight, 1); // TODO: make this stuff not draw outside of the RenderBounds for (int n = pointStart, x = 0; n <= pointEnd; n++, x += xStep) @@ -186,11 +188,15 @@ namespace OpenRA.Mods.Common.Widgets var xAxisText = GetXAxisValueFormat().F(n / XAxisTicksPerLabel); var xAxisTickTextWidth = labelFont.Measure(xAxisText).X; var xLocation = x - xAxisTickTextWidth / 2; - labelFont.DrawTextWithShadow(xAxisText, graphOrigin + new float2(xLocation, 2), Color.White, BackgroundColorDark, BackgroundColorLight, 1); + labelFont.DrawTextWithShadow(xAxisText, + graphOrigin + new float2(xLocation, 2), + Color.White, BackgroundColorDark, BackgroundColorLight, 1); } // Draw y axis - axisFont.DrawTextWithShadow(yAxisLabel, new float2(origin.X, graphOrigin.Y) + new float2(5 - axisFont.TopOffset, -(height / 2 - yAxisLabelSize.X / 2)), Color.White, BackgroundColorDark, BackgroundColorLight, 1, (float)Math.PI / 2); + axisFont.DrawTextWithShadow(yAxisLabel, + new float2(origin.X, graphOrigin.Y) + new float2(5 - axisFont.TopOffset, -(height / 2 - yAxisLabelSize.X / 2)), + Color.White, BackgroundColorDark, BackgroundColorLight, 1, (float)Math.PI / 2); for (var y = GetDisplayFirstYAxisValue() ? 0 : yStep; y <= height; y += yStep) { @@ -202,7 +208,9 @@ namespace OpenRA.Mods.Common.Widgets var yLocation = y + (textWidth.Y + labelFont.TopOffset) / 2; - labelFont.DrawTextWithShadow(text, graphOrigin + new float2(-(textWidth.X + 3), -yLocation), Color.White, BackgroundColorDark, BackgroundColorLight, 1); + labelFont.DrawTextWithShadow(text, + graphOrigin + new float2(-(textWidth.X + 3), -yLocation), + Color.White, BackgroundColorDark, BackgroundColorLight, 1); } // Bottom line diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs index a242c07e0c..856abfad0e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs @@ -435,7 +435,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic void CreateResumeButton() { - var button = AddButton("RESUME", world.IsGameOver ? ReturnToMap : Resume); + var button = AddButton("RESUME", world.IsGameOver ? ReturnToMap : Resume); button.Key = modData.Hotkeys["escape"]; button.OnClick = CloseMenu; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs index fe3a2275c2..3e61d767a5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Server does not provide the total file length if (map.DownloadPercentage == 0) - modData.Translation.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024)); + modData.Translation.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024)); return modData.Translation.GetString(DownloadingPercentage, Translation.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage)); }; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 5f24179a94..a2e11b6746 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -378,7 +378,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = replays.Select(r => r.GameInfo.MapTitle).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); options.Sort(StringComparer.OrdinalIgnoreCase); - options.Insert(0, null); // no filter + options.Insert(0, null); // no filter var anyText = ddb.GetText(); ddb.GetText = () => string.IsNullOrEmpty(filter.MapName) ? anyText : filter.MapName; @@ -406,7 +406,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = replays.SelectMany(r => r.GameInfo.Players.Select(p => p.Name)).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); options.Sort(StringComparer.OrdinalIgnoreCase); - options.Insert(0, null); // no filter + options.Insert(0, null); // no filter var anyText = ddb.GetText(); ddb.GetText = () => string.IsNullOrEmpty(filter.PlayerName) ? anyText : filter.PlayerName; @@ -438,7 +438,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic .SelectMany(r => r.GameInfo.Players.Select(p => p.FactionName).Where(n => !string.IsNullOrEmpty(n))) .Distinct(StringComparer.OrdinalIgnoreCase).ToList(); options.Sort(StringComparer.OrdinalIgnoreCase); - options.Insert(0, null); // no filter + options.Insert(0, null); // no filter var anyText = ddb.GetText(); ddb.GetText = () => string.IsNullOrEmpty(filter.Faction) ? anyText : filter.Faction; diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index 78c2b14da4..557772ff9e 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -127,7 +127,7 @@ namespace OpenRA.Platforms.Default [DllImport("libX11")] static extern IntPtr XInternAtom(IntPtr display, string atom_name, bool only_if_exists); - [DllImport("libX11", CharSet=CharSet.Ansi)] + [DllImport("libX11", CharSet = CharSet.Ansi)] static extern int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, IntPtr mode, string data, int elements); [DllImport("libX11")]