Brace style fixes

This commit is contained in:
ScottNZ
2015-02-12 23:54:32 +13:00
parent 1eb6c984f5
commit 582b6635ff
23 changed files with 21 additions and 82 deletions

View File

@@ -241,9 +241,8 @@ namespace OpenRA.FileFormats
var num = (code >> 4) + 1; // Number of codes (top four bits plus 1) var num = (code >> 4) + 1; // Number of codes (top four bits plus 1)
var len = (byte)(code & 15); // Code length (low four bits) var len = (byte)(code & 15); // Code length (low four bits)
do do
{
length[s++] = len; length[s++] = len;
} while (--num > 0); while (--num > 0);
} }
n = s; n = s;

View File

@@ -187,9 +187,7 @@ namespace OpenRA.FileFormats
blockStart = offset; blockStart = offset;
} }
else else
{
offset++; offset++;
}
} }
// Write what we haven't written up to now // Write what we haven't written up to now

View File

@@ -209,9 +209,7 @@ namespace OpenRA.FileFormats
} }
if (audioChannels == 1) if (audioChannels == 1)
{
audioData = compressed ? AudLoader.LoadSound(audio1.ToArray(), ref adpcmIndex) : audio1.ToArray(); audioData = compressed ? AudLoader.LoadSound(audio1.ToArray(), ref adpcmIndex) : audio1.ToArray();
}
else else
{ {
byte[] leftData, rightData; byte[] leftData, rightData;

View File

@@ -617,9 +617,7 @@ namespace OpenRA
} }
} }
else else
{
Thread.Sleep(nextUpdate - now); Thread.Sleep(nextUpdate - now);
}
} }
} }

View File

@@ -52,10 +52,14 @@ namespace OpenRA.Graphics
for (var k = 0; k < 3; k++) for (var k = 0; k < 3; k++)
{ {
if (trgb[k] < 1 / 6.0f) { rgb[k] = p + ((q - p) * 6 * trgb[k]); } if (trgb[k] < 1 / 6.0f)
else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5) { rgb[k] = q; } rgb[k] = p + ((q - p) * 6 * trgb[k]);
else if (trgb[k] >= 0.5f && trgb[k] < 2.0f / 3) { rgb[k] = p + ((q - p) * 6 * (2.0f / 3 - trgb[k])); } else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5)
else { rgb[k] = p; } 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)); return Color.FromArgb((int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255));

View File

@@ -88,9 +88,7 @@ namespace OpenRA.Traits
start = Stopwatch.GetTimestamp(); start = Stopwatch.GetTimestamp();
} }
else else
{
start = current; start = current;
}
if (prev == act) if (prev == act)
break; break;

View File

@@ -84,9 +84,7 @@ namespace OpenRA.Widgets
if (GetSeries == null || !GetSeries().Any() if (GetSeries == null || !GetSeries().Any()
|| GetLabelFont == null || GetLabelFont() == null || GetLabelFont == null || GetLabelFont() == null
|| GetAxisFont == null || GetAxisFont() == null) || GetAxisFont == null || GetAxisFont() == null)
{
return; return;
}
var rect = RenderBounds; var rect = RenderBounds;
var origin = new float2(rect.Left, rect.Bottom); var origin = new float2(rect.Left, rect.Bottom);
@@ -133,9 +131,7 @@ namespace OpenRA.Widgets
var value = points.Last(); var value = points.Last();
if (value != 0) if (value != 0)
{
tiny.DrawText(GetValueFormat().F(value), origin + new float2(x, -value * scale - 2), color); 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); tiny.DrawText(key, new float2(rect.Left, rect.Top) + new float2(5, 10 * keyOffset + 3), color);

View File

@@ -97,9 +97,7 @@ namespace OpenRA
start = Stopwatch.GetTimestamp(); start = Stopwatch.GetTimestamp();
} }
else else
{
start = current; start = current;
}
} }
} }
} }

View File

@@ -41,9 +41,7 @@ namespace OpenRA.Mods.Common.Activities
} }
} }
else else
{
harv.LinkProc(self, harv.OwnerLinkedProc); harv.LinkProc(self, harv.OwnerLinkedProc);
}
if (harv.LinkedProc == null || !harv.LinkedProc.IsInWorld) if (harv.LinkedProc == null || !harv.LinkedProc.IsInWorld)
harv.ChooseNewProc(self, null); harv.ChooseNewProc(self, null);

