Fix a collection of minor style violations.
This enables several new StyleCopAnalyzer rules to be enabled immediately during migration.
This commit is contained in:
@@ -328,7 +328,7 @@ namespace OpenRA.FileSystem
|
||||
if (!(mod.Package is Folder))
|
||||
return null;
|
||||
|
||||
path = Path.Combine(mod.Package.Name, filename);
|
||||
path = Path.Combine(mod.Package.Name, filename);
|
||||
}
|
||||
else
|
||||
path = Path.Combine(parentPath, filename);
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Graphics
|
||||
new float2(
|
||||
(int)Math.Round(p.X * deviceScale + g.Offset.X, 0) / deviceScale,
|
||||
p.Y + g.Offset.Y / deviceScale),
|
||||
g.Sprite.Size / deviceScale);
|
||||
g.Sprite.Size / deviceScale);
|
||||
|
||||
p += new float2(g.Advance / deviceScale, 0);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace OpenRA.Network
|
||||
var reader = new BinaryReader(networkStream);
|
||||
var serverProtocol = reader.ReadInt32();
|
||||
|
||||
if (ProtocolVersion.Version != serverProtocol)
|
||||
if (serverProtocol != ProtocolVersion.Version)
|
||||
throw new InvalidOperationException(
|
||||
"Protocol version mismatch. Server={0} Client={1}"
|
||||
.F(serverProtocol, ProtocolVersion.Version));
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Network
|
||||
public string IpAddress;
|
||||
public ClientState State = ClientState.Invalid;
|
||||
public int Team;
|
||||
public string Slot; // Slot ID, or null for observer
|
||||
public string Slot; // Slot ID, or null for observer
|
||||
public string Bot; // Bot type, null for real clients
|
||||
public int BotControllerClientIndex; // who added the bot to the slot
|
||||
public bool IsAdmin;
|
||||
@@ -160,8 +160,8 @@ namespace OpenRA.Network
|
||||
|
||||
public class Slot
|
||||
{
|
||||
public string PlayerReference; // PlayerReference to bind against.
|
||||
public bool Closed; // Host has explicitly closed this slot.
|
||||
public string PlayerReference; // PlayerReference to bind against.
|
||||
public bool Closed; // Host has explicitly closed this slot.
|
||||
|
||||
public bool AllowBots;
|
||||
public bool LockFaction;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
@@ -18,8 +19,6 @@ using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
using System.Globalization;
|
||||
|
||||
class SyncReport
|
||||
{
|
||||
const int NumSyncReports = 5;
|
||||
|
||||
@@ -123,18 +123,18 @@ namespace OpenRA.Scripting
|
||||
|
||||
public sealed class ScriptContext : IDisposable
|
||||
{
|
||||
public World World { get; private set; }
|
||||
public WorldRenderer WorldRenderer { get; private set; }
|
||||
|
||||
readonly MemoryConstrainedLuaRuntime runtime;
|
||||
readonly LuaFunction tick;
|
||||
|
||||
// Restrict user scripts (excluding system libraries) to 50 MB of memory use
|
||||
const int MaxUserScriptMemory = 50 * 1024 * 1024;
|
||||
|
||||
// Restrict the number of instructions that will be run per map function call
|
||||
const int MaxUserScriptInstructions = 1000000;
|
||||
|
||||
public World World { get; private set; }
|
||||
public WorldRenderer WorldRenderer { get; private set; }
|
||||
|
||||
readonly MemoryConstrainedLuaRuntime runtime;
|
||||
readonly LuaFunction tick;
|
||||
|
||||
readonly Type[] knownActorCommands;
|
||||
public readonly Cache<ActorInfo, Type[]> ActorCommands;
|
||||
public readonly Type[] PlayerCommands;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA
|
||||
{
|
||||
if (isClick)
|
||||
{
|
||||
var adjNewSelection = newSelection.Take(1); /* TODO: select BEST, not FIRST */
|
||||
var adjNewSelection = newSelection.Take(1); // TODO: select BEST, not FIRST
|
||||
if (isCombine)
|
||||
actors.SymmetricExceptWith(adjNewSelection);
|
||||
else
|
||||
@@ -163,7 +163,7 @@ namespace OpenRA
|
||||
if (!mods.HasModifier(Modifiers.Shift))
|
||||
controlGroups[group].Clear();
|
||||
|
||||
for (var i = 0; i < 10; i++) /* all control groups */
|
||||
for (var i = 0; i < 10; i++) // all control groups
|
||||
controlGroups[i].RemoveAll(a => actors.Contains(a));
|
||||
|
||||
controlGroups[group].AddRange(actors.Where(a => a.Owner == world.LocalPlayer));
|
||||
|
||||
@@ -102,7 +102,9 @@ namespace OpenRA.Server
|
||||
Log.Write("server", "Dropping client {0} for excessive order length = {1}", PlayerIndex, ExpectLength);
|
||||
return;
|
||||
}
|
||||
} break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ReceiveState.Data:
|
||||
{
|
||||
@@ -112,7 +114,9 @@ namespace OpenRA.Server
|
||||
server.DispatchOrders(this, Frame, bytes);
|
||||
ExpectLength = 8;
|
||||
State = ReceiveState.Header;
|
||||
} break;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace OpenRA
|
||||
var lsq = x * x + y * y + z * z + w * w;
|
||||
|
||||
// Quaternion components use 10 bits, so there's no risk of overflow
|
||||
#pragma warning disable SA1115 // Allow blank lines to visually separate matrix rows
|
||||
mtx = new Int32Matrix4x4(
|
||||
lsq - 2 * (y * y + z * z),
|
||||
2 * (x * y + z * w),
|
||||
@@ -90,6 +91,7 @@ namespace OpenRA
|
||||
0,
|
||||
0,
|
||||
lsq);
|
||||
#pragma warning restore SA1115
|
||||
}
|
||||
|
||||
public Int32Matrix4x4 AsMatrix()
|
||||
|
||||
Reference in New Issue
Block a user