Enforce a line length limit.
This commit is contained in:
@@ -309,12 +309,16 @@ namespace OpenRA
|
||||
return new HashSet<T>(source);
|
||||
}
|
||||
|
||||
public static Dictionary<TKey, TSource> ToDictionaryWithConflictLog<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, string debugName, Func<TKey, string> logKey, Func<TSource, string> logValue)
|
||||
public static Dictionary<TKey, TSource> ToDictionaryWithConflictLog<TSource, TKey>(
|
||||
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector,
|
||||
string debugName, Func<TKey, string> logKey, Func<TSource, string> logValue)
|
||||
{
|
||||
return ToDictionaryWithConflictLog(source, keySelector, x => x, debugName, logKey, logValue);
|
||||
}
|
||||
|
||||
public static Dictionary<TKey, TElement> ToDictionaryWithConflictLog<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, string debugName, Func<TKey, string> logKey, Func<TElement, string> logValue)
|
||||
public static Dictionary<TKey, TElement> ToDictionaryWithConflictLog<TSource, TKey, TElement>(
|
||||
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector,
|
||||
string debugName, Func<TKey, string> logKey, Func<TElement, string> logValue)
|
||||
{
|
||||
// Fall back on ToString() if null functions are provided:
|
||||
logKey = logKey ?? (s => s.ToString());
|
||||
@@ -385,7 +389,8 @@ namespace OpenRA
|
||||
{
|
||||
for (var j = 0; j < height; j++)
|
||||
{
|
||||
// Workaround for broken ternary operators in certain versions of mono (3.10 and certain versions of the 3.8 series): https://bugzilla.xamarin.com/show_bug.cgi?id=23319
|
||||
// Workaround for broken ternary operators in certain versions of mono
|
||||
// (3.10 and certain versions of the 3.8 series): https://bugzilla.xamarin.com/show_bug.cgi?id=23319
|
||||
if (i <= ts.GetUpperBound(0) && j <= ts.GetUpperBound(1))
|
||||
result[i, j] = ts[i, j];
|
||||
else
|
||||
|
||||
@@ -38,8 +38,12 @@ namespace OpenRA.FileFormats
|
||||
byte[] cbf;
|
||||
byte[] cbp;
|
||||
byte[] cbfBuffer;
|
||||
byte[] fileBuffer = new byte[256000]; // Buffer for loading file subchunks, the maximum chunk size of a file is not defined
|
||||
int maxCbfzSize = 256000; // and the header definition for the size of the biggest chunks (color data) isn't accurate. But 256k is large enough for all TS videos(< 200k).
|
||||
|
||||
// Buffer for loading file subchunks, the maximum chunk size of a file is not defined
|
||||
// and the header definition for the size of the biggest chunks (color data) isn't accurate.
|
||||
// But 256k is large enough for all TS videos(< 200k).
|
||||
byte[] fileBuffer = new byte[256000];
|
||||
int maxCbfzSize = 256000;
|
||||
int vtprSize = 0;
|
||||
int currentChunkBuffer = 0;
|
||||
int chunkBufferOffset = 0;
|
||||
|
||||
@@ -29,9 +29,15 @@ namespace OpenRA
|
||||
// Used for verifying map availability in the lobby
|
||||
public enum MapRuleStatus { Unknown, Cached, Invalid }
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1304:NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1304:NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1310:FieldNamesMustNotContainUnderscore",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
public class RemoteMapData
|
||||
{
|
||||
public readonly string title;
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace OpenRA
|
||||
|
||||
public class TileSet
|
||||
{
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase", "EditorTemplateOrder", "IgnoreTileSpriteOffsets", "MaximumHeight" };
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase",
|
||||
"EditorTemplateOrder", "IgnoreTileSpriteOffsets", "MaximumHeight" };
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string Id;
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace OpenRA.Network
|
||||
|
||||
if (NatDevice == null || NatDevice.GetType() != typeof(Mono.Nat.Upnp.UpnpNatDevice))
|
||||
{
|
||||
Log.Write("server", "No NAT devices with UPnP enabled found within {0} ms deadline. Disabling automatic port forwarding.".F(Game.Settings.Server.NatDiscoveryTimeout));
|
||||
Log.Write("server",
|
||||
"No NAT devices with UPnP enabled found within {0} ms deadline. Disabling automatic port forwarding.".F(Game.Settings.Server.NatDiscoveryTimeout));
|
||||
Game.Settings.Server.NatDeviceAvailable = false;
|
||||
Game.Settings.Server.AllowPortForward = false;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,8 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
// Returns true if played successfully
|
||||
public static bool PlayPredefined(Ruleset ruleset, Player p, Actor voicedUnit, string type, string definition, string variant, bool relative, WPos pos, float volumeModifier, bool attenuateVolume)
|
||||
public static bool PlayPredefined(Ruleset ruleset, Player p, Actor voicedUnit, string type, string definition, string variant,
|
||||
bool relative, WPos pos, float volumeModifier, bool attenuateVolume)
|
||||
{
|
||||
if (ruleset == null)
|
||||
throw new ArgumentNullException("ruleset");
|
||||
|
||||
@@ -82,8 +82,15 @@ namespace OpenRA.Widgets
|
||||
return ThumbRect.Contains(mi.Location);
|
||||
}
|
||||
|
||||
float ValueFromPx(int x) { return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height); }
|
||||
protected int PxFromValue(float x) { return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue)); }
|
||||
float ValueFromPx(int x)
|
||||
{
|
||||
return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height);
|
||||
}
|
||||
|
||||
protected int PxFromValue(float x)
|
||||
{
|
||||
return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue));
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new SliderWidget(this); }
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ namespace OpenRA.Widgets
|
||||
TextureChannel.Alpha);
|
||||
|
||||
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
||||
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2, RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
videoOrigin = new float2(
|
||||
RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2,
|
||||
RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
|
||||
// Round size to integer pixels. Round up to be consistent with the scale calcuation.
|
||||
videoSize = new float2((int)Math.Ceiling(video.Width * scale), (int)Math.Ceiling(video.Height * AspectRatio * scale));
|
||||
|
||||
@@ -184,7 +184,8 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
else if (o.TargetLocation != CPos.Zero)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
flashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user