View File

@@ -137,9 +137,7 @@ namespace OpenRA.Mods.Common.Effects
if (ticks++ >= length || (!info.High && world.ActorMap if (ticks++ >= length || (!info.High && world.ActorMap
.GetUnitsAt(world.Map.CellContaining(pos)).Any(a => a.HasTrait<IBlocksBullets>()))) .GetUnitsAt(world.Map.CellContaining(pos)).Any(a => a.HasTrait<IBlocksBullets>())))
{
Explode(world); Explode(world);
}
} }
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)

View File

@@ -295,9 +295,7 @@ namespace OpenRA.Mods.Common.Traits
ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.DefaultSubCell : SubCell.FullCell; ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.DefaultSubCell : SubCell.FullCell;
if (init.Contains<SubCellInit>()) if (init.Contains<SubCellInit>())
{
FromSubCell = ToSubCell = init.Get<SubCellInit, SubCell>(); FromSubCell = ToSubCell = init.Get<SubCellInit, SubCell>();
}
if (init.Contains<LocationInit>()) if (init.Contains<LocationInit>())
{ {

View File

@@ -63,9 +63,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
if (!self.World.CanPlaceBuilding(order.TargetString, buildingInfo, order.TargetLocation, null) if (!self.World.CanPlaceBuilding(order.TargetString, buildingInfo, order.TargetLocation, null)
|| !buildingInfo.IsCloseEnoughToBase(self.World, order.Player, order.TargetString, order.TargetLocation)) || !buildingInfo.IsCloseEnoughToBase(self.World, order.Player, order.TargetString, order.TargetLocation))
{
return; return;
}
var building = w.CreateActor(order.TargetString, new TypeDictionary var building = w.CreateActor(order.TargetString, new TypeDictionary
{ {

View File

@@ -284,18 +284,15 @@ namespace OpenRA.Mods.Common.Traits
BeginProduction(new ProductionItem(this, order.TargetString, cost, playerPower, () => self.World.AddFrameEndTask(_ => BeginProduction(new ProductionItem(this, order.TargetString, cost, playerPower, () => self.World.AddFrameEndTask(_ =>
{ {
var isBuilding = unit.Traits.Contains<BuildingInfo>(); var isBuilding = unit.Traits.Contains<BuildingInfo>();
if (isBuilding && !hasPlayedSound) if (isBuilding && !hasPlayedSound)
{
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race);
}
else if (!isBuilding) else if (!isBuilding)
{ {
if (BuildUnit(order.TargetString)) if (BuildUnit(order.TargetString))
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race);
else if (!hasPlayedSound && time > 0) else if (!hasPlayedSound && time > 0)
{
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race); hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race);
}
} }
}))); })));
} }

View File

@@ -127,9 +127,7 @@ namespace OpenRA.Mods.Common.Traits
plane.QueueActivity(new RemoveSelf()); plane.QueueActivity(new RemoveSelf());
} }
else else
{
w.CreateActor(crateActor, new TypeDictionary { new OwnerInit(w.WorldActor.Owner), new LocationInit(p) }); w.CreateActor(crateActor, new TypeDictionary { new OwnerInit(w.WorldActor.Owner), new LocationInit(p) });
}
}); });
} }

View File

@@ -224,9 +224,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
{ {
if (node.Value.Nodes.Any(n => n.Key.StartsWith("RequiresPower")) if (node.Value.Nodes.Any(n => n.Key.StartsWith("RequiresPower"))
&& !node.Value.Nodes.Any(n => n.Key.StartsWith("DisabledOverlay"))) && !node.Value.Nodes.Any(n => n.Key.StartsWith("DisabledOverlay")))
{
node.Value.Nodes.Add(new MiniYamlNode("DisabledOverlay", new MiniYaml(""))); node.Value.Nodes.Add(new MiniYamlNode("DisabledOverlay", new MiniYaml("")));
}
} }
// ChronoshiftDeploy was replaced with PortableChrono // ChronoshiftDeploy was replaced with PortableChrono
@@ -267,9 +265,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (node.Value.Nodes.Any(n => n.Key.StartsWith("RenderBuilding")) 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 == "RenderBuildingWall")
&& !node.Value.Nodes.Any(n => n.Key == "WithMakeAnimation")) && !node.Value.Nodes.Any(n => n.Key == "WithMakeAnimation"))
{
node.Value.Nodes.Add(new MiniYamlNode("WithMakeAnimation", new MiniYaml(""))); node.Value.Nodes.Add(new MiniYamlNode("WithMakeAnimation", new MiniYaml("")));
}
} }
// ParachuteAttachment was merged into Parachutable // ParachuteAttachment was merged into Parachutable

