Remove unused parameters.

This commit is contained in:
Matthias Mailänder
2022-03-13 12:02:52 +01:00
committed by abcdefg30
parent ea243b8558
commit 0e7ad43425
205 changed files with 451 additions and 455 deletions

View File

@@ -131,7 +131,7 @@ namespace OpenRA
filterNode: n => n.Key.StartsWith(ActorInfo.AbstractActorPrefix, StringComparison.Ordinal));
var weapons = MergeOrDefault("Manifest,Weapons", fs, m.Weapons, null, null,
k => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
k => new WeaponInfo(k.Value));
var voices = MergeOrDefault("Manifest,Voices", fs, m.Voices, null, null,
k => new SoundInfo(k.Value));
@@ -190,7 +190,7 @@ namespace OpenRA
filterNode: n => n.Key.StartsWith(ActorInfo.AbstractActorPrefix, StringComparison.Ordinal));
var weapons = MergeOrDefault("Weapons", fileSystem, m.Weapons, mapWeapons, dr.Weapons,
k => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
k => new WeaponInfo(k.Value));
var voices = MergeOrDefault("Voices", fileSystem, m.Voices, mapVoices, dr.Voices,
k => new SoundInfo(k.Value));

View File

@@ -127,7 +127,7 @@ namespace OpenRA.GameRules
[FieldLoader.LoadUsing(nameof(LoadWarheads))]
public readonly List<IWarhead> Warheads = new List<IWarhead>();
public WeaponInfo(string name, MiniYaml content)
public WeaponInfo(MiniYaml content)
{
// Resolve any weapon-level yaml inheritance or removals
// HACK: The "Defaults" sequence syntax prevents us from doing this generally during yaml parsing

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Graphics
ZOffset = zOffset;
}
public IRenderable[] Render(Actor self, WorldRenderer wr, PaletteReference pal)
public IRenderable[] Render(Actor self, PaletteReference pal)
{
var center = self.CenterPosition;
var offset = OffsetFunc?.Invoke() ?? WVec.Zero;

View File

@@ -84,6 +84,7 @@ namespace OpenRA.Graphics
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")]
public PlaceholderModelSequenceLoader(ModData modData) { }
public IModelCache CacheModels(IReadOnlyFileSystem fileSystem, ModData modData, IReadOnlyDictionary<string, MiniYamlNode> modelDefinitions)

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Graphics
shader.SetTexture("Palette", palette);
}
public void SetViewportParams(Size screen, int2 scroll)
public void SetViewportParams()
{
var a = 2f / renderer.SheetSize;
var view = new[]

View File

@@ -261,7 +261,7 @@ namespace OpenRA.Graphics
return new Vertex(xyz, cr, cg, cb, ca, 0, 0);
}
public void FillEllipse(in float3 tl, in float3 br, Color color, int vertices = 32, BlendMode blendMode = BlendMode.Alpha)
public void FillEllipse(in float3 tl, in float3 br, Color color, BlendMode blendMode = BlendMode.Alpha)
{
// TODO: Create an ellipse polygon instead
var a = (br.X - tl.X) / 2;

View File

@@ -56,14 +56,14 @@ namespace OpenRA.Graphics
foreach (var b in waypoints.Skip(1).Select(pos => wr.Viewport.WorldToViewPx(wr.Screen3DPosition(pos))))
{
Game.Renderer.RgbaColorRenderer.DrawLine(a, b, width, color);
DrawTargetMarker(wr, color, b, markerSize);
DrawTargetMarker(color, b, markerSize);
a = b;
}
DrawTargetMarker(wr, color, first);
DrawTargetMarker(color, first);
}
public static void DrawTargetMarker(WorldRenderer wr, Color color, int2 screenPos, int size = 1)
public static void DrawTargetMarker(Color color, int2 screenPos, int size = 1)
{
var offset = new int2(size, size);
var tl = screenPos - offset;

View File

@@ -87,7 +87,7 @@ namespace OpenRA
var sequenceFormat = Manifest.Get<SpriteSequenceFormat>();
var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");
var sequenceCtor = sequenceLoader != null ? sequenceLoader.GetConstructor(new[] { typeof(ModData) }) : null;
var sequenceCtor = sequenceLoader?.GetConstructor(new[] { typeof(ModData) });
if (sequenceLoader == null || !sequenceLoader.GetInterfaces().Contains(typeof(ISpriteSequenceLoader)) || sequenceCtor == null)
throw new InvalidOperationException($"Unable to find a sequence loader for type '{sequenceFormat.Type}'.");

View File

@@ -44,9 +44,8 @@ namespace OpenRA.Orders
public virtual IEnumerable<Order> Order(World world, CPos cell, int2 worldPixel, MouseInput mi)
{
var target = TargetForInput(world, cell, worldPixel, mi);
var actorsAt = world.ActorMap.GetActorsAt(cell).ToList();
var orders = world.Selection.Actors
.Select(a => OrderForUnit(a, target, actorsAt, cell, mi))
.Select(a => OrderForUnit(a, target, cell, mi))
.Where(o => o != null)
.ToList();
@@ -70,7 +69,6 @@ namespace OpenRA.Orders
public virtual string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
{
var target = TargetForInput(world, cell, worldPixel, mi);
var actorsAt = world.ActorMap.GetActorsAt(cell).ToList();
bool useSelect;
if (Game.Settings.Game.UseClassicMouseStyle && !InputOverridesSelection(world, worldPixel, mi))
@@ -78,7 +76,7 @@ namespace OpenRA.Orders
else
{
var ordersWithCursor = world.Selection.Actors
.Select(a => OrderForUnit(a, target, actorsAt, cell, mi))
.Select(a => OrderForUnit(a, target, cell, mi))
.Where(o => o != null && o.Cursor != null);
var cursorOrder = ordersWithCursor.MaxByOrDefault(o => o.Order.OrderPriority);
@@ -120,7 +118,7 @@ namespace OpenRA.Orders
foreach (var a in world.Selection.Actors)
{
var o = OrderForUnit(a, target, actorsAt, cell, mi);
var o = OrderForUnit(a, target, cell, mi);
if (o != null && o.Order.TargetOverridesSelection(a, target, actorsAt, cell, modifiers))
return true;
}
@@ -135,7 +133,7 @@ namespace OpenRA.Orders
/// First priority is given to orders that interact with the given actors.
/// Second priority is given to actors in the given cell.
/// </summary>
static UnitOrderResult OrderForUnit(Actor self, Target target, List<Actor> actorsAt, CPos xy, MouseInput mi)
static UnitOrderResult OrderForUnit(Actor self, Target target, CPos xy, MouseInput mi)
{
if (mi.Button != Game.Settings.Game.MouseButtonPreference.Action)
return null;
@@ -174,7 +172,7 @@ namespace OpenRA.Orders
{
var localModifiers = modifiers;
string cursor = null;
if (o.Order.CanTarget(self, target, actorsAt, ref localModifiers, ref cursor))
if (o.Order.CanTarget(self, target, ref localModifiers, ref cursor))
return new UnitOrderResult(self, o.Order, o.Trait, cursor, target);
}

View File

@@ -254,7 +254,7 @@ namespace OpenRA
if (lastWorldViewport != worldViewport)
{
WorldSpriteRenderer.SetViewportParams(worldSheet.Size, worldDownscaleFactor, depthMargin, worldViewport.Location);
WorldModelRenderer.SetViewportParams(worldSheet.Size, worldViewport.Location);
WorldModelRenderer.SetViewportParams();
lastWorldViewport = worldViewport;
}

View File

@@ -252,7 +252,7 @@ namespace OpenRA.Scripting
worldLoaded.Call().Dispose();
}
public void Tick(Actor self)
public void Tick()
{
if (FatalErrorOccurred || disposed)
return;

View File

@@ -108,7 +108,7 @@ namespace OpenRA.Scripting
throw new LuaException($"The property '{Member.Name}' is write-only");
}
public void Set(LuaRuntime runtime, LuaValue value)
public void Set(LuaValue value)
{
if (IsSetProperty)
{

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Scripting
if (!members.TryGetValue(name, out var wrapper))
throw new LuaException(MemberNotFoundError(name));
wrapper.Set(runtime, value);
wrapper.Set(value);
}
}
}

View File

@@ -1032,7 +1032,7 @@ namespace OpenRA.Server
}
}
public void ReceivePing(Connection conn, int[] pingHistory, byte queueLength)
public void ReceivePing(Connection conn, int[] pingHistory)
{
// Levels set relative to the default order lag of 3 net ticks (360ms)
// TODO: Adjust this once dynamic lag is implemented
@@ -1389,7 +1389,7 @@ namespace OpenRA.Server
void IServerEvent.Invoke(Server server)
{
server.ReceivePing(connection, pingHistory, queueLength);
server.ReceivePing(connection, pingHistory);
}
}

View File

@@ -195,7 +195,7 @@ namespace OpenRA.Traits
flashAlpha = null;
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
public IEnumerable<IRenderable> Render()
{
if (Shrouded)
return NoRenderables;
@@ -323,7 +323,7 @@ namespace OpenRA.Traits
{
return world.ScreenMap.RenderableFrozenActorsInBox(owner, wr.Viewport.TopLeft, wr.Viewport.BottomRight)
.Where(f => f.Visible)
.SelectMany(ff => ff.Render(wr));
.SelectMany(ff => ff.Render());
}
public IEnumerable<Rectangle> ScreenBounds(Actor self, WorldRenderer wr)

View File

@@ -299,7 +299,7 @@ namespace OpenRA.Traits
sources.Remove(key);
}
public void ExploreProjectedCells(World world, IEnumerable<PPos> cells)
public void ExploreProjectedCells(IEnumerable<PPos> cells)
{
foreach (var puv in cells)
{

View File

@@ -138,7 +138,7 @@ namespace OpenRA.Traits
{
string OrderID { get; }
int OrderPriority { get; }
bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor);
bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor);
bool IsQueued { get; }
bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers);
}

View File

@@ -49,7 +49,7 @@ namespace OpenRA
return self.TraitsImplementing<IVoiced>().Any(x => x.HasVoice(self, voice));
}
public static void PlayVoiceForOrders(this World w, Order[] orders)
public static void PlayVoiceForOrders(this Order[] orders)
{
// Find the first actor with a phrase to say
foreach (var o in orders)