Fix some whitespace formatting issues: stray tabs or spaces.
Wrap some long lines on affected code.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace OpenRA.Traits
|
||||
get => depthBuffer;
|
||||
set
|
||||
{
|
||||
depthBuffer = value;
|
||||
depthBufferDirty = true;
|
||||
depthBuffer = value;
|
||||
depthBufferDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
{
|
||||
public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||
public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||
{
|
||||
public readonly string Sequence = "idle";
|
||||
|
||||
|
||||
@@ -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) }; }
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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}";
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
void ReturnLayer(CellLayer<CellInfo> layer)
|
||||
{
|
||||
lock (pool)
|
||||
if (pool.Count < MaxPoolSize)
|
||||
if (pool.Count < MaxPoolSize)
|
||||
pool.Push(layer);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<LineBuildInfo>();
|
||||
var topLeft = cell; // 1x1 assumption!
|
||||
var topLeft = cell; // 1x1 assumption!
|
||||
|
||||
if (world.IsCellBuildable(topLeft, ai, bi))
|
||||
yield return (topLeft, null);
|
||||
|
||||
@@ -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<HarvesterInfo>())
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<GameSpeeds>();
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user