View File

@@ -53,18 +53,14 @@ namespace OpenRA.Mods.Common.Widgets
{ {
var player = GetPlayer(); var player = GetPlayer();
if (player == null) if (player == null)
{
return; return;
}
var powers = player.PlayerActor.Trait<SupportPowerManager>().Powers var powers = player.PlayerActor.Trait<SupportPowerManager>().Powers
.Select((a, i) => new { a, i }); .Select((a, i) => new { a, i });
foreach (var power in powers) foreach (var power in powers)
{ {
if (!clocks.ContainsKey(power.a.Key)) if (!clocks.ContainsKey(power.a.Key))
{
clocks.Add(power.a.Key, new Animation(world, "clock")); clocks.Add(power.a.Key, new Animation(world, "clock"));
}
} }
var iconSize = new float2(IconWidth, IconHeight); var iconSize = new float2(IconWidth, IconHeight);

View File

@@ -138,10 +138,8 @@ namespace OpenRA.Mods.D2k.Widgets
// Animation is complete // Animation is complete
if ((paletteAnimationFrame == 0 && !paletteOpen) if ((paletteAnimationFrame == 0 && !paletteOpen)
|| (paletteAnimationFrame == paletteAnimationLength && paletteOpen)) || (paletteAnimationFrame == paletteAnimationLength && paletteOpen))
{
paletteAnimating = false; paletteAnimating = false;
}
} }
public void SetCurrentTab(ProductionQueue queue) public void SetCurrentTab(ProductionQueue queue)

View File

@@ -26,9 +26,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var cancelButton = installMusicContainer.GetOrNull<ButtonWidget>("CANCEL_BUTTON"); var cancelButton = installMusicContainer.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
if (cancelButton != null) if (cancelButton != null)
{
cancelButton.OnClick = () => Game.InitializeMod(Game.Settings.Game.Mod, null); cancelButton.OnClick = () => Game.InitializeMod(Game.Settings.Game.Mod, null);
}
var copyFromDiscButton = installMusicContainer.GetOrNull<ButtonWidget>("COPY_FROM_CD_BUTTON"); var copyFromDiscButton = installMusicContainer.GetOrNull<ButtonWidget>("COPY_FROM_CD_BUTTON");
if (copyFromDiscButton != null) if (copyFromDiscButton != null)

View File

