Brace style fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -187,9 +187,7 @@ namespace OpenRA.FileFormats
|
||||
blockStart = offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
// Write what we haven't written up to now
|
||||
|
||||
@@ -209,9 +209,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
if (audioChannels == 1)
|
||||
{
|
||||
audioData = compressed ? AudLoader.LoadSound(audio1.ToArray(), ref adpcmIndex) : audio1.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] leftData, rightData;
|
||||
|
||||
@@ -617,9 +617,7 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(nextUpdate - now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -88,9 +88,7 @@ namespace OpenRA.Traits
|
||||
start = Stopwatch.GetTimestamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
start = current;
|
||||
}
|
||||
|
||||
if (prev == act)
|
||||
break;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -97,9 +97,7 @@ namespace OpenRA
|
||||
start = Stopwatch.GetTimestamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
start = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<IBlocksBullets>())))
|
||||
{
|
||||
Explode(world);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||
|
||||
@@ -295,9 +295,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.DefaultSubCell : SubCell.FullCell;
|
||||
if (init.Contains<SubCellInit>())
|
||||
{
|
||||
FromSubCell = ToSubCell = init.Get<SubCellInit, SubCell>();
|
||||
}
|
||||
|
||||
if (init.Contains<LocationInit>())
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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<BuildingInfo>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -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) });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -53,18 +53,14 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var player = GetPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var powers = player.PlayerActor.Trait<SupportPowerManager>().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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -26,9 +26,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
var cancelButton = installMusicContainer.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
|
||||
if (cancelButton != null)
|
||||
{
|
||||
cancelButton.OnClick = () => Game.InitializeMod(Game.Settings.Game.Mod, null);
|
||||
}
|
||||
|
||||
var copyFromDiscButton = installMusicContainer.GetOrNull<ButtonWidget>("COPY_FROM_CD_BUTTON");
|
||||
if (copyFromDiscButton != null)
|
||||
|
||||
@@ -50,20 +50,15 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
var player = GetPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var queues = world.ActorsWithTrait<ProductionQueue>()
|
||||
.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)
|
||||
|
||||
@@ -73,9 +73,7 @@ namespace OpenRA.Renderer.Sdl2
|
||||
unsafe
|
||||
{
|
||||
fixed (int* ptr = &v[0])
|
||||
{
|
||||
GL.GetInteger(GetPName.Viewport, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
ErrorHandler.CheckGlError();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user