From 582b6635ffb53bb039a4c20eb8349e78b193472a Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Thu, 12 Feb 2015 23:54:32 +1300 Subject: [PATCH] Brace style fixes --- OpenRA.Game/FileFormats/Blast.cs | 3 +-- OpenRA.Game/FileFormats/Format80.cs | 2 -- OpenRA.Game/FileFormats/VqaReader.cs | 2 -- OpenRA.Game/Game.cs | 2 -- OpenRA.Game/Graphics/HSLColor.cs | 12 +++++++---- OpenRA.Game/Traits/Util.cs | 2 -- OpenRA.Game/Widgets/LineGraphWidget.cs | 4 ---- OpenRA.Game/WorldUtils.cs | 2 -- .../Activities/DeliverResources.cs | 2 -- OpenRA.Mods.Common/Effects/Bullet.cs | 2 -- OpenRA.Mods.Common/Traits/Mobile.cs | 2 -- .../Traits/Player/PlaceBuilding.cs | 2 -- .../Traits/Player/ProductionQueue.cs | 5 +---- .../Traits/World/CrateSpawner.cs | 2 -- .../UtilityCommands/UpgradeRules.cs | 4 ---- .../ObserverSupportPowerIconsWidget.cs | 4 ---- OpenRA.Mods.D2k/Widgets/BuildPaletteWidget.cs | 4 +--- .../Widgets/Logic/InstallMusicLogic.cs | 2 -- .../Widgets/ObserverProductionIconsWidget.cs | 7 +------ OpenRA.Renderer.Sdl2/FrameBuffer.cs | 2 -- OpenRA.TilesetBuilder/FormBuilder.cs | 21 ++++++------------- OpenRA.TilesetBuilder/FormNew.cs | 4 ---- OpenRA.TilesetBuilder/Program.cs | 11 +++------- 23 files changed, 21 insertions(+), 82 deletions(-) diff --git a/OpenRA.Game/FileFormats/Blast.cs b/OpenRA.Game/FileFormats/Blast.cs index 65176b518a..54fa631f2d 100644 --- a/OpenRA.Game/FileFormats/Blast.cs +++ b/OpenRA.Game/FileFormats/Blast.cs @@ -241,9 +241,8 @@ namespace OpenRA.FileFormats var num = (code >> 4) + 1; // Number of codes (top four bits plus 1) var len = (byte)(code & 15); // Code length (low four bits) do - { length[s++] = len; - } while (--num > 0); + while (--num > 0); } n = s; diff --git a/OpenRA.Game/FileFormats/Format80.cs b/OpenRA.Game/FileFormats/Format80.cs index 5b674bdadf..c1a3cd9a12 100644 --- a/OpenRA.Game/FileFormats/Format80.cs +++ b/OpenRA.Game/FileFormats/Format80.cs @@ -187,9 +187,7 @@ namespace OpenRA.FileFormats blockStart = offset; } else - { offset++; - } } // Write what we haven't written up to now diff --git a/OpenRA.Game/FileFormats/VqaReader.cs b/OpenRA.Game/FileFormats/VqaReader.cs index f709dda669..32fc066b63 100644 --- a/OpenRA.Game/FileFormats/VqaReader.cs +++ b/OpenRA.Game/FileFormats/VqaReader.cs @@ -209,9 +209,7 @@ namespace OpenRA.FileFormats } if (audioChannels == 1) - { audioData = compressed ? AudLoader.LoadSound(audio1.ToArray(), ref adpcmIndex) : audio1.ToArray(); - } else { byte[] leftData, rightData; diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index c82f1db633..9da6da7d97 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -617,9 +617,7 @@ namespace OpenRA } } else - { Thread.Sleep(nextUpdate - now); - } } } diff --git a/OpenRA.Game/Graphics/HSLColor.cs b/OpenRA.Game/Graphics/HSLColor.cs index 624842ebd7..ec5ca86e3b 100644 --- a/OpenRA.Game/Graphics/HSLColor.cs +++ b/OpenRA.Game/Graphics/HSLColor.cs @@ -52,10 +52,14 @@ namespace OpenRA.Graphics for (var k = 0; k < 3; k++) { - if (trgb[k] < 1 / 6.0f) { rgb[k] = p + ((q - p) * 6 * trgb[k]); } - else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5) { rgb[k] = q; } - else if (trgb[k] >= 0.5f && trgb[k] < 2.0f / 3) { rgb[k] = p + ((q - p) * 6 * (2.0f / 3 - trgb[k])); } - else { rgb[k] = p; } + if (trgb[k] < 1 / 6.0f) + rgb[k] = p + ((q - p) * 6 * trgb[k]); + else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5) + rgb[k] = q; + else if (trgb[k] >= 0.5f && trgb[k] < 2.0f / 3) + rgb[k] = p + ((q - p) * 6 * (2.0f / 3 - trgb[k])); + else + rgb[k] = p; } return Color.FromArgb((int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255)); diff --git a/OpenRA.Game/Traits/Util.cs b/OpenRA.Game/Traits/Util.cs index 290bccae12..80a9b506f5 100644 --- a/OpenRA.Game/Traits/Util.cs +++ b/OpenRA.Game/Traits/Util.cs @@ -88,9 +88,7 @@ namespace OpenRA.Traits start = Stopwatch.GetTimestamp(); } else - { start = current; - } if (prev == act) break; diff --git a/OpenRA.Game/Widgets/LineGraphWidget.cs b/OpenRA.Game/Widgets/LineGraphWidget.cs index 37f10b4292..7077e23070 100644 --- a/OpenRA.Game/Widgets/LineGraphWidget.cs +++ b/OpenRA.Game/Widgets/LineGraphWidget.cs @@ -84,9 +84,7 @@ namespace OpenRA.Widgets if (GetSeries == null || !GetSeries().Any() || GetLabelFont == null || GetLabelFont() == null || GetAxisFont == null || GetAxisFont() == null) - { return; - } var rect = RenderBounds; var origin = new float2(rect.Left, rect.Bottom); @@ -133,9 +131,7 @@ namespace OpenRA.Widgets var value = points.Last(); if (value != 0) - { tiny.DrawText(GetValueFormat().F(value), origin + new float2(x, -value * scale - 2), color); - } } tiny.DrawText(key, new float2(rect.Left, rect.Top) + new float2(5, 10 * keyOffset + 3), color); diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 2a73066e40..868273632d 100644 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -97,9 +97,7 @@ namespace OpenRA start = Stopwatch.GetTimestamp(); } else - { start = current; - } } } } diff --git a/OpenRA.Mods.Common/Activities/DeliverResources.cs b/OpenRA.Mods.Common/Activities/DeliverResources.cs index 5fa51d8141..1bfe5637fb 100644 --- a/OpenRA.Mods.Common/Activities/DeliverResources.cs +++ b/OpenRA.Mods.Common/Activities/DeliverResources.cs @@ -41,9 +41,7 @@ namespace OpenRA.Mods.Common.Activities } } else - { harv.LinkProc(self, harv.OwnerLinkedProc); - } if (harv.LinkedProc == null || !harv.LinkedProc.IsInWorld) harv.ChooseNewProc(self, null); diff --git a/OpenRA.Mods.Common/Effects/Bullet.cs b/OpenRA.Mods.Common/Effects/Bullet.cs index 1f068580f1..0583af7ea3 100644 --- a/OpenRA.Mods.Common/Effects/Bullet.cs +++ b/OpenRA.Mods.Common/Effects/Bullet.cs @@ -137,9 +137,7 @@ namespace OpenRA.Mods.Common.Effects if (ticks++ >= length || (!info.High && world.ActorMap .GetUnitsAt(world.Map.CellContaining(pos)).Any(a => a.HasTrait()))) - { Explode(world); - } } public IEnumerable Render(WorldRenderer wr) diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index cf3add10fc..4e3cc08759 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -295,9 +295,7 @@ namespace OpenRA.Mods.Common.Traits ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.DefaultSubCell : SubCell.FullCell; if (init.Contains()) - { FromSubCell = ToSubCell = init.Get(); - } if (init.Contains()) { diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 6175073611..eb3b359729 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -63,9 +63,7 @@ namespace OpenRA.Mods.Common.Traits { if (!self.World.CanPlaceBuilding(order.TargetString, buildingInfo, order.TargetLocation, null) || !buildingInfo.IsCloseEnoughToBase(self.World, order.Player, order.TargetString, order.TargetLocation)) - { return; - } var building = w.CreateActor(order.TargetString, new TypeDictionary { diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 739a2e2665..4c335cfc97 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -284,18 +284,15 @@ namespace OpenRA.Mods.Common.Traits BeginProduction(new ProductionItem(this, order.TargetString, cost, playerPower, () => self.World.AddFrameEndTask(_ => { var isBuilding = unit.Traits.Contains(); + if (isBuilding && !hasPlayedSound) - { hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); - } else if (!isBuilding) { if (BuildUnit(order.TargetString)) Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); else if (!hasPlayedSound && time > 0) - { hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race); - } } }))); } diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs index 9879680229..bb8fae99cf 100644 --- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs +++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs @@ -127,9 +127,7 @@ namespace OpenRA.Mods.Common.Traits plane.QueueActivity(new RemoveSelf()); } else - { w.CreateActor(crateActor, new TypeDictionary { new OwnerInit(w.WorldActor.Owner), new LocationInit(p) }); - } }); } diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index acab326d96..73b3b56760 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -224,9 +224,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { if (node.Value.Nodes.Any(n => n.Key.StartsWith("RequiresPower")) && !node.Value.Nodes.Any(n => n.Key.StartsWith("DisabledOverlay"))) - { node.Value.Nodes.Add(new MiniYamlNode("DisabledOverlay", new MiniYaml(""))); - } } // ChronoshiftDeploy was replaced with PortableChrono @@ -267,9 +265,7 @@ namespace OpenRA.Mods.Common.UtilityCommands if (node.Value.Nodes.Any(n => n.Key.StartsWith("RenderBuilding")) && !node.Value.Nodes.Any(n => n.Key == "RenderBuildingWall") && !node.Value.Nodes.Any(n => n.Key == "WithMakeAnimation")) - { node.Value.Nodes.Add(new MiniYamlNode("WithMakeAnimation", new MiniYaml(""))); - } } // ParachuteAttachment was merged into Parachutable diff --git a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs index 83d1720e29..2f95aed0c9 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs @@ -53,18 +53,14 @@ namespace OpenRA.Mods.Common.Widgets { var player = GetPlayer(); if (player == null) - { return; - } var powers = player.PlayerActor.Trait().Powers .Select((a, i) => new { a, i }); foreach (var power in powers) { if (!clocks.ContainsKey(power.a.Key)) - { clocks.Add(power.a.Key, new Animation(world, "clock")); - } } var iconSize = new float2(IconWidth, IconHeight); diff --git a/OpenRA.Mods.D2k/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.D2k/Widgets/BuildPaletteWidget.cs index 5a02b85f29..08df66cc1e 100644 --- a/OpenRA.Mods.D2k/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.D2k/Widgets/BuildPaletteWidget.cs @@ -138,10 +138,8 @@ namespace OpenRA.Mods.D2k.Widgets // Animation is complete if ((paletteAnimationFrame == 0 && !paletteOpen) - || (paletteAnimationFrame == paletteAnimationLength && paletteOpen)) - { + || (paletteAnimationFrame == paletteAnimationLength && paletteOpen)) paletteAnimating = false; - } } public void SetCurrentTab(ProductionQueue queue) diff --git a/OpenRA.Mods.RA/Widgets/Logic/InstallMusicLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/InstallMusicLogic.cs index 215d4354bd..1b028372b8 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/InstallMusicLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/InstallMusicLogic.cs @@ -26,9 +26,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var cancelButton = installMusicContainer.GetOrNull("CANCEL_BUTTON"); if (cancelButton != null) - { cancelButton.OnClick = () => Game.InitializeMod(Game.Settings.Game.Mod, null); - } var copyFromDiscButton = installMusicContainer.GetOrNull("COPY_FROM_CD_BUTTON"); if (copyFromDiscButton != null) diff --git a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs index c3bda4b1a7..b8a3416023 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs @@ -50,20 +50,15 @@ namespace OpenRA.Mods.RA.Widgets { var player = GetPlayer(); if (player == null) - { return; - } var queues = world.ActorsWithTrait() .Where(a => a.Actor.Owner == player) .Select((a, i) => new { a.Trait, i }); + foreach (var queue in queues) - { if (!clocks.ContainsKey(queue.Trait)) - { clocks.Add(queue.Trait, new Animation(world, "clock")); - } - } var iconSize = new float2(IconWidth, IconHeight); foreach (var queue in queues) diff --git a/OpenRA.Renderer.Sdl2/FrameBuffer.cs b/OpenRA.Renderer.Sdl2/FrameBuffer.cs index 1829e538f2..e899ebf9f7 100644 --- a/OpenRA.Renderer.Sdl2/FrameBuffer.cs +++ b/OpenRA.Renderer.Sdl2/FrameBuffer.cs @@ -73,9 +73,7 @@ namespace OpenRA.Renderer.Sdl2 unsafe { fixed (int* ptr = &v[0]) - { GL.GetInteger(GetPName.Viewport, ptr); - } } ErrorHandler.CheckGlError(); diff --git a/OpenRA.TilesetBuilder/FormBuilder.cs b/OpenRA.TilesetBuilder/FormBuilder.cs index a03f16ea85..3cfbfe4d58 100644 --- a/OpenRA.TilesetBuilder/FormBuilder.cs +++ b/OpenRA.TilesetBuilder/FormBuilder.cs @@ -136,9 +136,7 @@ namespace OpenRA.TilesetBuilder Load(); } else - { CreateNewTileset(); - } if (autoExport) { @@ -179,7 +177,8 @@ namespace OpenRA.TilesetBuilder { var tilesetName = txtTilesetName.Text; - if (tilesetName.Length < 1) { tilesetName = "Temperat"; } + if (tilesetName.Length < 1) + tilesetName = "Temperat"; w.WriteStartDocument(); @@ -295,9 +294,7 @@ namespace OpenRA.TilesetBuilder var q = p + data.Stride * tileSize * (v + t.Top) + tileSize * (u + t.Left); for (var j = 0; j < tileSize; j++) for (var i = 0; i < tileSize; i++) - { bw.Write(q[i + j * data.Stride]); - } } else for (var x = 0; x < tileSize * tileSize; x++) @@ -348,10 +345,10 @@ namespace OpenRA.TilesetBuilder var tilesetPalette = txtPal.Text; var tilesetExt = txtExt.Text; - if (tilesetName.Length < 1) { tilesetName = "Temperat"; } - if (tilesetID.Length < 1) { tilesetID = "TEMPERAT"; } - if (tilesetPalette.Length < 1) { tilesetPalette = "temperat"; } - if (tilesetExt.Length < 1) { tilesetExt = ".tem,.shp"; } + if (tilesetName.Length < 1) tilesetName = "Temperat"; + if (tilesetID.Length < 1) tilesetID = "TEMPERAT"; + if (tilesetPalette.Length < 1) tilesetPalette = "temperat"; + if (tilesetExt.Length < 1) tilesetExt = ".tem,.shp"; // Create a Tileset definition // TODO: Pull this info from the GUI @@ -440,20 +437,14 @@ namespace OpenRA.TilesetBuilder { var tilesetFile = txtTilesetName.Text; if (tilesetFile.Length > 8) - { tilesetFile = tilesetFile.ToLower().Substring(0, 8); - } txtID.Text = tilesetFile.ToUpper(); txtPal.Text = tilesetFile.ToLower() + ".pal"; if (tilesetFile.Length < 3) - { txtExt.Text = ".tem,.shp"; - } else - { txtExt.Text = "." + tilesetFile.ToLower().Substring(0, 3) + ",.shp"; - } } private void NewTilesetButton(object sender, EventArgs e) diff --git a/OpenRA.TilesetBuilder/FormNew.cs b/OpenRA.TilesetBuilder/FormNew.cs index 964a7f1f66..24f1ed1d9a 100644 --- a/OpenRA.TilesetBuilder/FormNew.cs +++ b/OpenRA.TilesetBuilder/FormNew.cs @@ -26,15 +26,11 @@ namespace OpenRA.TilesetBuilder if (!PaletteFromImage) { if (PaletteFile.Length < 5) - { MessageBox.Show("No palette specified", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } } if (ImageFile.Length < 5) - { MessageBox.Show("No image selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } else { DialogResult = DialogResult.OK; diff --git a/OpenRA.TilesetBuilder/Program.cs b/OpenRA.TilesetBuilder/Program.cs index ee0c3e5b64..2733e036d5 100644 --- a/OpenRA.TilesetBuilder/Program.cs +++ b/OpenRA.TilesetBuilder/Program.cs @@ -23,16 +23,11 @@ namespace OpenRA.TilesetBuilder Application.SetCompatibleTextRenderingDefault(false); if (args.Length < 1) - { Application.Run(new FormBuilder("", "0", false, "Tilesets")); - } + else if (args.Contains("--export")) + Application.Run(new FormBuilder(args[0], args[1], true, args[3])); else - { - if (args.Contains("--export")) - Application.Run(new FormBuilder(args[0], args[1], true, args[3])); - else - Application.Run(new FormBuilder(args[0], args[1], false, "Tilesets")); - } + Application.Run(new FormBuilder(args[0], args[1], false, "Tilesets")); } } }