@@ -50,20 +50,15 @@ namespace OpenRA.Mods.RA.Widgets
{ {
var player = GetPlayer(); var player = GetPlayer();
if (player == null) if (player == null)
{
return; return;
}
var queues = world.ActorsWithTrait<ProductionQueue>() var queues = world.ActorsWithTrait<ProductionQueue>()
.Where(a => a.Actor.Owner == player) .Where(a => a.Actor.Owner == player)
.Select((a, i) => new { a.Trait, i }); .Select((a, i) => new { a.Trait, i });
foreach (var queue in queues) foreach (var queue in queues)
{
if (!clocks.ContainsKey(queue.Trait)) if (!clocks.ContainsKey(queue.Trait))
{
clocks.Add(queue.Trait, new Animation(world, "clock")); clocks.Add(queue.Trait, new Animation(world, "clock"));
}
}
var iconSize = new float2(IconWidth, IconHeight); var iconSize = new float2(IconWidth, IconHeight);
foreach (var queue in queues) foreach (var queue in queues)

View File

@@ -73,9 +73,7 @@ namespace OpenRA.Renderer.Sdl2
unsafe unsafe
{ {
fixed (int* ptr = &v[0]) fixed (int* ptr = &v[0])
{
GL.GetInteger(GetPName.Viewport, ptr); GL.GetInteger(GetPName.Viewport, ptr);
}
} }
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();

View File

@@ -136,9 +136,7 @@ namespace OpenRA.TilesetBuilder
Load(); Load();
} }
else else
{
CreateNewTileset(); CreateNewTileset();
}
if (autoExport) if (autoExport)
{ {
@@ -179,7 +177,8 @@ namespace OpenRA.TilesetBuilder
{ {
var tilesetName = txtTilesetName.Text; var tilesetName = txtTilesetName.Text;
if (tilesetName.Length < 1) { tilesetName = "Temperat"; } if (tilesetName.Length < 1)
tilesetName = "Temperat";
w.WriteStartDocument(); w.WriteStartDocument();
@@ -295,9 +294,7 @@ namespace OpenRA.TilesetBuilder
var q = p + data.Stride * tileSize * (v + t.Top) + tileSize * (u + t.Left); var q = p + data.Stride * tileSize * (v + t.Top) + tileSize * (u + t.Left);
for (var j = 0; j < tileSize; j++) for (var j = 0; j < tileSize; j++)
for (var i = 0; i < tileSize; i++) for (var i = 0; i < tileSize; i++)
{
bw.Write(q[i + j * data.Stride]); bw.Write(q[i + j * data.Stride]);
}
} }
else else
for (var x = 0; x < tileSize * tileSize; x++) for (var x = 0; x < tileSize * tileSize; x++)
@@ -348,10 +345,10 @@ namespace OpenRA.TilesetBuilder
var tilesetPalette = txtPal.Text; var tilesetPalette = txtPal.Text;
var tilesetExt = txtExt.Text; var tilesetExt = txtExt.Text;
if (tilesetName.Length < 1) { tilesetName = "Temperat"; } if (tilesetName.Length < 1) tilesetName = "Temperat";
if (tilesetID.Length < 1) { tilesetID = "TEMPERAT"; } if (tilesetID.Length < 1) tilesetID = "TEMPERAT";
if (tilesetPalette.Length < 1) { tilesetPalette = "temperat"; } if (tilesetPalette.Length < 1) tilesetPalette = "temperat";
if (tilesetExt.Length < 1) { tilesetExt = ".tem,.shp"; } if (tilesetExt.Length < 1) tilesetExt = ".tem,.shp";
// Create a Tileset definition // Create a Tileset definition
// TODO: Pull this info from the GUI // TODO: Pull this info from the GUI
@@ -440,20 +437,14 @@ namespace OpenRA.TilesetBuilder
{ {
var tilesetFile = txtTilesetName.Text; var tilesetFile = txtTilesetName.Text;
if (tilesetFile.Length > 8) if (tilesetFile.Length > 8)
{
tilesetFile = tilesetFile.ToLower().Substring(0, 8); tilesetFile = tilesetFile.ToLower().Substring(0, 8);
}
txtID.Text = tilesetFile.ToUpper(); txtID.Text = tilesetFile.ToUpper();
txtPal.Text = tilesetFile.ToLower() + ".pal"; txtPal.Text = tilesetFile.ToLower() + ".pal";
if (tilesetFile.Length < 3) if (tilesetFile.Length < 3)
{
txtExt.Text = ".tem,.shp"; txtExt.Text = ".tem,.shp";
}
else else
{
txtExt.Text = "." + tilesetFile.ToLower().Substring(0, 3) + ",.shp"; txtExt.Text = "." + tilesetFile.ToLower().Substring(0, 3) + ",.shp";
}
} }
private void NewTilesetButton(object sender, EventArgs e) private void NewTilesetButton(object sender, EventArgs e)

View File

@@ -26,15 +26,11 @@ namespace OpenRA.TilesetBuilder
if (!PaletteFromImage) if (!PaletteFromImage)
{ {
if (PaletteFile.Length < 5) if (PaletteFile.Length < 5)
{
MessageBox.Show("No palette specified", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("No palette specified", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
} }
if (ImageFile.Length < 5) if (ImageFile.Length < 5)
{
MessageBox.Show("No image selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No image selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else else
{ {
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@@ -23,16 +23,11 @@ namespace OpenRA.TilesetBuilder
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
if (args.Length < 1) if (args.Length < 1)
{
Application.Run(new FormBuilder("", "0", false, "Tilesets")); Application.Run(new FormBuilder("", "0", false, "Tilesets"));
} else if (args.Contains("--export"))
Application.Run(new FormBuilder(args[0], args[1], true, args[3]));
else else
{ Application.Run(new FormBuilder(args[0], args[1], false, "Tilesets"));
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"));
}
} }
} }
} }