From ebf2ce32c07aa6ffbb5460d0e45975c4aaef8b4b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 8 Jun 2019 15:04:36 +0100 Subject: [PATCH] Make sure braces for multi-line statements are on their own lines. --- OpenRA.Game/Game.cs | 3 +- OpenRA.Game/Graphics/Util.cs | 11 ++++--- OpenRA.Game/Manifest.cs | 7 +++-- OpenRA.Game/Map/Map.cs | 3 +- OpenRA.Game/Network/UPnP.cs | 10 +++++-- OpenRA.Game/Support/PerfHistory.cs | 7 +++-- .../Activities/VoxelHarvesterDockSequence.cs | 6 ++-- OpenRA.Mods.Cnc/FileFormats/Blowfish.cs | 6 ++-- OpenRA.Mods.Cnc/FileFormats/VxlReader.cs | 6 ++-- OpenRA.Mods.Cnc/Graphics/Voxel.cs | 15 ++++++---- .../UtilityCommands/ImportTSMapCommand.cs | 16 +++++++--- OpenRA.Mods.Common/ColorValidator.cs | 6 ++-- OpenRA.Mods.Common/FileFormats/Blast.cs | 19 +++++++----- .../InstallShieldCABCompression.cs | 6 ++-- .../FileFormats/LZOCompression.cs | 7 +++-- .../LoadScreens/ModContentLoadScreen.cs | 8 ++--- OpenRA.Mods.Common/Pathfinder/PathGraph.cs | 3 +- OpenRA.Mods.Common/Projectiles/AreaBeam.cs | 9 ++++-- .../Traits/Buildings/RallyPoint.cs | 9 ++++-- OpenRA.Mods.Common/Traits/Cargo.cs | 7 +++-- OpenRA.Mods.Common/Traits/Harvester.cs | 7 +++-- .../PaletteEffects/CloakPaletteEffect.cs | 3 +- .../Traits/Render/RenderVoxels.cs | 11 ++++--- .../Traits/World/ActorSpawnManager.cs | 3 +- .../Traits/World/WeatherOverlay.cs | 3 +- .../20181215/DefineNotificationDefaults.cs | 30 ++++++++++++------- .../ExtractZeroBraneStudioLuaAPI.cs | 6 ++-- .../UtilityCommands/ImportLegacyMapCommand.cs | 3 +- .../Widgets/Logic/DisconnectWatcherLogic.cs | 3 +- .../Widgets/Logic/Lobby/LobbyLogic.cs | 10 +++++-- .../Widgets/Logic/Lobby/LobbyUtils.cs | 13 +++++--- .../Widgets/Logic/ReplayBrowserLogic.cs | 5 ++-- .../Widgets/Logic/ServerCreationLogic.cs | 7 +++-- OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs | 3 +- 34 files changed, 180 insertions(+), 91 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 3761b86356..a89b11c371 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -201,7 +201,8 @@ namespace OpenRA // Reseed the RNG so this isn't an exact repeat of the last game lobbyInfo.GlobalSettings.RandomSeed = CosmeticRandom.Next(); - var orders = new[] { + var orders = new[] + { Order.Command("sync_lobby {0}".F(lobbyInfo.Serialize())), Order.Command("startgame") }; diff --git a/OpenRA.Game/Graphics/Util.cs b/OpenRA.Game/Graphics/Util.cs index ccee8aba85..bc849d6b10 100644 --- a/OpenRA.Game/Graphics/Util.cs +++ b/OpenRA.Game/Graphics/Util.cs @@ -320,7 +320,7 @@ namespace OpenRA.Graphics public static float[] MakeFloatMatrix(Int32Matrix4x4 imtx) { var multipler = 1f / imtx.M44; - return new float[] + return new[] { imtx.M11 * multipler, imtx.M12 * multipler, @@ -352,13 +352,16 @@ namespace OpenRA.Graphics var iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 }; // Vectors to opposing corner - var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue, - float.MinValue, float.MinValue, float.MinValue }; + var ret = new[] + { + float.MaxValue, float.MaxValue, float.MaxValue, + float.MinValue, float.MinValue, float.MinValue + }; // Transform vectors and find new bounding box for (var i = 0; i < 8; i++) { - var vec = new float[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 }; + var vec = new[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 }; var tvec = MatrixVectorMultiply(mtx, vec); ret[0] = Math.Min(ret[0], tvec[0] / tvec[3]); diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index 6865de97cd..a68190396a 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -72,11 +72,14 @@ namespace OpenRA public readonly string[] SpriteFormats = { }; public readonly string[] PackageFormats = { }; - readonly string[] reservedModuleNames = { "Metadata", "Folders", "MapFolders", "Packages", "Rules", + readonly string[] reservedModuleNames = + { + "Metadata", "Folders", "MapFolders", "Packages", "Rules", "Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons", "Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys", "ServerTraits", "LoadScreen", "Fonts", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", - "RequiresMods", "PackageFormats" }; + "RequiresMods", "PackageFormats" + }; readonly TypeDictionary modules = new TypeDictionary(); readonly Dictionary yaml; diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 20c8ab8065..cf9cdd1200 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -1079,7 +1079,8 @@ namespace OpenRA var v = rand.Next(Bounds.Top, Bounds.Bottom); cells = Unproject(new PPos(u, v)); - } while (!cells.Any()); + } + while (!cells.Any()); return cells.Random(rand).ToCPos(Grid.Type); } diff --git a/OpenRA.Game/Network/UPnP.cs b/OpenRA.Game/Network/UPnP.cs index 613a0360a8..3fbba72987 100644 --- a/OpenRA.Game/Network/UPnP.cs +++ b/OpenRA.Game/Network/UPnP.cs @@ -28,8 +28,14 @@ namespace OpenRA.Network static bool initialized; public static IPAddress ExternalIP { get; private set; } - public static UPnPStatus Status { get { return initialized ? natDevice != null ? - UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled; } } + public static UPnPStatus Status + { + get + { + return initialized ? natDevice != null ? + UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled; + } + } public static async Task DiscoverNatDevices(int timeout) { diff --git a/OpenRA.Game/Support/PerfHistory.cs b/OpenRA.Game/Support/PerfHistory.cs index bb65091931..819540773c 100644 --- a/OpenRA.Game/Support/PerfHistory.cs +++ b/OpenRA.Game/Support/PerfHistory.cs @@ -15,11 +15,14 @@ namespace OpenRA.Support { public static class PerfHistory { - static readonly Color[] Colors = { Color.Red, Color.Green, + static readonly Color[] Colors = + { + Color.Red, Color.Green, Color.Orange, Color.Yellow, Color.Fuchsia, Color.Lime, Color.LightBlue, Color.Blue, - Color.White, Color.Teal }; + Color.White, Color.Teal + }; static int nextColor; diff --git a/OpenRA.Mods.Cnc/Activities/VoxelHarvesterDockSequence.cs b/OpenRA.Mods.Cnc/Activities/VoxelHarvesterDockSequence.cs index 9ba128d994..5018571173 100644 --- a/OpenRA.Mods.Cnc/Activities/VoxelHarvesterDockSequence.cs +++ b/OpenRA.Mods.Cnc/Activities/VoxelHarvesterDockSequence.cs @@ -34,7 +34,8 @@ namespace OpenRA.Mods.Cnc.Activities if (spriteOverlay != null && !spriteOverlay.Visible) { spriteOverlay.Visible = true; - spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () => { + spriteOverlay.WithOffset.Animation.PlayThen(spriteOverlay.Info.Sequence, () => + { dockingState = DockingState.Loop; spriteOverlay.Visible = false; }); @@ -52,7 +53,8 @@ namespace OpenRA.Mods.Cnc.Activities if (spriteOverlay != null && !spriteOverlay.Visible) { spriteOverlay.Visible = true; - spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () => { + spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () => + { dockingState = DockingState.Complete; body.Docked = false; spriteOverlay.Visible = false; diff --git a/OpenRA.Mods.Cnc/FileFormats/Blowfish.cs b/OpenRA.Mods.Cnc/FileFormats/Blowfish.cs index 60edf4b4c5..d9d481ad48 100644 --- a/OpenRA.Mods.Cnc/FileFormats/Blowfish.cs +++ b/OpenRA.Mods.Cnc/FileFormats/Blowfish.cs @@ -130,7 +130,8 @@ namespace OpenRA.Mods.Cnc.FileFormats return i; } - uint[] lookupMfromP = new uint[] { + uint[] lookupMfromP = + { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, @@ -138,7 +139,8 @@ namespace OpenRA.Mods.Cnc.FileFormats 0x9216d5d9, 0x8979fb1b }; - uint[,] lookupMfromS = new uint[,] { + uint[,] lookupMfromS = + { { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, diff --git a/OpenRA.Mods.Cnc/FileFormats/VxlReader.cs b/OpenRA.Mods.Cnc/FileFormats/VxlReader.cs index 2a4e60caf6..c8f2ebb25e 100644 --- a/OpenRA.Mods.Cnc/FileFormats/VxlReader.cs +++ b/OpenRA.Mods.Cnc/FileFormats/VxlReader.cs @@ -66,7 +66,8 @@ namespace OpenRA.Mods.Cnc.FileFormats z += count; l.VoxelCount += count; s.Seek(2 * count + 1, SeekOrigin.Current); - } while (z < l.Size[2]); + } + while (z < l.Size[2]); } // Read the data @@ -99,7 +100,8 @@ namespace OpenRA.Mods.Cnc.FileFormats // Skip duplicate count s.ReadUInt8(); - } while (z < l.Size[2]); + } + while (z < l.Size[2]); } } diff --git a/OpenRA.Mods.Cnc/Graphics/Voxel.cs b/OpenRA.Mods.Cnc/Graphics/Voxel.cs index 986742a07e..b3882b9b6f 100644 --- a/OpenRA.Mods.Cnc/Graphics/Voxel.cs +++ b/OpenRA.Mods.Cnc/Graphics/Voxel.cs @@ -101,18 +101,21 @@ namespace OpenRA.Mods.Cnc.Graphics public float[] Bounds(uint frame) { - var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue, - float.MinValue, float.MinValue, float.MinValue }; + var ret = new[] + { + float.MaxValue, float.MaxValue, float.MaxValue, + float.MinValue, float.MinValue, float.MinValue + }; for (uint j = 0; j < limbs; j++) { var l = limbData[j]; - var b = new float[] + var b = new[] { 0, 0, 0, - (l.Bounds[3] - l.Bounds[0]), - (l.Bounds[4] - l.Bounds[1]), - (l.Bounds[5] - l.Bounds[2]) + l.Bounds[3] - l.Bounds[0], + l.Bounds[4] - l.Bounds[1], + l.Bounds[5] - l.Bounds[2] }; // Calculate limb bounding box diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs index 141582160d..a1bab26785 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs @@ -206,12 +206,19 @@ namespace OpenRA.Mods.Cnc.UtilityCommands static readonly Dictionary ResourceFromOverlay = new Dictionary() { // "tib" - Regular Tiberium - { 0x01, new byte[] { 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79 } + { + 0x01, new byte[] + { + 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79 + } }, // "btib" - Blue Tiberium - { 0x02, new byte[] { 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + { + 0x02, new byte[] + { + 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, // Should be "tib2" 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, @@ -219,7 +226,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands // Should be "tib3" 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, - 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6 } + 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6 + } }, // Veins diff --git a/OpenRA.Mods.Common/ColorValidator.cs b/OpenRA.Mods.Common/ColorValidator.cs index bd71523b88..ee9c74ba84 100644 --- a/OpenRA.Mods.Common/ColorValidator.cs +++ b/OpenRA.Mods.Common/ColorValidator.cs @@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common var s = float2.Lerp(HsvSaturationRange[0], HsvSaturationRange[1], random.NextFloat()); var v = float2.Lerp(HsvValueRange[0], HsvValueRange[1], random.NextFloat()); color = Color.FromAhsv(h, s, v); - } while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError)); + } + while (!IsValid(color, out forbidden, terrainColors, playerColors, ignoreError)); return color; } @@ -172,7 +173,8 @@ namespace OpenRA.Mods.Common color = Color.FromArgb(r, g, b); attempt++; - } while (!IsValid(color, allForbidden, out forbiddenColor)); + } + while (!IsValid(color, allForbidden, out forbiddenColor)); return color; } diff --git a/OpenRA.Mods.Common/FileFormats/Blast.cs b/OpenRA.Mods.Common/FileFormats/Blast.cs index 05fdc700b9..01863b7929 100644 --- a/OpenRA.Mods.Common/FileFormats/Blast.cs +++ b/OpenRA.Mods.Common/FileFormats/Blast.cs @@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.FileFormats public static readonly int MAXBITS = 13; // maximum code length public static readonly int MAXWIN = 4096; // maximum window size - static byte[] litlen = new byte[] { + static byte[] litlen = + { 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8, 9, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24, @@ -39,19 +40,21 @@ namespace OpenRA.Mods.Common.FileFormats }; // bit lengths of length codes 0..15 - static byte[] lenlen = new byte[] { 2, 35, 36, 53, 38, 23 }; + static byte[] lenlen = { 2, 35, 36, 53, 38, 23 }; // bit lengths of distance codes 0..63 - static byte[] distlen = new byte[] { 2, 20, 53, 230, 247, 151, 248 }; + static byte[] distlen = { 2, 20, 53, 230, 247, 151, 248 }; // base for length codes - static short[] lengthbase = new short[] { + static short[] lengthbase = + { 3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24, 40, 72, 136, 264 }; // extra bits for length codes - static byte[] extra = new byte[] { + static byte[] extra = + { 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8 }; @@ -155,7 +158,8 @@ namespace OpenRA.Mods.Common.FileFormats if (onProgress != null) onProgress(input.Position - inputStart, output.Position - outputStart); } - } while (len != 0); + } + while (len != 0); } else { @@ -173,7 +177,8 @@ namespace OpenRA.Mods.Common.FileFormats onProgress(input.Position - inputStart, output.Position - outputStart); } } - } while (true); + } + while (true); } // Decode a code using Huffman table h. diff --git a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs index deb6444076..5ada7338f2 100644 --- a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs +++ b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs @@ -251,7 +251,8 @@ namespace OpenRA.Mods.Common.FileFormats } inf.Reset(); - } while (toExtract > 0); + } + while (toExtract > 0); } else { @@ -262,7 +263,8 @@ namespace OpenRA.Mods.Common.FileFormats toExtract -= remainingInArchive; output.Write(GetBytes(remainingInArchive), 0, (int)remainingInArchive); - } while (toExtract > 0); + } + while (toExtract > 0); } } diff --git a/OpenRA.Mods.Common/FileFormats/LZOCompression.cs b/OpenRA.Mods.Common/FileFormats/LZOCompression.cs index 2daa481f87..43082ba37e 100644 --- a/OpenRA.Mods.Common/FileFormats/LZOCompression.cs +++ b/OpenRA.Mods.Common/FileFormats/LZOCompression.cs @@ -226,7 +226,9 @@ namespace OpenRA.Mods.Common.FileFormats { *(uint*)op = *(uint*)mPos; op += 4; mPos += 4; t -= 4; - } while (t >= 4); + } + while (t >= 4); + if (t > 0) do { *op++ = *mPos++; } while (--t > 0); } @@ -252,7 +254,8 @@ namespace OpenRA.Mods.Common.FileFormats } t = *ip++; - } while (true); + } + while (true); } eof_found: diff --git a/OpenRA.Mods.Common/LoadScreens/ModContentLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/ModContentLoadScreen.cs index f80eebd0a6..5809a795cf 100644 --- a/OpenRA.Mods.Common/LoadScreens/ModContentLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/ModContentLoadScreen.cs @@ -63,9 +63,7 @@ namespace OpenRA.Mods.Common.LoadScreens { var widgetArgs = new WidgetArgs { - { "continueLoading", () => - Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) - }, + { "continueLoading", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) }, { "mod", selectedMod }, { "content", content }, }; @@ -78,9 +76,7 @@ namespace OpenRA.Mods.Common.LoadScreens { { "mod", selectedMod }, { "content", content }, - { "onCancel", () => - Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) - } + { "onCancel", () => Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) } }; Ui.OpenWindow("CONTENT_PANEL", widgetArgs); diff --git a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs index dc2604b361..75820d4d5b 100644 --- a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs +++ b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs @@ -116,7 +116,8 @@ namespace OpenRA.Mods.Common.Pathfinder // For horizontal/vertical directions, the set is the three cells 'ahead'. For diagonal directions, the set // is the three cells ahead, plus the two cells to the side, which we cannot exclude without knowing if // the cell directly between them and our parent is passable. - static readonly CVec[][] DirectedNeighbors = { + static readonly CVec[][] DirectedNeighbors = + { new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(-1, 0), new CVec(-1, 1) }, new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1) }, new[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(1, 0), new CVec(1, 1) }, diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index b72bf63729..f617f6b133 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -99,8 +99,13 @@ namespace OpenRA.Mods.Common.Projectiles bool isTailTravelling; bool continueTracking = true; - bool IsBeamComplete { get { return !isHeadTravelling && headTicks >= length && - !isTailTravelling && tailTicks >= length; } } + bool IsBeamComplete + { + get + { + return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length; + } + } public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs index c71fb44bcc..17742460cd 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs @@ -86,8 +86,13 @@ namespace OpenRA.Mods.Common.Traits public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) { if (order.OrderID == OrderID) - return new Order(order.OrderID, self, target, false) { SuppressVisualFeedback = true, - ExtraData = ((RallyPointOrderTargeter)order).ForceSet ? ForceSet : 0 }; + { + return new Order(order.OrderID, self, target, false) + { + SuppressVisualFeedback = true, + ExtraData = ((RallyPointOrderTargeter)order).ForceSet ? ForceSet : 0 + }; + } return null; } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 30e4e63c55..2ffbed323d 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -163,8 +163,11 @@ namespace OpenRA.Mods.Common.Traits public IEnumerable Orders { - get { yield return new DeployOrderTargeter("Unload", 10, - () => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor); } + get + { + yield return new DeployOrderTargeter("Unload", 10, + () => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor); + } } public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index a9a2ff4f30..d866237c59 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -192,11 +192,12 @@ namespace OpenRA.Mods.Common.Traits // Find all refineries and their occupancy count: var refs = self.World.ActorsWithTrait() .Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor)) - .Select(r => new { + .Select(r => new + { Location = r.Actor.Location + r.Trait.DeliveryOffset, Actor = r.Actor, - Occupancy = self.World.ActorsHavingTrait(h => h.LinkedProc == r.Actor).Count() }) - .ToDictionary(r => r.Location); + Occupancy = self.World.ActorsHavingTrait(h => h.LinkedProc == r.Actor).Count() + }).ToDictionary(r => r.Location); // Start a search from each refinery's delivery location: List path; diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/CloakPaletteEffect.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/CloakPaletteEffect.cs index da64c51bdf..f03389426d 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/CloakPaletteEffect.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/CloakPaletteEffect.cs @@ -22,7 +22,8 @@ namespace OpenRA.Mods.Common.Traits float t = 0; string paletteName = "cloak"; - Color[] colors = { + Color[] colors = + { Color.FromArgb(55, 205, 205, 220), Color.FromArgb(120, 205, 205, 230), Color.FromArgb(192, 180, 180, 255), diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs index 5d656064d5..cfd21f03f1 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs @@ -147,10 +147,13 @@ namespace OpenRA.Mods.Common.Traits.Render initializePalettes = false; } - return new IRenderable[] { new ModelRenderable( - components, self.CenterPosition, 0, camera, Info.Scale, - lightSource, Info.LightAmbientColor, Info.LightDiffuseColor, - colorPalette, normalsPalette, shadowPalette) }; + return new IRenderable[] + { + new ModelRenderable( + components, self.CenterPosition, 0, camera, Info.Scale, + lightSource, Info.LightAmbientColor, Info.LightDiffuseColor, + colorPalette, normalsPalette, shadowPalette) + }; } IEnumerable IRender.ScreenBounds(Actor self, WorldRenderer wr) diff --git a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs index 4124560f13..b9623b70e9 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs @@ -83,7 +83,8 @@ namespace OpenRA.Mods.Common.Traits // Always spawn at least one actor, plus // however many needed to reach the minimum. SpawnActor(self, spawnPoint); - } while (actorsPresent < info.Minimum); + } + while (actorsPresent < info.Minimum); } WPos SpawnActor(Actor self, Actor spawnPoint) diff --git a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs index 1481f2e312..35634a3c55 100644 --- a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs @@ -56,7 +56,8 @@ namespace OpenRA.Mods.Common.Traits public readonly float[] SwingAmplitude = { 1.0f, 1.5f }; [Desc("The randomly selected rgb(a) hex colors for the particles. Use this order: rrggbb[aa], rrggbb[aa], ...")] - public readonly Color[] ParticleColors = { + public readonly Color[] ParticleColors = + { Color.FromArgb(236, 236, 236), Color.FromArgb(228, 228, 228), Color.FromArgb(208, 208, 208), diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20181215/DefineNotificationDefaults.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20181215/DefineNotificationDefaults.cs index 27e9028e2b..b3103a4ca1 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20181215/DefineNotificationDefaults.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20181215/DefineNotificationDefaults.cs @@ -42,42 +42,52 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules TraitWrapper[] traits = { - new TraitWrapper("PrimaryBuilding", new Dictionary { + new TraitWrapper("PrimaryBuilding", new Dictionary + { { "SelectionNotification", "PrimaryBuildingSelected" } }), - new TraitWrapper("RepairableBuilding", new Dictionary { + new TraitWrapper("RepairableBuilding", new Dictionary + { { "RepairingNotification", "Repairing" } }), - new TraitWrapper("RepairsUnits", new Dictionary { + new TraitWrapper("RepairsUnits", new Dictionary + { { "StartRepairingNotification", "Repairing" } }), - new TraitWrapper("GainsExperience", new Dictionary { + new TraitWrapper("GainsExperience", new Dictionary + { { "LevelUpNotification", "LevelUp" } }), - new TraitWrapper("MissionObjectives", new Dictionary { + new TraitWrapper("MissionObjectives", new Dictionary + { { "WinNotification", "Win" }, { "LoseNotification", "Lose" }, { "LeaveNotification", "Leave" } }), - new TraitWrapper("PlaceBuilding", new Dictionary { + new TraitWrapper("PlaceBuilding", new Dictionary + { { "NewOptionsNotification", "NewOptions" }, { "CannotPlaceNotification", "BuildingCannotPlaceAudio" } }), - new TraitWrapper("PlayerResources", new Dictionary { + new TraitWrapper("PlayerResources", new Dictionary + { { "CashTickUpNotification", "CashTickUp" }, { "CashTickDownNotification", "CashTickDown" } }), - new TraitWrapper("ProductionQueue", new Dictionary { + new TraitWrapper("ProductionQueue", new Dictionary + { { "ReadyAudio", "UnitReady" }, { "BlockedAudio", "NoBuild" }, { "QueuedAudio", "Training" }, { "OnHoldAudio", "OnHold" }, { "CancelledAudio", "Cancelled" } }), - new TraitWrapper("PowerManager", new Dictionary { + new TraitWrapper("PowerManager", new Dictionary + { { "SpeechNotification", "LowPower" } }), - new TraitWrapper("Infiltrates", new Dictionary { + new TraitWrapper("Infiltrates", new Dictionary + { { "Notification", "BuildingInfiltrated" } }) }; diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs index 11ef5d7d22..625da19c3d 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs @@ -89,11 +89,13 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine(" },"); } - var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing().SelectMany(cg => { + var actorProperties = Game.ModData.ObjectCreator.GetTypesImplementing().SelectMany(cg => + { return ScriptMemberWrapper.WrappableMembers(cg); }); - var scriptProperties = Game.ModData.ObjectCreator.GetTypesImplementing().SelectMany(cg => { + var scriptProperties = Game.ModData.ObjectCreator.GetTypesImplementing().SelectMany(cg => + { return ScriptMemberWrapper.WrappableMembers(cg); }); diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index da12be176d..240eb90460 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -403,7 +403,8 @@ namespace OpenRA.Mods.Common.UtilityCommands var actorType = parts[1].ToLowerInvariant(); - var actor = new ActorReference(actorType) { + var actor = new ActorReference(actorType) + { new LocationInit(ParseActorLocation(actorType, loc)), new OwnerInit(parts[0]), }; diff --git a/OpenRA.Mods.Common/Widgets/Logic/DisconnectWatcherLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/DisconnectWatcherLogic.cs index 3c4055ffd6..86bf559533 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/DisconnectWatcherLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/DisconnectWatcherLogic.cs @@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected) return; - Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs { + Game.RunAfterTick(() => Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs + { { "orderManager", orderManager }, { "onAbort", null }, { "onRetry", null } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 7d2dae41b8..a4be9bcbee 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -127,10 +127,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic { { "orderManager", orderManager }, { "getMap", (Func)(() => map) }, - { "onMouseDown", (Action)((preview, mapPreview, mi) => - LobbyUtils.SelectSpawnPoint(orderManager, preview, mapPreview, mi)) + { + "onMouseDown", (Action)((preview, mapPreview, mi) => + LobbyUtils.SelectSpawnPoint(orderManager, preview, mapPreview, mi)) + }, + { + "getSpawnOccupants", (Func>)(mapPreview => + LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, mapPreview)) }, - { "getSpawnOccupants", (Func>)(mapPreview => LobbyUtils.GetSpawnOccupants(orderManager.LobbyInfo, mapPreview)) }, { "showUnoccupiedSpawnpoints", true }, }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index c0e7934d4a..ba84775006 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -40,11 +40,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client, OrderManager orderManager, MapPreview map) { - var options = new Dictionary>() { { "Slot", new List() + var options = new Dictionary> { - new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => (!slot.Closed && client == null)), - new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed) - } } }; + { + "Slot", new List + { + new SlotDropDownOption("Open", "slot_open " + slot.PlayerReference, () => (!slot.Closed && client == null)), + new SlotDropDownOption("Closed", "slot_close " + slot.PlayerReference, () => slot.Closed) + } + } + }; var bots = new List(); if (slot.AllowBots) diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 69fe99fb85..c394d1f30f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -81,8 +81,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic { "orderManager", null }, { "getMap", (Func)(() => map) }, { "onMouseDown", (Action)((preview, mapPreview, mi) => { }) }, - { "getSpawnOccupants", (Func>)(mapPreview => - LobbyUtils.GetSpawnOccupants(selectedReplay.GameInfo.Players, mapPreview)) + { + "getSpawnOccupants", (Func>)(mapPreview => + LobbyUtils.GetSpawnOccupants(selectedReplay.GameInfo.Players, mapPreview)) }, { "showUnoccupiedSpawnpoints", false }, }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs index cccd431dde..9fe232506b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs @@ -204,11 +204,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic catch (System.Net.Sockets.SocketException e) { var message = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort); - if (e.ErrorCode == 10048) { // AddressAlreadyInUse (WSAEADDRINUSE) + + // AddressAlreadyInUse (WSAEADDRINUSE) + if (e.ErrorCode == 10048) message += "\nCheck if the port is already being used."; - } else { + else message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode); - } ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back"); return; diff --git a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs index dca6d12b04..b1cea1d797 100644 --- a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs +++ b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs @@ -199,7 +199,8 @@ namespace OpenRA.Test Is.EqualTo(878)); // Plus shaped dodecagon - shape = new PolygonShape(new int2[] { + shape = new PolygonShape(new[] + { new int2(-511, -1535), new int2(511, -1535), new int2(511, -511), new int2(1535, -511), new int2(1535, 511), new int2(511, 511), new int2(511, 1535), new int2(-511, 1535), new int2(-511, 511), new int2(-1535, 511), new int2(-1535, -511), new int2(-511, -511)