From 0e7ad4342578b420ab35c5921f51ee1cef9da618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 13 Mar 2022 12:02:52 +0100 Subject: [PATCH] Remove unused parameters. --- .editorconfig | 3 ++ OpenRA.Game/GameRules/Ruleset.cs | 4 +- OpenRA.Game/GameRules/WeaponInfo.cs | 2 +- OpenRA.Game/Graphics/AnimationWithOffset.cs | 2 +- OpenRA.Game/Graphics/Model.cs | 1 + OpenRA.Game/Graphics/ModelRenderer.cs | 2 +- OpenRA.Game/Graphics/RgbaColorRenderer.cs | 2 +- OpenRA.Game/Graphics/TargetLineRenderable.cs | 6 +-- OpenRA.Game/ModData.cs | 2 +- OpenRA.Game/Orders/UnitOrderGenerator.cs | 12 +++--- OpenRA.Game/Renderer.cs | 2 +- OpenRA.Game/Scripting/ScriptContext.cs | 2 +- OpenRA.Game/Scripting/ScriptMemberWrapper.cs | 2 +- OpenRA.Game/Scripting/ScriptObjectWrapper.cs | 2 +- OpenRA.Game/Server/Server.cs | 4 +- OpenRA.Game/Traits/Player/FrozenActorLayer.cs | 4 +- OpenRA.Game/Traits/Player/Shroud.cs | 2 +- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Game/VoiceExts.cs | 2 +- OpenRA.Mods.Cnc/Activities/Leap.cs | 4 +- OpenRA.Mods.Cnc/Activities/LeapAttack.cs | 2 +- .../Graphics/VoxelModelSequenceLoader.cs | 1 + .../Traits/Attack/AttackTDGunboatTurreted.cs | 6 +-- .../Traits/DrainPrerequisitePowerOnDamage.cs | 4 +- .../Infiltration/InfiltrateForExploration.cs | 4 +- .../Traits/Infiltration/Infiltrates.cs | 6 +-- OpenRA.Mods.Cnc/Traits/Minelayer.cs | 2 +- OpenRA.Mods.Cnc/Traits/PortableChrono.cs | 2 +- OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs | 2 +- .../Render/WithDisguisingInfantryBody.cs | 2 +- .../Traits/Render/WithDockingOverlay.cs | 2 +- .../Traits/Render/WithVoxelUnloadBody.cs | 4 +- .../Traits/Render/WithVoxelWalkerBody.cs | 2 +- OpenRA.Mods.Cnc/Traits/ResourcePurifier.cs | 4 +- .../GrantPrerequisiteChargeDrainPower.cs | 8 ++-- ...ansferTimedExternalConditionOnTransform.cs | 2 +- .../ImportRedAlertLegacyMapCommand.cs | 2 +- .../Activities/Air/FlyAttack.cs | 12 +++--- .../Activities/DeliverResources.cs | 2 +- OpenRA.Mods.Common/Activities/DeliverUnit.cs | 2 +- .../Activities/DeployForGrantedCondition.cs | 4 +- .../Activities/FindAndDeliverResources.cs | 12 +++--- .../Activities/HarvestResource.cs | 2 +- .../Activities/HarvesterDockSequence.cs | 2 +- .../Activities/Move/LocalMoveIntoTarget.cs | 2 +- OpenRA.Mods.Common/Activities/Move/Move.cs | 6 +-- OpenRA.Mods.Common/Activities/PickupUnit.cs | 2 +- .../EditorBrushes/EditorTileBrush.cs | 4 +- .../Effects/RallyPointIndicator.cs | 4 +- OpenRA.Mods.Common/FileFormats/Blast.cs | 10 ++--- .../Graphics/DefaultSpriteSequence.cs | 1 + .../SelectionBarsAnnotationRenderable.cs | 12 +++--- OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs | 8 ++-- .../Lint/CheckLocomotorReferences.cs | 4 +- OpenRA.Mods.Common/Lint/CheckPalettes.cs | 4 +- OpenRA.Mods.Common/Lint/CheckSequences.cs | 4 +- .../Orders/DeployOrderTargeter.cs | 2 +- .../Orders/PlaceBuildingOrderGenerator.cs | 2 +- .../Orders/UnitOrderTargeter.cs | 2 +- OpenRA.Mods.Common/Projectiles/Missile.cs | 14 +++---- OpenRA.Mods.Common/Scripting/LuaScript.cs | 2 +- .../Properties/ConditionProperties.cs | 4 +- .../Properties/PlayerConditionProperties.cs | 4 +- OpenRA.Mods.Common/Terrain/DefaultTerrain.cs | 1 + .../Traits/AcceptsDeliveredExperience.cs | 4 +- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 2 +- OpenRA.Mods.Common/Traits/Air/AttackBomber.cs | 2 +- OpenRA.Mods.Common/Traits/AmmoPool.cs | 4 +- OpenRA.Mods.Common/Traits/Armament.cs | 2 +- OpenRA.Mods.Common/Traits/Armor.cs | 4 +- .../Traits/Attack/AttackBase.cs | 6 +-- .../Traits/Attack/AttackFollow.cs | 4 +- .../Traits/Attack/AttackGarrisoned.cs | 4 +- OpenRA.Mods.Common/Traits/AutoCarryable.cs | 14 +++---- OpenRA.Mods.Common/Traits/AutoCarryall.cs | 2 +- OpenRA.Mods.Common/Traits/AutoTarget.cs | 6 +-- .../Traits/BlocksProjectiles.cs | 4 +- OpenRA.Mods.Common/Traits/BodyOrientation.cs | 2 +- .../BotModuleLogic/BaseBuilderQueueManager.cs | 2 +- .../BotModuleLogic/SupportPowerDecision.cs | 6 +-- .../BotModules/BuildingRepairBotModule.cs | 4 +- .../Traits/BotModules/HarvesterBotModule.cs | 2 +- .../ActorPreviewPlaceBuildingPreview.cs | 2 +- .../Traits/Buildings/BaseProvider.cs | 4 +- OpenRA.Mods.Common/Traits/Buildings/Bridge.cs | 2 +- .../Traits/Buildings/Building.cs | 2 +- .../FootprintPlaceBuildingPreview.cs | 4 +- .../Traits/Buildings/LegacyBridgeHut.cs | 4 +- .../Traits/Buildings/RallyPoint.cs | 2 +- .../Traits/Buildings/Refinery.cs | 8 ++-- .../Buildings/SequencePlaceBuildingPreview.cs | 4 +- .../Buildings/TransformsIntoAircraft.cs | 6 +-- .../Traits/Buildings/TransformsIntoMobile.cs | 2 +- .../Buildings/TransformsIntoTransforms.cs | 4 +- OpenRA.Mods.Common/Traits/Capturable.cs | 4 +- .../Traits/CapturableProgressBar.cs | 4 +- OpenRA.Mods.Common/Traits/CaptureManager.cs | 8 ++-- .../Traits/CaptureProgressBar.cs | 4 +- OpenRA.Mods.Common/Traits/Captures.cs | 4 +- OpenRA.Mods.Common/Traits/Carryable.cs | 4 +- OpenRA.Mods.Common/Traits/Carryall.cs | 6 +-- .../Traits/CombatDebugOverlay.cs | 4 +- .../Traits/Conditions/ExternalCondition.cs | 8 ++-- .../Conditions/GrantConditionOnAttack.cs | 4 +- .../GrantConditionOnCombatantOwner.cs | 4 +- .../GrantConditionOnJumpjetLayer.cs | 6 +-- .../Conditions/GrantConditionOnLayer.cs | 2 +- .../Conditions/GrantConditionOnProduction.cs | 4 +- .../GrantConditionOnSubterraneanLayer.cs | 6 +-- .../Conditions/GrantConditionOnTunnelLayer.cs | 6 +-- .../GrantExternalConditionToCrusher.cs | 8 ++-- .../GrantExternalConditionToProduced.cs | 6 +-- .../Traits/Conditions/GrantRandomCondition.cs | 4 +- .../LineBuildSegmentExternalCondition.cs | 6 +-- .../Conditions/ProximityExternalCondition.cs | 4 +- .../Conditions/ToggleConditionOnOrder.cs | 4 +- OpenRA.Mods.Common/Traits/Crates/Crate.cs | 4 +- .../GrantExternalConditionCrateAction.cs | 6 +-- OpenRA.Mods.Common/Traits/EjectOnDeath.cs | 4 +- OpenRA.Mods.Common/Traits/EngineerRepair.cs | 10 ++--- .../Traits/EngineerRepairable.cs | 4 +- .../Traits/ExplosionOnDamageTransition.cs | 8 ++-- OpenRA.Mods.Common/Traits/GivesExperience.cs | 4 +- OpenRA.Mods.Common/Traits/Harvester.cs | 10 ++--- OpenRA.Mods.Common/Traits/HitShape.cs | 4 +- OpenRA.Mods.Common/Traits/Mobile.cs | 18 ++++----- .../Traits/Modifiers/FrozenUnderFog.cs | 12 +++--- .../Traits/Modifiers/WithColoredOverlay.cs | 4 +- OpenRA.Mods.Common/Traits/OwnerLostAction.cs | 4 +- .../Player/ClassicParallelProductionQueue.cs | 2 +- .../Traits/Player/ClassicProductionQueue.cs | 2 +- .../Traits/Player/ParallelProductionQueue.cs | 6 +-- .../Traits/Player/PlaceBuilding.cs | 2 +- .../Traits/Player/PlayerStatistics.cs | 2 +- .../Traits/Player/ProductionQueue.cs | 12 +++--- OpenRA.Mods.Common/Traits/Pluggable.cs | 2 +- .../Traits/QuantizeFacingsFromSequence.cs | 2 +- .../Traits/Radar/RadarColorFromTerrain.cs | 1 - OpenRA.Mods.Common/Traits/Render/Contrail.cs | 2 +- .../Render/CustomTerrainDebugOverlay.cs | 4 +- .../Traits/Render/DrawLineToTarget.cs | 4 +- OpenRA.Mods.Common/Traits/Render/Hovers.cs | 4 +- .../Traits/Render/LeavesTrails.cs | 6 +-- .../Traits/Render/RenderDetectionCircle.cs | 6 +-- .../Traits/Render/RenderRangeCircle.cs | 6 +-- .../Traits/Render/RenderShroudCircle.cs | 10 ++--- .../Traits/Render/RenderSprites.cs | 14 +++---- .../Traits/Render/WithAttackOverlay.cs | 8 ++-- .../Render/WithBuildingPlacedOverlay.cs | 2 +- .../Traits/Render/WithDockedOverlay.cs | 2 +- .../Traits/Render/WithHarvestOverlay.cs | 2 +- .../Traits/Render/WithIdleOverlay.cs | 2 +- .../Traits/Render/WithMakeAnimation.cs | 10 ++--- .../Traits/Render/WithMakeOverlay.cs | 4 +- .../Traits/Render/WithMuzzleOverlay.cs | 2 +- .../Traits/Render/WithParachute.cs | 2 +- .../Traits/Render/WithProductionOverlay.cs | 2 +- .../Traits/Render/WithRangeCircle.cs | 8 ++-- .../Traits/Render/WithRepairOverlay.cs | 2 +- .../WithSupportPowerActivationOverlay.cs | 2 +- .../Traits/Render/WithVoxelBarrel.cs | 2 +- .../Traits/Render/WithVoxelBody.cs | 2 +- OpenRA.Mods.Common/Traits/RevealOnDeath.cs | 4 +- OpenRA.Mods.Common/Traits/RevealOnFire.cs | 4 +- OpenRA.Mods.Common/Traits/RevealsMap.cs | 10 ++--- .../Traits/Sound/AnnounceOnKill.cs | 4 +- .../Traits/SupportPowers/AirstrikePower.cs | 2 +- .../GrantExternalConditionPower.cs | 4 +- OpenRA.Mods.Common/Traits/Targetable.cs | 4 +- OpenRA.Mods.Common/Traits/ThrowsParticle.cs | 2 +- OpenRA.Mods.Common/Traits/Turreted.cs | 2 +- OpenRA.Mods.Common/Traits/Voiced.cs | 4 +- .../Traits/World/EditorActorLayer.cs | 4 +- .../Traits/World/LegacyBridgeLayer.cs | 2 +- .../Traits/World/MapStartingLocations.cs | 2 +- .../UtilityCommands/CheckYaml.cs | 4 +- .../UtilityCommands/ImportLegacyMapCommand.cs | 8 ++-- .../Warheads/GrantExternalConditionWarhead.cs | 2 +- .../Widgets/ControlGroupsWidget.cs | 2 +- .../Widgets/Logic/AssetBrowserLogic.cs | 4 +- .../Widgets/Logic/Editor/HistoryLogLogic.cs | 3 +- .../Logic/Editor/LayerSelectorLogic.cs | 4 +- .../Logic/Editor/MapEditorTabsLogic.cs | 3 +- .../Logic/Ingame/ClassicProductionLogic.cs | 7 ++-- .../Widgets/Logic/Ingame/CommandBarLogic.cs | 4 +- .../Widgets/Logic/Ingame/DebugLogic.cs | 3 +- .../Logic/Ingame/SupportPowerBinLogic.cs | 2 +- .../Installation/InstallFromDiscLogic.cs | 3 +- .../Logic/Installation/ModContentLogic.cs | 3 +- .../Installation/ModContentPromptLogic.cs | 2 +- .../Logic/Lobby/LatencyTooltipLogic.cs | 2 +- .../Widgets/Logic/Lobby/LobbyLogic.cs | 38 +++++++++---------- .../Widgets/Logic/Lobby/LobbyUtils.cs | 33 ++++++++-------- .../Widgets/Logic/MusicPlayerLogic.cs | 2 +- .../Widgets/Logic/PlayerProfileLogic.cs | 2 +- .../Widgets/MouseAttachmentWidget.cs | 2 +- .../Widgets/ObserverProductionIconsWidget.cs | 2 +- .../Widgets/ProductionPaletteWidget.cs | 4 +- .../Widgets/SupportPowersWidget.cs | 2 +- .../Widgets/ViewportControllerWidget.cs | 2 +- .../WorldInteractionControllerWidget.cs | 2 +- .../Traits/Render/WithDeliveryOverlay.cs | 2 +- OpenRA.Platforms.Default/DefaultPlatform.cs | 2 +- OpenRA.Platforms.Default/DummySoundEngine.cs | 2 +- OpenRA.Platforms.Default/OpenAlSoundEngine.cs | 3 +- 205 files changed, 451 insertions(+), 455 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7250fe72174c..c9cc464d9301 100644 --- a/.editorconfig +++ b/.editorconfig @@ -141,6 +141,9 @@ dotnet_diagnostic.IDE0040.severity = warning # Make field readonly. dotnet_diagnostic.IDE0044.severity = warning +# Unused parameter. +dotnet_diagnostic.IDE0060.severity = warning + # Naming rule violation. dotnet_diagnostic.IDE1006.severity = warning diff --git a/OpenRA.Game/GameRules/Ruleset.cs b/OpenRA.Game/GameRules/Ruleset.cs index dec98412e7fc..77121f06675e 100644 --- a/OpenRA.Game/GameRules/Ruleset.cs +++ b/OpenRA.Game/GameRules/Ruleset.cs @@ -131,7 +131,7 @@ public static Ruleset LoadDefaults(ModData modData) 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 @@ public static Ruleset LoadDefaultsForTileSet(ModData modData, string tileSet) 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)); diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index e322fc86a6fe..64f47a72f3a5 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -127,7 +127,7 @@ public sealed class WeaponInfo [FieldLoader.LoadUsing(nameof(LoadWarheads))] public readonly List Warheads = new List(); - 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 diff --git a/OpenRA.Game/Graphics/AnimationWithOffset.cs b/OpenRA.Game/Graphics/AnimationWithOffset.cs index 0e86a0c8439b..fd975cf4b86f 100644 --- a/OpenRA.Game/Graphics/AnimationWithOffset.cs +++ b/OpenRA.Game/Graphics/AnimationWithOffset.cs @@ -35,7 +35,7 @@ public AnimationWithOffset(Animation a, Func offset, Func disable, F 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; diff --git a/OpenRA.Game/Graphics/Model.cs b/OpenRA.Game/Graphics/Model.cs index 9851a6bfa7eb..bbb19ccf9265 100644 --- a/OpenRA.Game/Graphics/Model.cs +++ b/OpenRA.Game/Graphics/Model.cs @@ -84,6 +84,7 @@ public bool HasModelSequence(string model, string sequence) } } + [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 modelDefinitions) diff --git a/OpenRA.Game/Graphics/ModelRenderer.cs b/OpenRA.Game/Graphics/ModelRenderer.cs index 8bc7ae8e657e..99528a4e0007 100644 --- a/OpenRA.Game/Graphics/ModelRenderer.cs +++ b/OpenRA.Game/Graphics/ModelRenderer.cs @@ -65,7 +65,7 @@ public void SetPalette(ITexture palette) shader.SetTexture("Palette", palette); } - public void SetViewportParams(Size screen, int2 scroll) + public void SetViewportParams() { var a = 2f / renderer.SheetSize; var view = new[] diff --git a/OpenRA.Game/Graphics/RgbaColorRenderer.cs b/OpenRA.Game/Graphics/RgbaColorRenderer.cs index 8057104d13b6..bfbb750d3152 100644 --- a/OpenRA.Game/Graphics/RgbaColorRenderer.cs +++ b/OpenRA.Game/Graphics/RgbaColorRenderer.cs @@ -261,7 +261,7 @@ static Vertex VertexWithColor(in float3 xyz, Color color) 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; diff --git a/OpenRA.Game/Graphics/TargetLineRenderable.cs b/OpenRA.Game/Graphics/TargetLineRenderable.cs index 19fee00827da..7b1fc6fac021 100644 --- a/OpenRA.Game/Graphics/TargetLineRenderable.cs +++ b/OpenRA.Game/Graphics/TargetLineRenderable.cs @@ -56,14 +56,14 @@ public void Render(WorldRenderer wr) 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; diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index b6bbac0c5aa3..bf29c70e13af 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -87,7 +87,7 @@ public ModData(Manifest mod, InstalledMods mods, bool useLoadScreen = false) var sequenceFormat = Manifest.Get(); 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}'."); diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 3380029f2b74..9968580b2f89 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -44,9 +44,8 @@ static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput public virtual IEnumerable 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 @@ public virtual IEnumerable Order(World world, CPos cell, int2 worldPixel, 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 @@ public virtual string GetCursor(World world, CPos cell, int2 worldPixel, MouseIn 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 @@ public virtual bool InputOverridesSelection(World world, int2 xy, MouseInput mi) 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 @@ public virtual bool InputOverridesSelection(World world, int2 xy, MouseInput mi) /// First priority is given to orders that interact with the given actors. /// Second priority is given to actors in the given cell. /// - static UnitOrderResult OrderForUnit(Actor self, Target target, List 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 @@ static UnitOrderResult OrderForUnit(Actor self, Target target, List actor { 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); } diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index e6b6c524017f..ecba784243c2 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -254,7 +254,7 @@ public void BeginWorld(Rectangle worldViewport) if (lastWorldViewport != worldViewport) { WorldSpriteRenderer.SetViewportParams(worldSheet.Size, worldDownscaleFactor, depthMargin, worldViewport.Location); - WorldModelRenderer.SetViewportParams(worldSheet.Size, worldViewport.Location); + WorldModelRenderer.SetViewportParams(); lastWorldViewport = worldViewport; } diff --git a/OpenRA.Game/Scripting/ScriptContext.cs b/OpenRA.Game/Scripting/ScriptContext.cs index f78a050b6759..89db545cc522 100644 --- a/OpenRA.Game/Scripting/ScriptContext.cs +++ b/OpenRA.Game/Scripting/ScriptContext.cs @@ -252,7 +252,7 @@ public void WorldLoaded() worldLoaded.Call().Dispose(); } - public void Tick(Actor self) + public void Tick() { if (FatalErrorOccurred || disposed) return; diff --git a/OpenRA.Game/Scripting/ScriptMemberWrapper.cs b/OpenRA.Game/Scripting/ScriptMemberWrapper.cs index bb58653cf36e..defb0d2631dd 100644 --- a/OpenRA.Game/Scripting/ScriptMemberWrapper.cs +++ b/OpenRA.Game/Scripting/ScriptMemberWrapper.cs @@ -108,7 +108,7 @@ public LuaValue Get(LuaRuntime runtime) throw new LuaException($"The property '{Member.Name}' is write-only"); } - public void Set(LuaRuntime runtime, LuaValue value) + public void Set(LuaValue value) { if (IsSetProperty) { diff --git a/OpenRA.Game/Scripting/ScriptObjectWrapper.cs b/OpenRA.Game/Scripting/ScriptObjectWrapper.cs index 9672492c5d85..a7b2f78921d8 100644 --- a/OpenRA.Game/Scripting/ScriptObjectWrapper.cs +++ b/OpenRA.Game/Scripting/ScriptObjectWrapper.cs @@ -63,7 +63,7 @@ protected void Bind(IEnumerable clrObjects) if (!members.TryGetValue(name, out var wrapper)) throw new LuaException(MemberNotFoundError(name)); - wrapper.Set(runtime, value); + wrapper.Set(value); } } } diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 23df495c1eb3..8daca24ad901 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -1032,7 +1032,7 @@ void InterpretServerOrder(Connection conn, Order o) } } - 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 @@ public ConnectionPingEvent(Connection connection, int[] pingHistory, byte queueL void IServerEvent.Invoke(Server server) { - server.ReceivePing(connection, pingHistory, queueLength); + server.ReceivePing(connection, pingHistory); } } diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index 1fd5a13fca8f..6ced0c96fb90 100644 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -195,7 +195,7 @@ public void Flash(float3 tint) flashAlpha = null; } - public IEnumerable Render(WorldRenderer wr) + public IEnumerable Render() { if (Shrouded) return NoRenderables; @@ -323,7 +323,7 @@ public virtual IEnumerable Render(Actor self, WorldRenderer wr) { 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 ScreenBounds(Actor self, WorldRenderer wr) diff --git a/OpenRA.Game/Traits/Player/Shroud.cs b/OpenRA.Game/Traits/Player/Shroud.cs index 25c64ae7b796..956c4d90a4f4 100644 --- a/OpenRA.Game/Traits/Player/Shroud.cs +++ b/OpenRA.Game/Traits/Player/Shroud.cs @@ -299,7 +299,7 @@ public void RemoveSource(object key) sources.Remove(key); } - public void ExploreProjectedCells(World world, IEnumerable cells) + public void ExploreProjectedCells(IEnumerable cells) { foreach (var puv in cells) { diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 3e79113e7000..e3ce29720615 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -138,7 +138,7 @@ public interface IOrderTargeter { string OrderID { get; } int OrderPriority { get; } - bool CanTarget(Actor self, in Target target, List 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 actorsAt, CPos xy, TargetModifiers modifiers); } diff --git a/OpenRA.Game/VoiceExts.cs b/OpenRA.Game/VoiceExts.cs index 19e8cc1051de..475159ff5194 100644 --- a/OpenRA.Game/VoiceExts.cs +++ b/OpenRA.Game/VoiceExts.cs @@ -49,7 +49,7 @@ public static bool HasVoice(this Actor self, string voice) return self.TraitsImplementing().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) diff --git a/OpenRA.Mods.Cnc/Activities/Leap.cs b/OpenRA.Mods.Cnc/Activities/Leap.cs index 97e51a6cc49b..cd3b48423e16 100644 --- a/OpenRA.Mods.Cnc/Activities/Leap.cs +++ b/OpenRA.Mods.Cnc/Activities/Leap.cs @@ -36,7 +36,7 @@ public class Leap : Activity int ticks = 0; WPos targetPosition; - public Leap(Actor self, in Target target, Mobile mobile, Mobile targetMobile, int speed, AttackLeap attack, EdibleByLeap edible) + public Leap(in Target target, Mobile mobile, Mobile targetMobile, int speed, AttackLeap attack, EdibleByLeap edible) { this.mobile = mobile; this.targetMobile = targetMobile; @@ -93,7 +93,7 @@ public override bool Tick(Actor self) // Update movement which results in movementType set to MovementType.None. // This is needed to prevent the move animation from playing. - mobile.UpdateMovement(self); + mobile.UpdateMovement(); // Revoke the condition before attacking, as it is usually used to pause the attack trait attack.RevokeLeapCondition(self); diff --git a/OpenRA.Mods.Cnc/Activities/LeapAttack.cs b/OpenRA.Mods.Cnc/Activities/LeapAttack.cs index c0c806e5614a..95dfaa6f44d3 100644 --- a/OpenRA.Mods.Cnc/Activities/LeapAttack.cs +++ b/OpenRA.Mods.Cnc/Activities/LeapAttack.cs @@ -138,7 +138,7 @@ public override bool Tick(Actor self) return false; } - QueueChild(new Leap(self, target, mobile, targetMobile, info.Speed.Length, attack, edible)); + QueueChild(new Leap(target, mobile, targetMobile, info.Speed.Length, attack, edible)); // Re-queue the child activities to kill the target if it didn't die in one go return false; diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs index 2800ec6804f0..0f96b500d4a6 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs @@ -21,6 +21,7 @@ public class VoxelModelSequenceLoader : IModelSequenceLoader { public Action OnMissingModelError { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")] public VoxelModelSequenceLoader(ModData modData) { } public IModelCache CacheModels(IReadOnlyFileSystem fileSystem, ModData modData, IReadOnlyDictionary modelSequences) diff --git a/OpenRA.Mods.Cnc/Traits/Attack/AttackTDGunboatTurreted.cs b/OpenRA.Mods.Cnc/Traits/Attack/AttackTDGunboatTurreted.cs index 52c5ba9ac8c0..8cc054cad168 100644 --- a/OpenRA.Mods.Cnc/Traits/Attack/AttackTDGunboatTurreted.cs +++ b/OpenRA.Mods.Cnc/Traits/Attack/AttackTDGunboatTurreted.cs @@ -31,7 +31,7 @@ public AttackTDGunboatTurreted(Actor self, AttackTDGunboatTurretedInfo info) public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor) { - return new AttackTDGunboatTurretedActivity(self, newTarget, allowMove, forceAttack, targetLineColor); + return new AttackTDGunboatTurretedActivity(self, newTarget, forceAttack, targetLineColor); } class AttackTDGunboatTurretedActivity : Activity @@ -42,7 +42,7 @@ class AttackTDGunboatTurretedActivity : Activity readonly Color? targetLineColor; bool hasTicked; - public AttackTDGunboatTurretedActivity(Actor self, in Target target, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public AttackTDGunboatTurretedActivity(Actor self, in Target target, bool forceAttack, Color? targetLineColor = null) { attack = self.Trait(); this.target = target; @@ -66,7 +66,7 @@ public override bool Tick(Actor self) if (hasTicked && attack.RequestedTarget.Type == TargetType.Invalid) return true; - attack.SetRequestedTarget(self, target); + attack.SetRequestedTarget(target); hasTicked = true; } diff --git a/OpenRA.Mods.Cnc/Traits/DrainPrerequisitePowerOnDamage.cs b/OpenRA.Mods.Cnc/Traits/DrainPrerequisitePowerOnDamage.cs index 34b7b50ef6ac..95e62c60b812 100644 --- a/OpenRA.Mods.Cnc/Traits/DrainPrerequisitePowerOnDamage.cs +++ b/OpenRA.Mods.Cnc/Traits/DrainPrerequisitePowerOnDamage.cs @@ -26,14 +26,14 @@ public class DrainPrerequisitePowerOnDamageInfo : ConditionalTraitInfo [Desc("Damage is divided by this number when converting damage to drain ticks.")] public readonly int DamageDivisor = 600; - public override object Create(ActorInitializer init) { return new DrainPrerequisitePowerOnDamage(init.Self, this); } + public override object Create(ActorInitializer init) { return new DrainPrerequisitePowerOnDamage(this); } } public class DrainPrerequisitePowerOnDamage : ConditionalTrait, INotifyOwnerChanged, IDamageModifier { SupportPowerManager spm; - public DrainPrerequisitePowerOnDamage(Actor self, DrainPrerequisitePowerOnDamageInfo info) + public DrainPrerequisitePowerOnDamage(DrainPrerequisitePowerOnDamageInfo info) : base(info) { } protected override void Created(Actor self) diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs index f703932c451e..5b0d53274527 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs @@ -30,14 +30,14 @@ class InfiltrateForExplorationInfo : TraitInfo [Desc("Sound the perpetrator will hear after successful infiltration.")] public readonly string InfiltrationNotification = null; - public override object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); } + public override object Create(ActorInitializer init) { return new InfiltrateForExploration(this); } } class InfiltrateForExploration : INotifyInfiltrated { readonly InfiltrateForExplorationInfo info; - public InfiltrateForExploration(Actor self, InfiltrateForExplorationInfo info) + public InfiltrateForExploration(InfiltrateForExplorationInfo info) { this.info = info; } diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs index ca58dfc6d1f6..f7b218472986 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs @@ -75,7 +75,7 @@ public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool return new Order(order.OrderID, self, target, queued); } - bool IsValidOrder(Actor self, Order order) + bool IsValidOrder(Order order) { if (IsTraitDisabled) return false; @@ -92,7 +92,7 @@ bool IsValidOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order) { - return order.OrderString == "Infiltrate" && IsValidOrder(self, order) + return order.OrderString == "Infiltrate" && IsValidOrder(order) ? Info.Voice : null; } @@ -113,7 +113,7 @@ public bool CanInfiltrateTarget(Actor self, in Target target) public void ResolveOrder(Actor self, Order order) { - if (order.OrderString != "Infiltrate" || !IsValidOrder(self, order) || IsTraitDisabled) + if (order.OrderString != "Infiltrate" || !IsValidOrder(order) || IsTraitDisabled) return; if (!CanInfiltrateTarget(self, order.Target)) diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index 13d9e6e29e13..730e0c11333b 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -360,7 +360,7 @@ public BeginMinefieldOrderTargeter(string cursor) public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Terrain) return false; diff --git a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs index 0c06da55e37a..de4231634db7 100644 --- a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs +++ b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs @@ -178,7 +178,7 @@ public PortableChronoOrderTargeter(string targetCursor) public bool IsQueued { get; protected set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (modifiers.HasModifier(TargetModifiers.ForceMove)) { diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs index 1e4cf589491f..91a3aa36e18a 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs @@ -70,7 +70,7 @@ void ITick.Tick(Actor self) IEnumerable IRender.Render(Actor self, WorldRenderer wr) { - var bodyOrientation = body.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = body.QuantizeOrientation(self.Orientation); var pos = self.CenterPosition; var i = 0; diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithDisguisingInfantryBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithDisguisingInfantryBody.cs index 8b0bbacce605..6d17f0c17b22 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithDisguisingInfantryBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithDisguisingInfantryBody.cs @@ -60,7 +60,7 @@ protected override void Tick(Actor self) .FirstOrDefault(t => t.EnabledByDefault); if (renderSprites != null && infantryBody != null) { - disguiseImage = renderSprites.GetImage(disguiseActor, self.World.Map.Rules.Sequences, disguisePlayer.Faction.InternalName); + disguiseImage = renderSprites.GetImage(disguiseActor, disguisePlayer.Faction.InternalName); disguiseInfantryBody = infantryBody; } } diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithDockingOverlay.cs b/OpenRA.Mods.Cnc/Traits/Render/WithDockingOverlay.cs index a377b42f70eb..4689b4c1d64a 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithDockingOverlay.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithDockingOverlay.cs @@ -52,7 +52,7 @@ public WithDockingOverlay(Actor self, WithDockingOverlayInfo info) overlay.Play(info.Sequence); WithOffset = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => !Visible || IsTraitDisabled); rs.Add(WithOffset, info.Palette, info.IsPlayerPalette); diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelUnloadBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelUnloadBody.cs index f7035e57695d..8e111603659d 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelUnloadBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelUnloadBody.cs @@ -59,7 +59,7 @@ public WithVoxelUnloadBody(Actor self, WithVoxelUnloadBodyInfo info) var idleModel = self.World.ModelCache.GetModelSequence(rv.Image, info.IdleSequence); modelAnimation = new ModelAnimation(idleModel, () => WVec.Zero, - () => body.QuantizeOrientation(self, self.Orientation), + () => body.QuantizeOrientation(self.Orientation), () => Docked, () => 0, info.ShowShadow); @@ -67,7 +67,7 @@ public WithVoxelUnloadBody(Actor self, WithVoxelUnloadBodyInfo info) var unloadModel = self.World.ModelCache.GetModelSequence(rv.Image, info.UnloadSequence); rv.Add(new ModelAnimation(unloadModel, () => WVec.Zero, - () => body.QuantizeOrientation(self, self.Orientation), + () => body.QuantizeOrientation(self.Orientation), () => !Docked, () => 0, info.ShowShadow)); } diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs index 009fcc760ff1..551852c2e619 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs @@ -64,7 +64,7 @@ public WithVoxelWalkerBody(Actor self, WithVoxelWalkerBodyInfo info) var model = self.World.ModelCache.GetModelSequence(rv.Image, info.Sequence); frames = model.Frames; modelAnimation = new ModelAnimation(model, () => WVec.Zero, - () => body.QuantizeOrientation(self, self.Orientation), + () => body.QuantizeOrientation(self.Orientation), () => IsTraitDisabled, () => frame, info.ShowShadow); rv.Add(modelAnimation); diff --git a/OpenRA.Mods.Cnc/Traits/ResourcePurifier.cs b/OpenRA.Mods.Cnc/Traits/ResourcePurifier.cs index fe78407c4ecb..0d1ba74bd62f 100644 --- a/OpenRA.Mods.Cnc/Traits/ResourcePurifier.cs +++ b/OpenRA.Mods.Cnc/Traits/ResourcePurifier.cs @@ -31,7 +31,7 @@ public class ResourcePurifierInfo : ConditionalTraitInfo [Desc("How often the cash ticks can appear.")] public readonly int TickRate = 10; - public override object Create(ActorInitializer init) { return new ResourcePurifier(init.Self, this); } + public override object Create(ActorInitializer init) { return new ResourcePurifier(this); } } public class ResourcePurifier : ConditionalTrait, INotifyResourceAccepted, ITick, INotifyOwnerChanged @@ -42,7 +42,7 @@ public class ResourcePurifier : ConditionalTrait, INotifyR int currentDisplayTick; int currentDisplayValue; - public ResourcePurifier(Actor self, ResourcePurifierInfo info) + public ResourcePurifier(ResourcePurifierInfo info) : base(info) { modifier = new int[] { Info.Modifier }; diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs index 13db509015c0..f211ce0fe398 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/GrantPrerequisiteChargeDrainPower.cs @@ -70,13 +70,13 @@ public override SupportPowerInstance CreateInstance(string key, SupportPowerMana return new DischargeableSupportPowerInstance(key, info, manager); } - public void Activate(Actor self, SupportPowerInstance instance) + public void Activate(Actor self) { active = true; techTree.ActorChanged(self); } - public void Deactivate(Actor self, SupportPowerInstance instance) + public void Deactivate(Actor self) { active = false; techTree.ActorChanged(self); @@ -119,7 +119,7 @@ void Deactivate() available = false; foreach (var p in Instances) - ((GrantPrerequisiteChargeDrainPower)p).Deactivate(p.Self, this); + ((GrantPrerequisiteChargeDrainPower)p).Deactivate(p.Self); } public override void Tick() @@ -178,7 +178,7 @@ public override void Activate(Order order) power.PlayLaunchSounds(); foreach (var p in Instances) - ((GrantPrerequisiteChargeDrainPower)p).Activate(p.Self, this); + ((GrantPrerequisiteChargeDrainPower)p).Activate(p.Self); } public override string IconOverlayTextOverride() diff --git a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs index b58e256522cc..c651a8f93e5e 100644 --- a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs +++ b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs @@ -47,7 +47,7 @@ void INotifyTransform.AfterTransform(Actor toActor) return; var external = toActor.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == info.Condition && t.CanGrantCondition(toActor, this)); + .FirstOrDefault(t => t.Info.Condition == info.Condition && t.CanGrantCondition(this)); external?.GrantCondition(toActor, this, duration, remaining); } diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs index 17433278d9db..eb5cab7004f0 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs @@ -239,7 +239,7 @@ public override void ReadPacks(IniFile file, string filename) public override void ReadActors(IniFile file) { base.ReadActors(file); - LoadActors(file, "SHIPS", Players, MapSize, Map); + LoadActors(file, "SHIPS", Players, Map); } public override void SaveWaypoint(int waypointNumber, ActorReference waypointReference) diff --git a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs index fb8c3b748bab..83ac7a757651 100644 --- a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs +++ b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs @@ -91,7 +91,7 @@ public override bool Tick(Actor self) return false; target = target.Recalculate(self.Owner, out var targetIsHiddenActor); - attackAircraft.SetRequestedTarget(self, target, forceAttack); + attackAircraft.SetRequestedTarget(target, forceAttack); hasTicked = true; if (!targetIsHiddenActor && target.Type == TargetType.Actor) @@ -171,9 +171,9 @@ public override bool Tick(Actor self) // The aircraft must keep moving forward even if it is already in an ideal position. else if (attackAircraft.Info.AttackType == AirAttackType.Strafe) - QueueChild(new StrafeAttackRun(self, attackAircraft, aircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange)); + QueueChild(new StrafeAttackRun(attackAircraft, aircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange)); else if (attackAircraft.Info.AttackType == AirAttackType.Default && !aircraft.Info.CanHover) - QueueChild(new FlyAttackRun(self, target, lastVisibleMaximumRange, attackAircraft)); + QueueChild(new FlyAttackRun(target, lastVisibleMaximumRange, attackAircraft)); // Turn to face the target if required. else if (!attackAircraft.TargetInFiringArc(self, target, attackAircraft.Info.FacingTolerance)) @@ -220,7 +220,7 @@ class FlyAttackRun : Activity Target target; bool targetIsVisibleActor; - public FlyAttackRun(Actor self, in Target t, WDist exitRange, AttackAircraft attack) + public FlyAttackRun(in Target t, WDist exitRange, AttackAircraft attack) { ChildHasPriority = false; @@ -269,7 +269,7 @@ class StrafeAttackRun : Activity Target target; - public StrafeAttackRun(Actor self, AttackAircraft attackAircraft, Aircraft aircraft, in Target t, WDist exitRange) + public StrafeAttackRun(AttackAircraft attackAircraft, Aircraft aircraft, in Target t, WDist exitRange) { ChildHasPriority = false; @@ -304,7 +304,7 @@ public override bool Tick(Actor self) // Update the position if we seen the target move; keep the previous one if it dies or disappears target = target.Recalculate(self.Owner, out var targetIsHiddenActor); if (!targetIsHiddenActor && target.Type == TargetType.Actor) - attackAircraft.SetRequestedTarget(self, Target.FromTargetPositions(target), true); + attackAircraft.SetRequestedTarget(Target.FromTargetPositions(target), true); return false; } diff --git a/OpenRA.Mods.Common/Activities/DeliverResources.cs b/OpenRA.Mods.Common/Activities/DeliverResources.cs index 87ce047ed655..20e8f483f4da 100644 --- a/OpenRA.Mods.Common/Activities/DeliverResources.cs +++ b/OpenRA.Mods.Common/Activities/DeliverResources.cs @@ -37,7 +37,7 @@ public DeliverResources(Actor self, Actor targetActor = null) protected override void OnFirstRun(Actor self) { if (targetActor != null && targetActor.IsInWorld) - harv.LinkProc(self, targetActor); + harv.LinkProc(targetActor); } public override bool Tick(Actor self) diff --git a/OpenRA.Mods.Common/Activities/DeliverUnit.cs b/OpenRA.Mods.Common/Activities/DeliverUnit.cs index 56d737e5994a..905abcadf597 100644 --- a/OpenRA.Mods.Common/Activities/DeliverUnit.cs +++ b/OpenRA.Mods.Common/Activities/DeliverUnit.cs @@ -88,7 +88,7 @@ protected override void OnFirstRun(Actor self) self.Trait().RemoveInfluence(); - var localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation)); + var localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation)); var targetPosition = self.CenterPosition + body.LocalToWorld(localOffset); var targetLocation = self.World.Map.CellContaining(targetPosition); carryall.Carryable.Trait().SetPosition(carryall.Carryable, targetLocation, SubCell.FullCell); diff --git a/OpenRA.Mods.Common/Activities/DeployForGrantedCondition.cs b/OpenRA.Mods.Common/Activities/DeployForGrantedCondition.cs index e0e765739674..21137a2d6c9d 100644 --- a/OpenRA.Mods.Common/Activities/DeployForGrantedCondition.cs +++ b/OpenRA.Mods.Common/Activities/DeployForGrantedCondition.cs @@ -40,7 +40,7 @@ public override bool Tick(Actor self) if (IsCanceling || (deploy.DeployState != DeployState.Deployed && moving)) return true; - QueueChild(new DeployInner(self, deploy)); + QueueChild(new DeployInner(deploy)); return true; } } @@ -50,7 +50,7 @@ public class DeployInner : Activity readonly GrantConditionOnDeploy deployment; bool initiated; - public DeployInner(Actor self, GrantConditionOnDeploy deployment) + public DeployInner(GrantConditionOnDeploy deployment) { this.deployment = deployment; diff --git a/OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs b/OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs index 7d86ed812087..ca07ddace31b 100644 --- a/OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs +++ b/OpenRA.Mods.Common/Activities/FindAndDeliverResources.cs @@ -159,19 +159,19 @@ public override bool Tick(Actor self) // Harvesters should respect an explicit harvest order instead of harvesting the current cell. if (orderLocation == null) { - if (harv.CanHarvestCell(self, self.Location) && claimLayer.CanClaimCell(self, self.Location)) + if (harv.CanHarvestCell(self.Location) && claimLayer.CanClaimCell(self, self.Location)) return self.Location; } else { - if (harv.CanHarvestCell(self, orderLocation.Value) && claimLayer.CanClaimCell(self, orderLocation.Value)) + if (harv.CanHarvestCell(orderLocation.Value) && claimLayer.CanClaimCell(self, orderLocation.Value)) return orderLocation; orderLocation = null; } // Determine where to search from and how far to search: - var procLoc = GetSearchFromProcLocation(self); + var procLoc = GetSearchFromProcLocation(); var searchFromLoc = lastHarvestedCell ?? procLoc ?? self.Location; var searchRadius = lastHarvestedCell.HasValue ? harvInfo.SearchFromHarvesterRadius : harvInfo.SearchFromProcRadius; @@ -186,7 +186,7 @@ public override bool Tick(Actor self) using (var search = PathSearch.ToTargetCellByPredicate( self.World, mobile.Locomotor, self, new[] { searchFromLoc, self.Location }, loc => - harv.CanHarvestCell(self, loc) && + harv.CanHarvestCell(loc) && claimLayer.CanClaimCell(self, loc), BlockedByActor.Stationary, loc => @@ -196,7 +196,7 @@ public override bool Tick(Actor self) // Add a cost modifier to harvestable cells to prefer resources that are closer to the refinery. // This reduces the tendency for harvesters to move in straight lines - if (procPos.HasValue && harvInfo.ResourceRefineryDirectionPenalty > 0 && harv.CanHarvestCell(self, loc)) + if (procPos.HasValue && harvInfo.ResourceRefineryDirectionPenalty > 0 && harv.CanHarvestCell(loc)) { var pos = map.CenterOfCell(loc); @@ -244,7 +244,7 @@ public override IEnumerable TargetLineNodes(Actor self) yield return new TargetLineNode(Target.FromActor(deliverActor), harvInfo.DeliverLineColor); } - CPos? GetSearchFromProcLocation(Actor self) + CPos? GetSearchFromProcLocation() { if (harv.LastLinkedProc != null && !harv.LastLinkedProc.IsDead && harv.LastLinkedProc.IsInWorld) return harv.LastLinkedProc.Location + harv.LastLinkedProc.Trait().DeliveryOffset; diff --git a/OpenRA.Mods.Common/Activities/HarvestResource.cs b/OpenRA.Mods.Common/Activities/HarvestResource.cs index 56191f8218da..7b4483bb485c 100644 --- a/OpenRA.Mods.Common/Activities/HarvestResource.cs +++ b/OpenRA.Mods.Common/Activities/HarvestResource.cs @@ -68,7 +68,7 @@ public override bool Tick(Actor self) return false; } - if (!harv.CanHarvestCell(self, self.Location)) + if (!harv.CanHarvestCell(self.Location)) return true; // Turn to one of the harvestable facings diff --git a/OpenRA.Mods.Common/Activities/HarvesterDockSequence.cs b/OpenRA.Mods.Common/Activities/HarvesterDockSequence.cs index fbf57459a5f3..973b59da54e0 100644 --- a/OpenRA.Mods.Common/Activities/HarvesterDockSequence.cs +++ b/OpenRA.Mods.Common/Activities/HarvesterDockSequence.cs @@ -88,7 +88,7 @@ public override bool Tick(Actor self) case DockingState.Complete: Harv.LastLinkedProc = Harv.LinkedProc; - Harv.LinkProc(self, null); + Harv.LinkProc(null); if (IsDragRequired) QueueChild(new Drag(self, EndDrag, StartDrag, DragLength)); diff --git a/OpenRA.Mods.Common/Activities/Move/LocalMoveIntoTarget.cs b/OpenRA.Mods.Common/Activities/Move/LocalMoveIntoTarget.cs index 485ead0c25d5..a709c4bcbfe5 100644 --- a/OpenRA.Mods.Common/Activities/Move/LocalMoveIntoTarget.cs +++ b/OpenRA.Mods.Common/Activities/Move/LocalMoveIntoTarget.cs @@ -63,7 +63,7 @@ public override bool Tick(Actor self) } // Can complete the move in this step - var speed = mobile.MovementSpeedForCell(self, self.Location); + var speed = mobile.MovementSpeedForCell(self.Location); if (delta.LengthSquared <= speed * speed) { mobile.SetCenterPosition(self, targetPos); diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs index ef957a794b9a..d84574b58f94 100644 --- a/OpenRA.Mods.Common/Activities/Move/Move.cs +++ b/OpenRA.Mods.Common/Activities/Move/Move.cs @@ -415,7 +415,7 @@ public override bool Tick(Actor self) // Only move by a full speed step if we didn't already move this tick. // If we did, we limit the move to any carried-over leftover progress. if (Move.lastMovePartCompletedTick < self.World.WorldTick) - progress += mobile.MovementSpeedForCell(self, mobile.ToCell); + progress += mobile.MovementSpeedForCell(mobile.ToCell); if (progress >= Distance) { @@ -448,13 +448,13 @@ public override bool Tick(Actor self) { var currentCellOrientation = self.World.Map.TerrainOrientation(mobile.FromCell); var orientation = WRot.SLerp(FromTerrainOrientation.Value, currentCellOrientation, progress, terrainOrientationMargin); - mobile.SetTerrainRampOrientation(self, orientation); + mobile.SetTerrainRampOrientation(orientation); } else if (ToTerrainOrientation.HasValue && Distance - progress < terrainOrientationMargin) { var currentCellOrientation = self.World.Map.TerrainOrientation(mobile.FromCell); var orientation = WRot.SLerp(ToTerrainOrientation.Value, currentCellOrientation, Distance - progress, terrainOrientationMargin); - mobile.SetTerrainRampOrientation(self, orientation); + mobile.SetTerrainRampOrientation(orientation); } mobile.Facing = WAngle.Lerp(FromFacing, ToFacing, progress, Distance); diff --git a/OpenRA.Mods.Common/Activities/PickupUnit.cs b/OpenRA.Mods.Common/Activities/PickupUnit.cs index 0063afd786d7..020d442b9c59 100644 --- a/OpenRA.Mods.Common/Activities/PickupUnit.cs +++ b/OpenRA.Mods.Common/Activities/PickupUnit.cs @@ -97,7 +97,7 @@ public override bool Tick(Actor self) // Pickup position and facing are now known - swap the fly/wait activity with Land ChildActivity.Cancel(self); - var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(self, cargo.Orientation)); + var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(cargo.Orientation)); QueueChild(new Land(self, Target.FromActor(cargo), -carryableBody.LocalToWorld(localOffset), carryableFacing.Facing)); // Pause briefly before attachment for visual effect diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index d346baf44a03..013906e885ac 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -92,7 +92,7 @@ public bool HandleMouseInput(MouseInput mi) if (mi.Modifiers.HasModifier(Modifiers.Shift)) { - FloodFillWithBrush(cell, isMoving); + FloodFillWithBrush(cell); painting = false; } else @@ -110,7 +110,7 @@ void PaintCell(CPos cell, bool isMoving) editorActionManager.Add(new PaintTileEditorAction(Template, world.Map, cell)); } - void FloodFillWithBrush(CPos cell, bool isMoving) + void FloodFillWithBrush(CPos cell) { var map = world.Map; var mapTiles = map.Tiles; diff --git a/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs b/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs index 149d0d2f3ea7..e2e8b6be4475 100644 --- a/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs +++ b/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs @@ -113,10 +113,10 @@ IEnumerable IEffectAnnotation.RenderAnnotation(WorldRenderer wr) if (targetLineNodes.Count == 0) return SpriteRenderable.None; - return RenderInner(wr); + return RenderInner(); } - IEnumerable RenderInner(WorldRenderer wr) + IEnumerable RenderInner() { var prev = targetLineNodes[0]; foreach (var pos in targetLineNodes.Skip(1)) diff --git a/OpenRA.Mods.Common/FileFormats/Blast.cs b/OpenRA.Mods.Common/FileFormats/Blast.cs index 5869ddc5174f..6f6996f0d61d 100644 --- a/OpenRA.Mods.Common/FileFormats/Blast.cs +++ b/OpenRA.Mods.Common/FileFormats/Blast.cs @@ -59,9 +59,9 @@ public static class Blast 3, 4, 5, 6, 7, 8 }; - static readonly Huffman LitCode = new Huffman(LitLen, LitLen.Length, 256); - static readonly Huffman LenCode = new Huffman(LenLen, LenLen.Length, 16); - static readonly Huffman DistCode = new Huffman(DistLen, DistLen.Length, 64); + static readonly Huffman LitCode = new Huffman(LitLen, 256); + static readonly Huffman LenCode = new Huffman(LenLen, 16); + static readonly Huffman DistCode = new Huffman(DistLen, 64); /// PKWare Compression Library stream. /// Compressed input stream. @@ -247,7 +247,7 @@ class Huffman public short[] Count; // number of symbols of each length public short[] Symbol; // canonically ordered symbols - public Huffman(byte[] rep, int n, short symbolCount) + public Huffman(byte[] rep, short symbolCount) { var length = new short[256]; // code lengths var s = 0; // current symbol @@ -262,7 +262,7 @@ public Huffman(byte[] rep, int n, short symbolCount) while (--num > 0); } - n = s; + var n = s; // count number of codes of each length Count = new short[Blast.MAXBITS + 1]; diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 581c94d05581..79f7983522f7 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -41,6 +41,7 @@ public bool TryGetPaletteForFrame(int frame, out uint[] palette) public class DefaultSpriteSequenceLoader : ISpriteSequenceLoader { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")] public DefaultSpriteSequenceLoader(ModData modData) { } public virtual ISpriteSequence CreateSequence(ModData modData, string tileSet, SpriteCache cache, string sequence, string animation, MiniYaml info) diff --git a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs index 898e5123b940..23d1ebc1ca51 100644 --- a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs @@ -48,7 +48,7 @@ public SelectionBarsAnnotationRenderable(WPos pos, Actor actor, Rectangle decora public IRenderable OffsetBy(in WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); } public IRenderable AsDecoration() { return this; } - void DrawExtraBars(WorldRenderer wr, float2 start, float2 end) + void DrawExtraBars(float2 start, float2 end) { foreach (var extraBar in actor.TraitsImplementing()) { @@ -58,12 +58,12 @@ void DrawExtraBars(WorldRenderer wr, float2 start, float2 end) var offset = new float2(0, 4); start += offset; end += offset; - DrawSelectionBar(wr, start, end, extraBar.GetValue(), extraBar.GetColor()); + DrawSelectionBar(start, end, extraBar.GetValue(), extraBar.GetColor()); } } } - void DrawSelectionBar(WorldRenderer wr, float2 start, float2 end, float value, Color barColor) + void DrawSelectionBar(float2 start, float2 end, float value, Color barColor) { var c = Color.FromArgb(128, 30, 30, 30); var c2 = Color.FromArgb(128, 10, 10, 10); @@ -93,7 +93,7 @@ Color GetHealthColor(IHealth health) health.DamageState == DamageState.Heavy ? Color.Yellow : Color.LimeGreen; } - void DrawHealthBar(WorldRenderer wr, IHealth health, float2 start, float2 end) + void DrawHealthBar(IHealth health, float2 start, float2 end) { if (health == null || health.IsDead) return; @@ -149,10 +149,10 @@ public void Render(WorldRenderer wr) var end = wr.Viewport.WorldToViewPx(new float2(decorationBounds.Right - 1, decorationBounds.Top)); if (DisplayHealth) - DrawHealthBar(wr, health, start, end); + DrawHealthBar(health, start, end); if (DisplayExtra) - DrawExtraBars(wr, start, end); + DrawExtraBars(start, end); } public void RenderDebugGeometry(WorldRenderer wr) { } diff --git a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs index 95001bbf39b6..1c0cbceb834b 100644 --- a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs +++ b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs @@ -59,12 +59,12 @@ public void Run(Action emitError, Action emitWarning, ModData mo foreach (var filename in modData.Manifest.ChromeLayout) { var yaml = MiniYaml.FromStream(modData.DefaultFileSystem.Open(filename), filename); - CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, yaml, filename, null, emitError, emitWarning); + CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, yaml, filename, null, emitError); } } void CheckInner(ModData modData, string[] namedKeys, (string Widget, string Field)[] checkWidgetFields, Dictionary> customLintMethods, - List nodes, string filename, MiniYamlNode parent, Action emitError, Action emitWarning) + List nodes, string filename, MiniYamlNode parent, Action emitError) { foreach (var node in nodes) { @@ -86,7 +86,7 @@ public void Run(Action emitError, Action emitWarning, ModData mo if (customLintMethods.TryGetValue(widgetType, out var checkMethods)) { var type = modData.ObjectCreator.FindType(widgetType + "Widget"); - var keyNames = checkMethods.SelectMany(m => (IEnumerable)type.GetMethod(m).Invoke(null, new object[] { node, emitError, emitWarning })); + var keyNames = checkMethods.SelectMany(m => (IEnumerable)type.GetMethod(m).Invoke(null, new object[] { node, emitError })); foreach (var name in keyNames) if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused)) @@ -114,7 +114,7 @@ public void Run(Action emitError, Action emitWarning, ModData mo } if (node.Value.Nodes != null) - CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, node.Value.Nodes, filename, node, emitError, emitWarning); + CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, node.Value.Nodes, filename, node, emitError); } } } diff --git a/OpenRA.Mods.Common/Lint/CheckLocomotorReferences.cs b/OpenRA.Mods.Common/Lint/CheckLocomotorReferences.cs index 290d8611a3f1..795827bd194c 100644 --- a/OpenRA.Mods.Common/Lint/CheckLocomotorReferences.cs +++ b/OpenRA.Mods.Common/Lint/CheckLocomotorReferences.cs @@ -51,14 +51,14 @@ void Run(Action emitError, Ruleset rules) if (string.IsNullOrEmpty(locomotor)) continue; - CheckLocomotors(actorInfo.Value, emitError, rules, locomotorInfos, locomotor); + CheckLocomotors(actorInfo.Value, emitError, locomotorInfos, locomotor); } } } } } - void CheckLocomotors(ActorInfo actorInfo, Action emitError, Ruleset rules, LocomotorInfo[] locomotorInfos, string locomotor) + void CheckLocomotors(ActorInfo actorInfo, Action emitError, LocomotorInfo[] locomotorInfos, string locomotor) { if (!locomotorInfos.Any(l => l.Name == locomotor)) emitError($"Actor {actorInfo.Name} defines Locomotor {locomotor} not found on World actor."); diff --git a/OpenRA.Mods.Common/Lint/CheckPalettes.cs b/OpenRA.Mods.Common/Lint/CheckPalettes.cs index ac838d896dd7..c7390d29dddb 100644 --- a/OpenRA.Mods.Common/Lint/CheckPalettes.cs +++ b/OpenRA.Mods.Common/Lint/CheckPalettes.cs @@ -33,7 +33,7 @@ void Run(Action emitError, Ruleset rules) { var palettes = new List(); var playerPalettes = new List(); - GetPalettes(emitError, rules, palettes, playerPalettes); + GetPalettes(rules, palettes, playerPalettes); foreach (var actorInfo in rules.Actors) { @@ -121,7 +121,7 @@ void Run(Action emitError, Ruleset rules) } } - void GetPalettes(Action emitError, Ruleset rules, List palettes, List playerPalettes) + void GetPalettes(Ruleset rules, List palettes, List playerPalettes) { foreach (var actorInfo in rules.Actors) { diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index dac722c95f24..248a3f61531f 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -47,12 +47,12 @@ void Run(Action emitError, Action emitWarning, Ruleset rules, Se var images = new HashSet() { - renderInfo.GetImage(actorInfo.Value, sequences, null).ToLowerInvariant() + renderInfo.GetImage(actorInfo.Value, null).ToLowerInvariant() }; // Some actors define faction-specific artwork foreach (var faction in factions) - images.Add(renderInfo.GetImage(actorInfo.Value, sequences, faction).ToLowerInvariant()); + images.Add(renderInfo.GetImage(actorInfo.Value, faction).ToLowerInvariant()); foreach (var traitInfo in actorInfo.Value.TraitInfos()) { diff --git a/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs b/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs index 90266c8d6df9..753a600314ef 100644 --- a/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs +++ b/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs @@ -30,7 +30,7 @@ public DeployOrderTargeter(string order, int priority, Func cursor) public int OrderPriority { get; private set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Actor) return false; diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs index 30cda1ca69d8..ca52f818f13d 100644 --- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs @@ -230,7 +230,7 @@ bool AcceptsPlug(CPos cell, PlugInfo plug) { foreach (var a in world.ActorMap.GetActorsAt(cell)) foreach (var p in a.TraitsImplementing()) - if (p.AcceptsPlug(a, plug.Type)) + if (p.AcceptsPlug(plug.Type)) return true; return false; diff --git a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs index 76a22d20b106..e67e7f0b2558 100644 --- a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs +++ b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs @@ -37,7 +37,7 @@ public UnitOrderTargeter(string order, int priority, string cursor, bool targetE public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor); public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor); - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { var type = target.Type; if (type != TargetType.Actor && type != TargetType.FrozenActor) diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 4be6349d1026..e465826ef3ce 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -302,7 +302,7 @@ static int LoopRadius(int speed, int rot) if ((sbyte)vFacing < 0) speed = minSpeed; else if (!WillClimbWithinDistance(vFacing, loopRadius, predClfDist, diffClfMslHgt) - && !WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt, speed)) + && !WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt)) { // Find highest speed greater than the above minimum that allows the missile // to surmount the incline @@ -311,7 +311,7 @@ static int LoopRadius(int speed, int rot) { var lpRds = LoopRadius(spd, info.VerticalRateOfTurn.Facing); return WillClimbWithinDistance(vFac, lpRds, predClfDist, diffClfMslHgt) - || WillClimbAroundInclineTop(vFac, lpRds, predClfDist, diffClfMslHgt, spd); + || WillClimbAroundInclineTop(vFac, lpRds, predClfDist, diffClfMslHgt); }); } else @@ -401,7 +401,7 @@ static bool IsNearInclineTop(int vFacing, int loopRadius, int predClfDist) // Will missile climb around incline top if bringing vertical facing // down to zero on an arc of radius loopRadius // Calling this function only makes sense when IsNearInclineTop returns true - static bool WillClimbAroundInclineTop(int vFacing, int loopRadius, int predClfDist, int diffClfMslHgt, int speed) + static bool WillClimbAroundInclineTop(int vFacing, int loopRadius, int predClfDist, int diffClfMslHgt) { // Vector from missile's current position pointing to the loop's center var radius = new WVec(loopRadius, 0, 0) @@ -523,7 +523,7 @@ int IncreaseAltitude(int predClfDist, int diffClfMslHgt, int relTarHorDist, int // Missile will climb around incline top if bringing vertical facing // down to zero on an arc of radius loopRadius else if (IsNearInclineTop(vFacing, loopRadius, predClfDist) - && WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt, speed)) + && WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt)) desiredVFacing = 0; // Missile will not climb terrAltDiff w-units within hHeightChange w-units @@ -537,7 +537,7 @@ int IncreaseAltitude(int predClfDist, int diffClfMslHgt, int relTarHorDist, int for (var vFac = System.Math.Min(vFacing + info.VerticalRateOfTurn.Facing - 1, 63); vFac >= vFacing; vFac--) if (!WillClimbWithinDistance(vFac, loopRadius, predClfDist, diffClfMslHgt) && !(predClfDist <= loopRadius * (1024 - WAngle.FromFacing(vFac).Sin()) / 1024 - && WillClimbAroundInclineTop(vFac, loopRadius, predClfDist, diffClfMslHgt, speed))) + && WillClimbAroundInclineTop(vFac, loopRadius, predClfDist, diffClfMslHgt))) { desiredVFacing = vFac + 1; break; @@ -568,7 +568,7 @@ int IncreaseAltitude(int predClfDist, int diffClfMslHgt, int relTarHorDist, int } int HomingInnerTick(int predClfDist, int diffClfMslHgt, int relTarHorDist, int lastHtChg, int lastHt, - int nxtRelTarHorDist, int relTarHgt, int vFacing, bool targetPassedBy) + int relTarHgt, int vFacing, bool targetPassedBy) { int desiredVFacing = vFacing; @@ -772,7 +772,7 @@ WVec HomingTick(World world, in WVec tarDistVec, int relTarHorDist) targetPassedBy = false; var desiredVFacing = HomingInnerTick(predClfDist, diffClfMslHgt, relTarHorDist, lastHtChg, lastHt, - nxtRelTarHorDist, relTarHgt, vFacing, targetPassedBy); + relTarHgt, vFacing, targetPassedBy); // The target has been passed by if (tarDistVec.HorizontalLength < speed * WAngle.FromFacing(vFacing).Cos() / 1024) diff --git a/OpenRA.Mods.Common/Scripting/LuaScript.cs b/OpenRA.Mods.Common/Scripting/LuaScript.cs index eafa9667f08f..22391b21f0a4 100644 --- a/OpenRA.Mods.Common/Scripting/LuaScript.cs +++ b/OpenRA.Mods.Common/Scripting/LuaScript.cs @@ -46,7 +46,7 @@ void IWorldLoaded.WorldLoaded(World world, WorldRenderer worldRenderer) void ITick.Tick(Actor self) { - context.Tick(self); + context.Tick(); } void INotifyActorDisposing.Disposing(Actor self) diff --git a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs index 821875aab27f..b0bfd3f2fe47 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/ConditionProperties.cs @@ -34,7 +34,7 @@ public ConditionProperties(ScriptContext context, Actor self) public int GrantCondition(string condition, int duration = 0) { var external = externalConditions - .FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this)); + .FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(this)); if (external == null) throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait"); @@ -54,7 +54,7 @@ public void RevokeCondition(int token) public bool AcceptsCondition(string condition) { return externalConditions - .Any(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this)); + .Any(t => t.Info.Condition == condition && t.CanGrantCondition(this)); } } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerConditionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerConditionProperties.cs index 47e92643967a..fa182db76752 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerConditionProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerConditionProperties.cs @@ -33,7 +33,7 @@ public PlayerConditionProperties(ScriptContext context, Player player) public int GrantCondition(string condition, int duration = 0) { var external = externalConditions - .FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Player.PlayerActor, this)); + .FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(this)); if (external == null) throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait"); @@ -53,7 +53,7 @@ public void RevokeCondition(int token) public bool AcceptsCondition(string condition) { return externalConditions - .Any(t => t.Info.Condition == condition && t.CanGrantCondition(Player.PlayerActor, this)); + .Any(t => t.Info.Condition == condition && t.CanGrantCondition(this)); } } } diff --git a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs index 08015eeeaf4b..211451b70f83 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Terrain { public class DefaultTerrainLoader : ITerrainLoader { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")] public DefaultTerrainLoader(ModData modData) { } public ITerrainInfo ParseTerrain(IReadOnlyFileSystem fileSystem, string path) diff --git a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs index 36a460711a13..c01b93783207 100644 --- a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs +++ b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs @@ -23,11 +23,11 @@ public class AcceptsDeliveredExperienceInfo : TraitInfo, Requires a return modifiers.HasModifier(TargetModifiers.ForceMove); } - public virtual bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public virtual bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Terrain || (aircraft.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove))) return false; diff --git a/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs b/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs index de34c0dcfacb..c9c19f979df1 100644 --- a/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs +++ b/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs @@ -79,7 +79,7 @@ void ITick.Tick(Actor self) OnExitedAttackRange(self); } - public void SetTarget(World w, WPos pos) { target = Target.FromPos(pos); } + public void SetTarget(WPos pos) { target = Target.FromPos(pos); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs index 26a9e6a6754a..8735baadfdea 100644 --- a/OpenRA.Mods.Common/Traits/AmmoPool.cs +++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs @@ -44,7 +44,7 @@ public class AmmoPoolInfo : TraitInfo [Desc("The condition to grant to self for each ammo point in this pool.")] public readonly string AmmoCondition = null; - public override object Create(ActorInitializer init) { return new AmmoPool(init.Self, this); } + public override object Create(ActorInitializer init) { return new AmmoPool(this); } } public class AmmoPool : INotifyCreated, INotifyAttack, ISync @@ -62,7 +62,7 @@ public class AmmoPool : INotifyCreated, INotifyAttack, ISync public bool HasAmmo => CurrentAmmoCount > 0; public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo; - public AmmoPool(Actor self, AmmoPoolInfo info) + public AmmoPool(AmmoPoolInfo info) { Info = info; CurrentAmmoCount = Info.InitialAmmo < Info.Ammo && Info.InitialAmmo >= 0 ? Info.InitialAmmo : Info.Ammo; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index a5fb3e311d10..cb263e975212 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -380,7 +380,7 @@ protected virtual WVec CalculateMuzzleOffset(Actor self, Barrel b) var localOffset = b.Offset + new WVec(-Recoil, WDist.Zero, WDist.Zero); // Turret coordinates to body coordinates - var bodyOrientation = coords.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = coords.QuantizeOrientation(self.Orientation); if (turret != null) localOffset = localOffset.Rotate(turret.WorldOrientation) + turret.Offset.Rotate(bodyOrientation); else diff --git a/OpenRA.Mods.Common/Traits/Armor.cs b/OpenRA.Mods.Common/Traits/Armor.cs index b3f2cdc4ce55..aa96699e12d5 100644 --- a/OpenRA.Mods.Common/Traits/Armor.cs +++ b/OpenRA.Mods.Common/Traits/Armor.cs @@ -19,12 +19,12 @@ public class ArmorInfo : ConditionalTraitInfo { public readonly string Type = null; - public override object Create(ActorInitializer init) { return new Armor(init.Self, this); } + public override object Create(ActorInitializer init) { return new Armor(this); } } public class Armor : ConditionalTrait { - public Armor(Actor self, ArmorInfo info) + public Armor(ArmorInfo info) : base(info) { } } } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index cfbc9e35852b..ec36d9759b26 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -474,7 +474,7 @@ bool CanTargetActor(Actor self, in Target target, ref TargetModifiers modifiers, return true; } - bool CanTargetLocation(Actor self, CPos location, List actorsAtLocation, TargetModifiers modifiers, ref string cursor) + bool CanTargetLocation(Actor self, CPos location, TargetModifiers modifiers, ref string cursor) { if (!self.World.Map.Contains(location)) return false; @@ -505,7 +505,7 @@ bool CanTargetLocation(Actor self, CPos location, List actorsAtLocation, return true; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { switch (target.Type) { @@ -513,7 +513,7 @@ public bool CanTarget(Actor self, in Target target, List othersAtTarget, case TargetType.FrozenActor: return CanTargetActor(self, target, ref modifiers, ref cursor); case TargetType.Terrain: - return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor); + return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), modifiers, ref cursor); default: return false; } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs index f2f8e6c7ebc1..8357d323651f 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs @@ -46,7 +46,7 @@ public class AttackFollow : AttackBase, INotifyOwnerChanged, IDisableAutoTarget, bool opportunityForceAttack; bool opportunityTargetIsPersistentTarget; - public void SetRequestedTarget(Actor self, in Target target, bool isForceAttack = false) + public void SetRequestedTarget(in Target target, bool isForceAttack = false) { RequestedTarget = target; requestedForceAttack = isForceAttack; @@ -274,7 +274,7 @@ public override bool Tick(Actor self) return false; target = target.Recalculate(self.Owner, out var targetIsHiddenActor); - attack.SetRequestedTarget(self, target, forceAttack); + attack.SetRequestedTarget(target, forceAttack); hasTicked = true; if (!targetIsHiddenActor && target.Type == TargetType.Actor) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs index a5a5f7e7ae92..7493b0886dfd 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs @@ -139,7 +139,7 @@ FirePort SelectFirePort(Actor self, WAngle targetYaw) WVec PortOffset(Actor self, FirePort p) { - var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = coords.Value.QuantizeOrientation(self.Orientation); return coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation)); } @@ -193,7 +193,7 @@ IEnumerable IRender.Render(Actor self, WorldRenderer wr) // Display muzzle flashes foreach (var m in muzzles) - foreach (var r in m.Render(self, wr, pal)) + foreach (var r in m.Render(self, pal)) yield return r; } diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs index c859ea86d44e..d0ffe7424b1e 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs @@ -19,15 +19,15 @@ public class AutoCarryableInfo : CarryableInfo [Desc("Required distance away from destination before requesting a pickup. Default is 6 cells.")] public readonly WDist MinDistance = WDist.FromCells(6); - public override object Create(ActorInitializer init) { return new AutoCarryable(init.Self, this); } + public override object Create(ActorInitializer init) { return new AutoCarryable(this); } } public class AutoCarryable : Carryable, ICallForTransport { readonly AutoCarryableInfo info; - public AutoCarryable(Actor self, AutoCarryableInfo info) - : base(self, info) + public AutoCarryable(AutoCarryableInfo info) + : base(info) { this.info = info; } @@ -35,10 +35,10 @@ public AutoCarryable(Actor self, AutoCarryableInfo info) public WDist MinimumDistance => info.MinDistance; // No longer want to be carried - void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); } + void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(); } void ICallForTransport.RequestTransport(Actor self, CPos destination) { RequestTransport(self, destination); } - void MovementCancelled(Actor self) + void MovementCancelled() { if (state == State.Locked) return; @@ -93,7 +93,7 @@ public override bool Reserve(Actor self, Actor carrier) if (delta.HorizontalLengthSquared < info.MinDistance.LengthSquared) { // Cancel pickup - MovementCancelled(self); + MovementCancelled(); return false; } @@ -111,7 +111,7 @@ public override LockResponse LockForPickup(Actor self, Actor carrier) if (delta.HorizontalLengthSquared < info.MinDistance.LengthSquared) { // Cancel pickup - MovementCancelled(self); + MovementCancelled(); return LockResponse.Failed; } diff --git a/OpenRA.Mods.Common/Traits/AutoCarryall.cs b/OpenRA.Mods.Common/Traits/AutoCarryall.cs index bcc9be3979cd..e962bd572d68 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryall.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryall.cs @@ -50,7 +50,7 @@ public override bool RequestTransportNotify(Actor self, Actor carryable, CPos de return false; } - bool IsBestAutoCarryallForCargo(Actor self, Actor candidateCargo) + static bool IsBestAutoCarryallForCargo(Actor self, Actor candidateCargo) { // Find carriers var carriers = self.World.ActorsHavingTrait(c => !c.busy) diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index c45c1ab400f9..c60f464af0c1 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -257,7 +257,7 @@ void INotifyDamage.Damaged(Actor self, AttackInfo e) Aggressor = attacker; - Attack(self, Target.FromActor(Aggressor), allowMove); + Attack(Target.FromActor(Aggressor), allowMove); } void INotifyIdle.TickIdle(Actor self) @@ -309,10 +309,10 @@ public void ScanAndAttack(Actor self, bool allowMove, bool allowTurn) { var target = ScanForTarget(self, allowMove, allowTurn); if (target.Type != TargetType.Invalid) - Attack(self, target, allowMove); + Attack(target, allowMove); } - void Attack(Actor self, in Target target, bool allowMove) + void Attack(in Target target, bool allowMove) { foreach (var ab in ActiveAttackBases) ab.AttackTarget(target, AttackSource.AutoTarget, false, allowMove); diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index f76402b75d5d..d202c59d2b07 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -22,12 +22,12 @@ public class BlocksProjectilesInfo : ConditionalTraitInfo, IBlocksProjectilesInf [Desc("Determines what projectiles to block based on their allegiance to the wall owner.")] public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy; - public override object Create(ActorInitializer init) { return new BlocksProjectiles(init.Self, this); } + public override object Create(ActorInitializer init) { return new BlocksProjectiles(this); } } public class BlocksProjectiles : ConditionalTrait, IBlocksProjectiles { - public BlocksProjectiles(Actor self, BlocksProjectilesInfo info) + public BlocksProjectiles(BlocksProjectilesInfo info) : base(info) { } WDist IBlocksProjectiles.BlockingHeight => Info.Height; diff --git a/OpenRA.Mods.Common/Traits/BodyOrientation.cs b/OpenRA.Mods.Common/Traits/BodyOrientation.cs index cfdcd8e15a83..b45ae085c9fc 100644 --- a/OpenRA.Mods.Common/Traits/BodyOrientation.cs +++ b/OpenRA.Mods.Common/Traits/BodyOrientation.cs @@ -101,7 +101,7 @@ public WVec LocalToWorld(in WVec vec) return info.LocalToWorld(vec); } - public WRot QuantizeOrientation(Actor self, in WRot orientation) + public WRot QuantizeOrientation(in WRot orientation) { return info.QuantizeOrientation(orientation, quantizedFacings.Value); } diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 70822933d342..81c55606b59a 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -143,7 +143,7 @@ bool TickQueue(IBot bot, ProductionQueue queue) if (plugInfo != null) { var possibleBuilding = world.ActorsWithTrait().FirstOrDefault(a => - a.Actor.Owner == player && a.Trait.AcceptsPlug(a.Actor, plugInfo.Type)); + a.Actor.Owner == player && a.Trait.AcceptsPlug(plugInfo.Type)); if (possibleBuilding.Actor != null) { diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs index 2b8d8f517405..d2f05c297324 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs @@ -80,7 +80,7 @@ public int GetAttractiveness(WPos pos, Player firedBy) // IsValid check filters out Frozen Actors that have not initialized their Owner foreach (var scrutinized in checkFrozen) - answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner), firedBy); + answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner)); } return answer; @@ -105,7 +105,7 @@ public int GetAttractiveness(IEnumerable frozenActors, Player fired foreach (var consideration in Considerations) foreach (var scrutinized in frozenActors) if (scrutinized.IsValid && scrutinized.Visible) - answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner), firedBy); + answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner)); return answer; } @@ -174,7 +174,7 @@ public int GetAttractiveness(Actor a, PlayerRelationship stance, Player firedBy) return 0; } - public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance, Player firedBy) + public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance) { if (stance != Against) return 0; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs index 3f2016057e6e..536c56bbef74 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs @@ -16,12 +16,12 @@ namespace OpenRA.Mods.Common.Traits [Desc("Manages AI repairing base buildings.")] public class BuildingRepairBotModuleInfo : ConditionalTraitInfo { - public override object Create(ActorInitializer init) { return new BuildingRepairBotModule(init.Self, this); } + public override object Create(ActorInitializer init) { return new BuildingRepairBotModule(this); } } public class BuildingRepairBotModule : ConditionalTrait, IBotRespondToAttack { - public BuildingRepairBotModule(Actor self, BuildingRepairBotModuleInfo info) + public BuildingRepairBotModule(BuildingRepairBotModuleInfo info) : base(info) { } void IBotRespondToAttack.RespondToAttack(IBot bot, Actor self, AttackInfo e) diff --git a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs index b48f0db0c752..d4f5ac59f288 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs @@ -143,7 +143,7 @@ void IBotTick.BotTick(IBot bot) Target FindNextResource(Actor actor, HarvesterTraitWrapper harv) { Func isValidResource = cell => - harv.Harvester.CanHarvestCell(actor, cell) && + harv.Harvester.CanHarvestCell(cell) && claimLayer.CanClaimCell(actor, cell); List path; diff --git a/OpenRA.Mods.Common/Traits/Buildings/ActorPreviewPlaceBuildingPreview.cs b/OpenRA.Mods.Common/Traits/Buildings/ActorPreviewPlaceBuildingPreview.cs index 7aee53b6ed1e..8fc696c633d2 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/ActorPreviewPlaceBuildingPreview.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/ActorPreviewPlaceBuildingPreview.cs @@ -52,7 +52,7 @@ public class ActorPreviewPlaceBuildingPreviewPreview : FootprintPlaceBuildingPre readonly IActorPreview[] preview; public ActorPreviewPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, ActorPreviewPlaceBuildingPreviewInfo info, TypeDictionary init) - : base(wr, ai, info, init) + : base(wr, ai, info) { this.info = info; var previewInit = new ActorPreviewInitializer(ActorInfo, wr, init); diff --git a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs index 040556e8b7ac..7c3603657695 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs @@ -87,7 +87,7 @@ bool ValidRenderPlayer() return buildRadiusEnabled && (self.Owner == self.World.RenderPlayer || (allyBuildEnabled && self.Owner.IsAlliedWith(self.World.RenderPlayer))); } - public IEnumerable RangeCircleRenderables(WorldRenderer wr) + public IEnumerable RangeCircleRenderables() { if (IsTraitDisabled) yield break; @@ -108,7 +108,7 @@ public IEnumerable RangeCircleRenderables(WorldRenderer wr) IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { - return RangeCircleRenderables(wr); + return RangeCircleRenderables(); } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs index 74ab805cd9c2..340547080ee6 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs @@ -167,7 +167,7 @@ TerrainTileInfo GetTerrainInfo(CPos cell) return terrainInfo.GetTerrainInfo(new TerrainTile(template, (byte)index)); } - public void LinkNeighbouringBridges(World world, LegacyBridgeLayer bridges) + public void LinkNeighbouringBridges(LegacyBridgeLayer bridges) { for (var d = 0; d <= 1; d++) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 158cf2b12074..106e84e7c801 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -259,7 +259,7 @@ public IEnumerable RenderAnnotations(WorldRenderer wr, World w, Act if (!RequiresBaseProvider) return SpriteRenderable.None; - return w.ActorsWithTrait().SelectMany(a => a.Trait.RangeCircleRenderables(wr)); + return w.ActorsWithTrait().SelectMany(a => a.Trait.RangeCircleRenderables()); } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs index 04024f9745b2..1e7ea7de4179 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs @@ -33,7 +33,7 @@ public class FootprintPlaceBuildingPreviewInfo : TraitInfo repairDirections > 0; int repairDirections = 0; - public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info) + public LegacyBridgeHut(ActorInitializer init) { var bridge = init.Get().Value; init.World.AddFrameEndTask(_ => diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs index c9c2fb61a605..1a494ae7e50b 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs @@ -143,7 +143,7 @@ public RallyPointOrderTargeter(RallyPointInfo info) public bool ForceSet { get; private set; } public bool IsQueued { get; protected set; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Terrain) return false; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs index 375f947d3698..c67424fec0eb 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs @@ -138,7 +138,7 @@ int IAcceptResources.AcceptResources(string resourceType, int count) return count; } - void CancelDock(Actor self) + void CancelDock() { preventDock = true; } @@ -161,7 +161,7 @@ void ITick.Tick(Actor self) void INotifyActorDisposing.Disposing(Actor self) { - CancelDock(self); + CancelDock(); foreach (var harv in GetLinkedHarvesters()) harv.Trait.UnlinkProc(harv.Actor, self); } @@ -193,11 +193,11 @@ void INotifyCapture.OnCapture(Actor self, Actor captor, Player oldOwner, Player dockedHarv.ChangeOwner(newOwner); // Relink to this refinery - dockedHarv.Trait().LinkProc(dockedHarv, self); + dockedHarv.Trait().LinkProc(self); } } - void INotifySold.Selling(Actor self) { CancelDock(self); } + void INotifySold.Selling(Actor self) { CancelDock(); } void INotifySold.Sold(Actor self) { foreach (var harv in GetLinkedHarvesters()) diff --git a/OpenRA.Mods.Common/Traits/Buildings/SequencePlaceBuildingPreview.cs b/OpenRA.Mods.Common/Traits/Buildings/SequencePlaceBuildingPreview.cs index 52661fea1c2d..6d6a41c4a7f1 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/SequencePlaceBuildingPreview.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/SequencePlaceBuildingPreview.cs @@ -54,7 +54,7 @@ class SequencePlaceBuildingPreviewPreview : FootprintPlaceBuildingPreviewPreview readonly PaletteReference palette; public SequencePlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, SequencePlaceBuildingPreviewInfo info, TypeDictionary init) - : base(wr, ai, info, init) + : base(wr, ai, info) { this.info = info; var ownerName = init.Get().InternalName; @@ -62,7 +62,7 @@ public SequencePlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, Seque var rsi = ai.TraitInfo(); palette = wr.Palette(rsi.Palette ?? rsi.PlayerPalette + ownerName); - preview = new Animation(wr.World, rsi.GetImage(ai, wr.World.Map.Rules.Sequences, faction)); + preview = new Animation(wr.World, rsi.GetImage(ai, faction)); preview.PlayRepeating(info.Sequence); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs index d08b275f1cfe..573a4e3a557d 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs @@ -87,7 +87,7 @@ IEnumerable IIssueOrder.Orders AircraftCanEnter, target => Reservable.IsAvailableFor(target, self)); - yield return new AircraftMoveOrderTargeter(self, this); + yield return new AircraftMoveOrderTargeter(this); } } } @@ -191,7 +191,7 @@ public bool TargetOverridesSelection(Actor self, in Target target, List a return modifiers.HasModifier(TargetModifiers.ForceMove); } - public AircraftMoveOrderTargeter(Actor self, TransformsIntoAircraft aircraft) + public AircraftMoveOrderTargeter(TransformsIntoAircraft aircraft) { this.aircraft = aircraft; } @@ -200,7 +200,7 @@ public AircraftMoveOrderTargeter(Actor self, TransformsIntoAircraft aircraft) public int OrderPriority => 4; public bool IsQueued { get; protected set; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Terrain || (aircraft.Info.RequiresForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove))) return false; diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs index bc108067ac42..89ce55d68512 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs @@ -189,7 +189,7 @@ public MoveOrderTargeter(Actor self, TransformsIntoMobile mobile) public int OrderPriority => 4; public bool IsQueued { get; protected set; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (rejectMove || target.Type != TargetType.Terrain || (mobile.Info.RequiresForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove))) return false; diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoTransforms.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoTransforms.cs index 421fb84355d7..f939feba8ee9 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoTransforms.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoTransforms.cs @@ -20,12 +20,12 @@ public class TransformsIntoTransformsInfo : ConditionalTraitInfo, Requires, IResolveOrder, IOrderVoice, IIssueDeployOrder { - public TransformsIntoTransforms(Actor self, TransformsIntoTransformsInfo info) + public TransformsIntoTransforms(TransformsIntoTransformsInfo info) : base(info) { } void IResolveOrder.ResolveOrder(Actor self, Order order) diff --git a/OpenRA.Mods.Common/Traits/Capturable.cs b/OpenRA.Mods.Common/Traits/Capturable.cs index 3a068ec4b8ee..bdbc496737fb 100644 --- a/OpenRA.Mods.Common/Traits/Capturable.cs +++ b/OpenRA.Mods.Common/Traits/Capturable.cs @@ -47,7 +47,7 @@ void INotifyCapture.OnCapture(Actor self, Actor captor, Player oldOwner, Player self.CancelActivity(); } - protected override void TraitEnabled(Actor self) { captureManager.RefreshCapturable(self); } - protected override void TraitDisabled(Actor self) { captureManager.RefreshCapturable(self); } + protected override void TraitEnabled(Actor self) { captureManager.RefreshCapturable(); } + protected override void TraitDisabled(Actor self) { captureManager.RefreshCapturable(); } } } diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs index 95e5a036f0c0..f01de140f085 100644 --- a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs @@ -21,14 +21,14 @@ class CapturableProgressBarInfo : ConditionalTraitInfo, Requires { public readonly Color Color = Color.Orange; - public override object Create(ActorInitializer init) { return new CapturableProgressBar(init.Self, this); } + public override object Create(ActorInitializer init) { return new CapturableProgressBar(this); } } class CapturableProgressBar : ConditionalTrait, ISelectionBar, ICaptureProgressWatcher { readonly Dictionary progress = new Dictionary(); - public CapturableProgressBar(Actor self, CapturableProgressBarInfo info) + public CapturableProgressBar(CapturableProgressBarInfo info) : base(info) { } void ICaptureProgressWatcher.Update(Actor self, Actor captor, Actor target, int current, int total) diff --git a/OpenRA.Mods.Common/Traits/CaptureManager.cs b/OpenRA.Mods.Common/Traits/CaptureManager.cs index 58a57d80e7d8..7fae1e3b4e4f 100644 --- a/OpenRA.Mods.Common/Traits/CaptureManager.cs +++ b/OpenRA.Mods.Common/Traits/CaptureManager.cs @@ -99,11 +99,11 @@ void INotifyCreated.Created(Actor self) .ToArray() .Where(Exts.IsTraitEnabled); - RefreshCaptures(self); - RefreshCapturable(self); + RefreshCaptures(); + RefreshCapturable(); } - public void RefreshCapturable(Actor self) + public void RefreshCapturable() { allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default(BitSet); foreach (var c in enabledCapturable) @@ -119,7 +119,7 @@ public void RefreshCapturable(Actor self) } } - public void RefreshCaptures(Actor self) + public void RefreshCaptures() { capturesTypes = enabledCaptures.Aggregate( default(BitSet), diff --git a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs index cc76a6cec55f..743560636a91 100644 --- a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs @@ -19,7 +19,7 @@ class CaptureProgressBarInfo : ConditionalTraitInfo, Requires { public readonly Color Color = Color.Orange; - public override object Create(ActorInitializer init) { return new CaptureProgressBar(init.Self, this); } + public override object Create(ActorInitializer init) { return new CaptureProgressBar(this); } } class CaptureProgressBar : ConditionalTrait, ISelectionBar, ICaptureProgressWatcher @@ -27,7 +27,7 @@ class CaptureProgressBar : ConditionalTrait, ISelectionB int current; int total; - public CaptureProgressBar(Actor self, CaptureProgressBarInfo info) + public CaptureProgressBar(CaptureProgressBarInfo info) : base(info) { } void ICaptureProgressWatcher.Update(Actor self, Actor captor, Actor target, int current, int total) diff --git a/OpenRA.Mods.Common/Traits/Captures.cs b/OpenRA.Mods.Common/Traits/Captures.cs index 63ce5a86bc75..b1d01598b329 100644 --- a/OpenRA.Mods.Common/Traits/Captures.cs +++ b/OpenRA.Mods.Common/Traits/Captures.cs @@ -110,8 +110,8 @@ public void ResolveOrder(Actor self, Order order) self.ShowTargetLines(); } - protected override void TraitEnabled(Actor self) { captureManager.RefreshCaptures(self); } - protected override void TraitDisabled(Actor self) { captureManager.RefreshCaptures(self); } + protected override void TraitEnabled(Actor self) { captureManager.RefreshCaptures(); } + protected override void TraitDisabled(Actor self) { captureManager.RefreshCaptures(); } class CaptureOrderTargeter : UnitOrderTargeter { diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index 4d1ee3090445..f9759ecbb8ae 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -32,7 +32,7 @@ public class CarryableInfo : ConditionalTraitInfo [Desc("Carryall attachment point relative to body.")] public readonly WVec LocalOffset = WVec.Zero; - public override object Create(ActorInitializer init) { return new Carryable(init.Self, this); } + public override object Create(ActorInitializer init) { return new Carryable(this); } } public enum LockResponse { Success, Pending, Failed } @@ -60,7 +60,7 @@ protected enum State { Free, Reserved, Locked } protected State state = State.Free; protected bool attached; - public Carryable(Actor self, CarryableInfo info) + public Carryable(CarryableInfo info) : base(info) { } protected override void Created(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs index df313feabcad..3d5d3663416a 100644 --- a/OpenRA.Mods.Common/Traits/Carryall.cs +++ b/OpenRA.Mods.Common/Traits/Carryall.cs @@ -200,7 +200,7 @@ WVec IAircraftCenterPositionOffset.PositionOffset { get { - var localOffset = CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation)); + var localOffset = CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation)); return body.LocalToWorld(localOffset); } } @@ -285,7 +285,7 @@ IEnumerable IRender.Render(Actor self, WorldRenderer wr) .ToArray(); } - var offset = body.LocalToWorld(CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation))); + var offset = body.LocalToWorld(CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation))); var previewRenderables = carryablePreview .SelectMany(p => p.Render(wr, self.CenterPosition + offset)) .OrderBy(WorldRenderer.RenderableZPositionComparisonKey); @@ -430,7 +430,7 @@ public CarryallDeliverUnitTargeter(AircraftInfo aircraftInfo, CarryallInfo info) this.info = info; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (!info.AllowDropOff || !modifiers.HasModifier(TargetModifiers.ForceMove)) return false; diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs index e8f4d399ae24..eb65b9f6aff2 100644 --- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs @@ -68,7 +68,7 @@ IEnumerable RenderAnnotations(Actor self, WorldRenderer wr) foreach (var s in shapes) { - foreach (var a in s.RenderDebugAnnotations(self, wr)) + foreach (var a in s.RenderDebugAnnotations(self)) yield return a; foreach (var r in s.RenderDebugOverlay(self, wr)) @@ -87,7 +87,7 @@ IEnumerable RenderArmaments(Actor self, AttackBase attack) // Fire ports on garrisonable structures if (attack is AttackGarrisoned garrison) { - var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = coords.Value.QuantizeOrientation(self.Orientation); foreach (var p in garrison.Info.Ports) { var pos = self.CenterPosition + coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation)); diff --git a/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs index d128483a0c03..e9069ff185e3 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs @@ -35,7 +35,7 @@ public class ExternalConditionInfo : TraitInfo [Desc("If > 0, restrict the number of times that this condition can be granted by any source.")] public readonly int TotalCap = 0; - public override object Create(ActorInitializer init) { return new ExternalCondition(init.Self, this); } + public override object Create(ActorInitializer init) { return new ExternalCondition(this); } } public class ExternalCondition : ITick, INotifyCreated @@ -63,12 +63,12 @@ public TimedToken(int token, Actor self, object source, int duration) int duration; int expires; - public ExternalCondition(Actor self, ExternalConditionInfo info) + public ExternalCondition(ExternalConditionInfo info) { Info = info; } - public bool CanGrantCondition(Actor self, object source) + public bool CanGrantCondition(object source) { if (source == null) return false; @@ -87,7 +87,7 @@ public bool CanGrantCondition(Actor self, object source) public int GrantCondition(Actor self, object source, int duration = 0, int remaining = 0) { - if (!CanGrantCondition(self, source)) + if (!CanGrantCondition(source)) return Actor.InvalidConditionToken; var token = self.GrantCondition(Info.Condition); diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs index 79dfb729a4e1..803fd5df34f3 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs @@ -43,7 +43,7 @@ public class GrantConditionOnAttackInfo : PausableConditionalTraitInfo [Desc("Should all instances be revoked instead of only one?")] public readonly bool RevokeAll = false; - public override object Create(ActorInitializer init) { return new GrantConditionOnAttack(init, this); } + public override object Create(ActorInitializer init) { return new GrantConditionOnAttack(this); } } public class GrantConditionOnAttack : PausableConditionalTrait, INotifyCreated, ITick, INotifyAttack @@ -56,7 +56,7 @@ public class GrantConditionOnAttack : PausableConditionalTrait : ConditionalTrait { - public GrantConditionOnTunnelLayer(Actor self, GrantConditionOnTunnelLayerInfo info) - : base(self, info, CustomMovementLayerType.Tunnel) { } + public GrantConditionOnTunnelLayer(GrantConditionOnTunnelLayerInfo info) + : base(info, CustomMovementLayerType.Tunnel) { } } } diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToCrusher.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToCrusher.cs index 73766b9edbe4..4a631d094bb9 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToCrusher.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToCrusher.cs @@ -30,14 +30,14 @@ public class GrantExternalConditionToCrusherInfo : TraitInfo [Desc("Duration of the condition applied on a successful crush (in ticks). Set to 0 for a permanent condition.")] public readonly int OnCrushDuration = 0; - public override object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(init.Self, this); } + public override object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(this); } } public class GrantExternalConditionToCrusher : INotifyCrushed { public readonly GrantExternalConditionToCrusherInfo Info; - public GrantExternalConditionToCrusher(Actor self, GrantExternalConditionToCrusherInfo info) + public GrantExternalConditionToCrusher(GrantExternalConditionToCrusherInfo info) { Info = info; } @@ -45,14 +45,14 @@ public GrantExternalConditionToCrusher(Actor self, GrantExternalConditionToCrush void INotifyCrushed.OnCrush(Actor self, Actor crusher, BitSet crushClasses) { crusher.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.OnCrushCondition && t.CanGrantCondition(crusher, self)) + .FirstOrDefault(t => t.Info.Condition == Info.OnCrushCondition && t.CanGrantCondition(self)) ?.GrantCondition(crusher, self, Info.OnCrushDuration); } void INotifyCrushed.WarnCrush(Actor self, Actor crusher, BitSet crushClasses) { crusher.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.WarnCrushCondition && t.CanGrantCondition(crusher, self)) + .FirstOrDefault(t => t.Info.Condition == Info.WarnCrushCondition && t.CanGrantCondition(self)) ?.GrantCondition(crusher, self, Info.WarnCrushDuration); } } diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToProduced.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToProduced.cs index 3cdb02b41623..36838eb33242 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToProduced.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantExternalConditionToProduced.cs @@ -23,12 +23,12 @@ public class GrantExternalConditionToProducedInfo : ConditionalTraitInfo [Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")] public readonly int Duration = 0; - public override object Create(ActorInitializer init) { return new GrantExternalConditionToProduced(init.Self, this); } + public override object Create(ActorInitializer init) { return new GrantExternalConditionToProduced(this); } } public class GrantExternalConditionToProduced : ConditionalTrait, INotifyProduction { - public GrantExternalConditionToProduced(Actor self, GrantExternalConditionToProducedInfo info) + public GrantExternalConditionToProduced(GrantExternalConditionToProducedInfo info) : base(info) { } void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit) @@ -37,7 +37,7 @@ void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit) return; other.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other, self)) + .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other)) ?.GrantCondition(other, self, Info.Duration); } } diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs index c5822ac218fd..1322e31b9dde 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs @@ -22,14 +22,14 @@ public class GrantRandomConditionInfo : TraitInfo [Desc("List of conditions to grant from.")] public readonly string[] Conditions = null; - public override object Create(ActorInitializer init) { return new GrantRandomCondition(init.Self, this); } + public override object Create(ActorInitializer init) { return new GrantRandomCondition(this); } } public class GrantRandomCondition : INotifyCreated { readonly GrantRandomConditionInfo info; - public GrantRandomCondition(Actor self, GrantRandomConditionInfo info) + public GrantRandomCondition(GrantRandomConditionInfo info) { this.info = info; } diff --git a/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs index e63a093293fa..858f4f156e14 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs @@ -22,7 +22,7 @@ public class LineBuildSegmentExternalConditionInfo : ConditionalTraitInfo, Requi [Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")] public readonly string Condition = null; - public override object Create(ActorInitializer init) { return new LineBuildSegmentExternalCondition(init.Self, this); } + public override object Create(ActorInitializer init) { return new LineBuildSegmentExternalCondition(this); } } public class LineBuildSegmentExternalCondition : ConditionalTrait, INotifyLineBuildSegmentsChanged @@ -30,7 +30,7 @@ public class LineBuildSegmentExternalCondition : ConditionalTrait segments = new HashSet(); readonly Dictionary tokens = new Dictionary(); - public LineBuildSegmentExternalCondition(Actor self, LineBuildSegmentExternalConditionInfo info) + public LineBuildSegmentExternalCondition(LineBuildSegmentExternalConditionInfo info) : base(info) { } void GrantCondition(Actor self, Actor segment) @@ -39,7 +39,7 @@ void GrantCondition(Actor self, Actor segment) return; var external = segment.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(segment, self)); + .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(segment)); if (external != null) tokens[segment] = external.GrantCondition(segment, self); diff --git a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs index 082998f477c7..ad00543da81c 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs @@ -115,7 +115,7 @@ void ActorEntered(Actor a) return; var external = a.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(a, self)); + .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(self)); if (external != null) tokens[a] = external.GrantCondition(a, self); @@ -139,7 +139,7 @@ public void UnitProducedByOther(Actor self, Actor producer, Actor produced, stri return; var external = produced.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(produced, self)); + .FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(self)); if (external != null) tokens[produced] = external.GrantCondition(produced, self); diff --git a/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs b/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs index 337b18849781..76e2b0812bbe 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ToggleConditionOnOrder.cs @@ -37,7 +37,7 @@ public class ToggleConditionOnOrderInfo : PausableConditionalTraitInfo [NotificationReference("Speech")] public readonly string DisabledSpeech = null; - public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(init.Self, this); } + public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(this); } } public class ToggleConditionOnOrder : PausableConditionalTrait, IResolveOrder @@ -48,7 +48,7 @@ public class ToggleConditionOnOrder : PausableConditionalTrait() - .Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(a, self)); + .Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(self)); } public override int GetSelectionShares(Actor collector) @@ -79,9 +79,9 @@ public override void Activate(Actor collector) ExternalCondition external = null; for (var n = 0; n < info.Levels; n++) { - if (external == null || !external.CanGrantCondition(a, self)) + if (external == null || !external.CanGrantCondition(self)) { - external = externals.FirstOrDefault(t => t.CanGrantCondition(a, self)); + external = externals.FirstOrDefault(t => t.CanGrantCondition(self)); if (external == null) break; } diff --git a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs index 1a57f28b484c..a60fdf434e5e 100644 --- a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs @@ -36,12 +36,12 @@ public class EjectOnDeathInfo : ConditionalTraitInfo [Desc("Risks stuck units when they don't have the Paratrooper trait.")] public readonly bool AllowUnsuitableCell = false; - public override object Create(ActorInitializer init) { return new EjectOnDeath(init.Self, this); } + public override object Create(ActorInitializer init) { return new EjectOnDeath(this); } } public class EjectOnDeath : ConditionalTrait, INotifyKilled { - public EjectOnDeath(Actor self, EjectOnDeathInfo info) + public EjectOnDeath(EjectOnDeathInfo info) : base(info) { } void INotifyKilled.Killed(Actor self, AttackInfo e) diff --git a/OpenRA.Mods.Common/Traits/EngineerRepair.cs b/OpenRA.Mods.Common/Traits/EngineerRepair.cs index dc51726726fa..d22aed4e5b0f 100644 --- a/OpenRA.Mods.Common/Traits/EngineerRepair.cs +++ b/OpenRA.Mods.Common/Traits/EngineerRepair.cs @@ -47,12 +47,12 @@ class EngineerRepairInfo : ConditionalTraitInfo [Desc("Cursor to display when target actor has full health so it can't be repaired.")] public readonly string RepairBlockedCursor = "goldwrench-blocked"; - public override object Create(ActorInitializer init) { return new EngineerRepair(init, this); } + public override object Create(ActorInitializer init) { return new EngineerRepair(this); } } class EngineerRepair : ConditionalTrait, IIssueOrder, IResolveOrder, IOrderVoice { - public EngineerRepair(ActorInitializer init, EngineerRepairInfo info) + public EngineerRepair(EngineerRepairInfo info) : base(info) { } public IEnumerable Orders @@ -74,7 +74,7 @@ public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool return new Order(order.OrderID, self, target, queued); } - static bool IsValidOrder(Actor self, Order order) + static bool IsValidOrder(Order order) { if (order.Target.Type == TargetType.FrozenActor) return order.Target.FrozenActor.DamageState > DamageState.Undamaged; @@ -87,13 +87,13 @@ static bool IsValidOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order) { - return order.OrderString == "EngineerRepair" && IsValidOrder(self, order) + return order.OrderString == "EngineerRepair" && IsValidOrder(order) ? Info.Voice : null; } public void ResolveOrder(Actor self, Order order) { - if (order.OrderString != "EngineerRepair" || !IsValidOrder(self, order)) + if (order.OrderString != "EngineerRepair" || !IsValidOrder(order)) return; self.QueueActivity(order.Queued, new RepairBuilding(self, order.Target, Info)); diff --git a/OpenRA.Mods.Common/Traits/EngineerRepairable.cs b/OpenRA.Mods.Common/Traits/EngineerRepairable.cs index 3567a7fcb434..0da85e7825ee 100644 --- a/OpenRA.Mods.Common/Traits/EngineerRepairable.cs +++ b/OpenRA.Mods.Common/Traits/EngineerRepairable.cs @@ -21,12 +21,12 @@ class EngineerRepairableInfo : ConditionalTraitInfo [Desc("Actors with these Types under EngineerRepair trait can repair me.")] public readonly BitSet Types = default(BitSet); - public override object Create(ActorInitializer init) { return new EngineerRepairable(init, this); } + public override object Create(ActorInitializer init) { return new EngineerRepairable(this); } } class EngineerRepairable : ConditionalTrait { - public EngineerRepairable(ActorInitializer init, EngineerRepairableInfo info) + public EngineerRepairable(EngineerRepairableInfo info) : base(info) { } } } diff --git a/OpenRA.Mods.Common/Traits/ExplosionOnDamageTransition.cs b/OpenRA.Mods.Common/Traits/ExplosionOnDamageTransition.cs index e0211c5c6ce9..2a8e255a812d 100644 --- a/OpenRA.Mods.Common/Traits/ExplosionOnDamageTransition.cs +++ b/OpenRA.Mods.Common/Traits/ExplosionOnDamageTransition.cs @@ -30,7 +30,7 @@ public class ExplosionOnDamageTransitionInfo : ConditionalTraitInfo, IRulesetLoa public WeaponInfo WeaponInfo { get; private set; } - public override object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this, init.Self); } + public override object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this); } public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { @@ -51,10 +51,8 @@ public class ExplosionOnDamageTransition : ConditionalTrait experienceModifiers; - public GivesExperience(Actor self, GivesExperienceInfo info) + public GivesExperience(GivesExperienceInfo info) { this.info = info; } diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index f0efcce42be1..f395e2d31021 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -157,7 +157,7 @@ protected override void Created(Actor self) base.Created(self); } - public void LinkProc(Actor self, Actor proc) + public void LinkProc(Actor proc) { LinkedProc = proc; } @@ -171,7 +171,7 @@ public void UnlinkProc(Actor self, Actor proc) public void ChooseNewProc(Actor self, Actor ignore) { LastLinkedProc = null; - LinkProc(self, ClosestProc(self, ignore)); + LinkProc(ClosestProc(self, ignore)); } bool IsAcceptableProcType(Actor proc) @@ -277,7 +277,7 @@ public virtual bool TickUnload(Actor self, Actor proc) return contents.Count == 0; } - public bool CanHarvestCell(Actor self, CPos cell) + public bool CanHarvestCell(CPos cell) { // Resources only exist in the ground layer if (cell.Layer != 0) @@ -333,7 +333,7 @@ void IResolveOrder.ResolveOrder(Actor self, Order order) if (order.OrderString == "Harvest") { // NOTE: An explicit harvest order allows the harvester to decide which refinery to deliver to. - LinkProc(self, null); + LinkProc(null); CPos loc; if (order.Target.Type != TargetType.Invalid) @@ -391,7 +391,7 @@ class HarvestOrderTargeter : IOrderTargeter public bool IsQueued { get; protected set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (target.Type != TargetType.Terrain) return false; diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs index a224854a1b3e..b826b0efdda9 100644 --- a/OpenRA.Mods.Common/Traits/HitShape.cs +++ b/OpenRA.Mods.Common/Traits/HitShape.cs @@ -136,7 +136,7 @@ IEnumerable TargetablePositions(Actor self) WVec CalculateTargetableOffset(Actor self, in WVec offset) { var localOffset = offset; - var quantizedBodyOrientation = orientation.QuantizeOrientation(self, self.Orientation); + var quantizedBodyOrientation = orientation.QuantizeOrientation(self.Orientation); if (turret != null) { @@ -154,7 +154,7 @@ public WDist DistanceFromEdge(Actor self, WPos pos) return Info.Type.DistanceFromEdge(pos, origin, orientation); } - public IEnumerable RenderDebugAnnotations(Actor self, WorldRenderer wr) + public IEnumerable RenderDebugAnnotations(Actor self) { var targetPosHLine = new WVec(0, 128, 0); var targetPosVLine = new WVec(128, 0, 0); diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 08a2167f7a6e..a2c950e56e4b 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -311,10 +311,10 @@ protected override void Created(Actor self) void ITick.Tick(Actor self) { - UpdateMovement(self); + UpdateMovement(); } - public void UpdateMovement(Actor self) + public void UpdateMovement() { var newMovementTypes = MovementType.None; if ((oldPos - CenterPosition).HorizontalLengthSquared != 0) @@ -494,7 +494,7 @@ public void SetCenterPosition(Actor self, WPos pos) self.World.UpdateMaps(self, this); var map = self.World.Map; - SetTerrainRampOrientation(self, map.TerrainOrientation(map.CellContaining(pos))); + SetTerrainRampOrientation(map.TerrainOrientation(map.CellContaining(pos))); // The first time SetCenterPosition is called is in the constructor before creation, so we need a null check here as well if (notifyCenterPositionChanged == null) @@ -504,7 +504,7 @@ public void SetCenterPosition(Actor self, WPos pos) n.CenterPositionChanged(self, fromCell.Layer, toCell.Layer); } - public void SetTerrainRampOrientation(Actor self, WRot orientation) + public void SetTerrainRampOrientation(WRot orientation) { if (Info.TerrainOrientationAdjustmentMargin.Length >= 0) terrainRampOrientation = orientation; @@ -723,7 +723,7 @@ public Activity LocalMove(Actor self, WPos fromPos, WPos toPos) public int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos) { - var speed = MovementSpeedForCell(self, self.Location); + var speed = MovementSpeedForCell(self.Location); return speed > 0 ? (toPos - fromPos).Length / speed : 0; } @@ -745,7 +745,7 @@ public bool CanEnterTargetNow(Actor self, in Target target) #region Local IMove-related - public int MovementSpeedForCell(Actor self, CPos cell) + public int MovementSpeedForCell(CPos cell) { var terrainSpeed = Locomotor.MovementSpeedForCell(cell); var modifiers = speedModifiers.Value.Append(terrainSpeed); @@ -809,7 +809,7 @@ public void EnteringCell(Actor self) Activity LocalMove(Actor self, WPos fromPos, WPos toPos, CPos cell) { - var speed = MovementSpeedForCell(self, cell); + var speed = MovementSpeedForCell(cell); var length = speed > 0 ? (toPos - fromPos).Length / speed : 0; var delta = toPos - fromPos; @@ -850,7 +850,7 @@ void IDeathActorInitModifier.ModifyDeathActorInit(Actor self, TypeDictionary ini // Allows the husk to drag to its final position if (CanEnterCell(self.Location, self, BlockedByActor.Stationary)) - init.Add(new HuskSpeedInit(MovementSpeedForCell(self, self.Location))); + init.Add(new HuskSpeedInit(MovementSpeedForCell(self.Location))); } void INotifyBecomingIdle.OnBecomingIdle(Actor self) @@ -1006,7 +1006,7 @@ public MoveOrderTargeter(Actor self, Mobile unit) public int OrderPriority => 4; public bool IsQueued { get; protected set; } - public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) + public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) { if (rejectMove || target.Type != TargetType.Terrain || (mobile.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove))) return false; diff --git a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs index 69b7fb8da7e2..def553185dc8 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs @@ -74,7 +74,7 @@ void INotifyCreated.Created(Actor self) }); } - void UpdateFrozenActor(Actor self, FrozenActor frozenActor, int playerIndex) + void UpdateFrozenActor(FrozenActor frozenActor, int playerIndex) { VisibilityHash |= 1 << (playerIndex % 32); frozenActor.RefreshState(); @@ -91,7 +91,7 @@ void ICreatesFrozenActors.OnVisibilityChanged(FrozenActor frozen) frozenStates[frozen.Viewer].IsVisible = !frozen.Visible; } - bool IsVisibleInner(Actor self, Player byPlayer) + bool IsVisibleInner(Player byPlayer) { // If fog is disabled visibility is determined by shroud if (!byPlayer.Shroud.FogEnabled) @@ -106,7 +106,7 @@ public bool IsVisible(Actor self, Player byPlayer) return true; var relationship = self.Owner.RelationshipWith(byPlayer); - return info.AlwaysVisibleRelationships.HasRelationship(relationship) || IsVisibleInner(self, byPlayer); + return info.AlwaysVisibleRelationships.HasRelationship(relationship) || IsVisibleInner(byPlayer); } void ITick.Tick(Actor self) @@ -120,7 +120,7 @@ void ITick.Tick(Actor self) if (!created && startsRevealed) { for (var playerIndex = 0; playerIndex < frozenStates.Count; playerIndex++) - UpdateFrozenActor(self, frozenStates[playerIndex].FrozenActor, playerIndex); + UpdateFrozenActor(frozenStates[playerIndex].FrozenActor, playerIndex); created = true; return; @@ -136,7 +136,7 @@ void ITick.Tick(Actor self) state.IsVisible = isVisible; if (isVisible) - UpdateFrozenActor(self, frozenActor, playerIndex); + UpdateFrozenActor(frozenActor, playerIndex); } } @@ -183,7 +183,7 @@ void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newO { // Force a state update for the old owner so the tooltip etc doesn't show them as the owner var oldOwnerIndex = self.World.Players.IndexOf(oldOwner); - UpdateFrozenActor(self, frozenStates[oldOwnerIndex].FrozenActor, oldOwnerIndex); + UpdateFrozenActor(frozenStates[oldOwnerIndex].FrozenActor, oldOwnerIndex); } void INotifyActorDisposing.Disposing(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Modifiers/WithColoredOverlay.cs b/OpenRA.Mods.Common/Traits/Modifiers/WithColoredOverlay.cs index 1322019d6b00..93ef48aa4855 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/WithColoredOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/WithColoredOverlay.cs @@ -42,10 +42,10 @@ IEnumerable IRenderModifier.ModifyRender(Actor self, WorldRenderer if (IsTraitDisabled) return r; - return ModifiedRender(self, wr, r); + return ModifiedRender(r); } - IEnumerable ModifiedRender(Actor self, WorldRenderer wr, IEnumerable r) + IEnumerable ModifiedRender(IEnumerable r) { foreach (var a in r) { diff --git a/OpenRA.Mods.Common/Traits/OwnerLostAction.cs b/OpenRA.Mods.Common/Traits/OwnerLostAction.cs index d905485b365c..da871cdacf91 100644 --- a/OpenRA.Mods.Common/Traits/OwnerLostAction.cs +++ b/OpenRA.Mods.Common/Traits/OwnerLostAction.cs @@ -31,12 +31,12 @@ public class OwnerLostActionInfo : ConditionalTraitInfo [Desc("The deathtypes used when 'Action' is 'Kill'.")] public readonly BitSet DeathTypes = default(BitSet); - public override object Create(ActorInitializer init) { return new OwnerLostAction(init, this); } + public override object Create(ActorInitializer init) { return new OwnerLostAction(this); } } public class OwnerLostAction : ConditionalTrait, INotifyOwnerLost { - public OwnerLostAction(ActorInitializer init, OwnerLostActionInfo info) + public OwnerLostAction(OwnerLostActionInfo info) : base(info) { } void INotifyOwnerLost.OnOwnerLost(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs index a89deadde8c4..dceb10546672 100644 --- a/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs @@ -48,7 +48,7 @@ public class ClassicParallelProductionQueue : ProductionQueue int penalty; public ClassicParallelProductionQueue(ActorInitializer init, ClassicParallelProductionQueueInfo info) - : base(init, init.Self, info) + : base(init, info) { self = init.Self; this.info = info; diff --git a/OpenRA.Mods.Common/Traits/Player/ClassicProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ClassicProductionQueue.cs index 3c21fbcedec4..cfa2557f6626 100644 --- a/OpenRA.Mods.Common/Traits/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ClassicProductionQueue.cs @@ -42,7 +42,7 @@ public class ClassicProductionQueue : ProductionQueue readonly ClassicProductionQueueInfo info; public ClassicProductionQueue(ActorInitializer init, ClassicProductionQueueInfo info) - : base(init, init.Self, info) + : base(init, info) { self = init.Self; this.info = info; diff --git a/OpenRA.Mods.Common/Traits/Player/ParallelProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ParallelProductionQueue.cs index 179f391f82c8..a14f2e3b6b82 100644 --- a/OpenRA.Mods.Common/Traits/Player/ParallelProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ParallelProductionQueue.cs @@ -15,13 +15,13 @@ namespace OpenRA.Mods.Common.Traits { public class ParallelProductionQueueInfo : ProductionQueueInfo { - public override object Create(ActorInitializer init) { return new ParallelProductionQueue(init, init.Self.Owner.PlayerActor, this); } + public override object Create(ActorInitializer init) { return new ParallelProductionQueue(init, this); } } public class ParallelProductionQueue : ProductionQueue { - public ParallelProductionQueue(ActorInitializer init, Actor playerActor, ParallelProductionQueueInfo info) - : base(init, playerActor, info) { } + public ParallelProductionQueue(ActorInitializer init, ParallelProductionQueueInfo info) + : base(init, info) { } protected override void TickInner(Actor self, bool allProductionPaused) { diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 970392fab03a..0aed3060064d 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -163,7 +163,7 @@ void IResolveOrder.ResolveOrder(Actor self, Order order) foreach (var a in self.World.ActorMap.GetActorsAt(targetLocation)) { var pluggables = a.TraitsImplementing() - .Where(p => p.AcceptsPlug(a, plugInfo.Type)) + .Where(p => p.AcceptsPlug(plugInfo.Type)) .ToList(); var pluggable = pluggables.FirstOrDefault(p => a.Location + p.Info.Offset == targetLocation) diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index 88c5bec47278..e3f5c5ebca75 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -159,7 +159,7 @@ public ArmyUnit(ActorInfo actorInfo, Player owner) if (BuildableInfo != null && rsi != null) { - var image = rsi.GetImage(actorInfo, owner.World.Map.Rules.Sequences, owner.Faction.Name); + var image = rsi.GetImage(actorInfo, owner.Faction.Name); Icon = new Animation(owner.World, image); Icon.Play(BuildableInfo.Icon); IconPalette = BuildableInfo.IconPalette; diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 009f511c9cfa..a9e15ff00770 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Attach this to an actor (usually a building) to let it produce units or construct buildings.", "If one builds another actor of this type, he will get a separate queue to create two actors", "at the same time. Will only work together with the Production: trait.")] - public class ProductionQueueInfo : TraitInfo + public class ProductionQueueInfo : TraitInfo, IRulesetLoaded { [FieldLoader.Require] [Desc("What kind of production will be added (e.g. Building, Infantry, Vehicle, ...)")] @@ -94,7 +94,7 @@ public class ProductionQueueInfo : TraitInfo "The filename of the audio is defined per faction in notifications.yaml.")] public readonly string CancelledAudio = null; - public override object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); } + public override object Create(ActorInitializer init) { return new ProductionQueue(init, this); } public void RulesetLoaded(Ruleset rules, ActorInfo ai) { @@ -132,7 +132,7 @@ public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyOw [Sync] public bool IsValidFaction { get; private set; } - public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info) + public ProductionQueue(ActorInitializer init, ProductionQueueInfo info) { self = init.Self; Info = info; @@ -153,7 +153,7 @@ void INotifyCreated.Created(Actor self) techTree = self.Owner.PlayerActor.Trait(); productionTraits = self.TraitsImplementing().Where(p => p.Info.Produces.Contains(Info.Type)).ToArray(); - CacheProducibles(self.Owner.PlayerActor); + CacheProducibles(); } protected void ClearQueue() @@ -181,7 +181,7 @@ void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newO // Regenerate the producibles and tech tree state oldOwner.PlayerActor.Trait().Remove(this); - CacheProducibles(newOwner.PlayerActor); + CacheProducibles(); techTree.Update(); } @@ -193,7 +193,7 @@ void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newO void INotifyTransform.OnTransform(Actor self) { } void INotifyTransform.AfterTransform(Actor self) { } - void CacheProducibles(Actor playerActor) + void CacheProducibles() { Producible.Clear(); if (!Enabled) diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index 9623efc783b4..d1095eadb052 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -107,7 +107,7 @@ void INotifyCreated.Created(Actor self) EnablePlug(self, initialPlug); } - public bool AcceptsPlug(Actor self, string type) + public bool AcceptsPlug(string type) { if (!Info.Conditions.ContainsKey(type)) return false; diff --git a/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs b/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs index b717b2a07608..467daefe4026 100644 --- a/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs +++ b/OpenRA.Mods.Common/Traits/QuantizeFacingsFromSequence.cs @@ -29,7 +29,7 @@ public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, throw new InvalidOperationException("Actor " + ai.Name + " is missing sequence to quantize facings from."); var rsi = ai.TraitInfo(); - return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, race), Sequence).Facings; + return sequenceProvider.GetSequence(rsi.GetImage(ai, race), Sequence).Facings; } public override object Create(ActorInitializer init) { return new QuantizeFacingsFromSequence(this); } diff --git a/OpenRA.Mods.Common/Traits/Radar/RadarColorFromTerrain.cs b/OpenRA.Mods.Common/Traits/Radar/RadarColorFromTerrain.cs index 7cba76f8e983..63c59b9f3b28 100644 --- a/OpenRA.Mods.Common/Traits/Radar/RadarColorFromTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Radar/RadarColorFromTerrain.cs @@ -37,7 +37,6 @@ public RadarColorFromTerrain(Actor self, RadarColorFromTerrainInfo info) c = info.GetColorFromTerrain(self.World); } - public bool VisibleOnRadar(Actor self) { return true; } public Color RadarColorOverride(Actor self, Color color) { return c; } } } diff --git a/OpenRA.Mods.Common/Traits/Render/Contrail.cs b/OpenRA.Mods.Common/Traits/Render/Contrail.cs index 44979d0e4246..ee3320a76de7 100644 --- a/OpenRA.Mods.Common/Traits/Render/Contrail.cs +++ b/OpenRA.Mods.Common/Traits/Render/Contrail.cs @@ -66,7 +66,7 @@ void ITick.Tick(Actor self) { // We want to update the trails' position even while the trait is disabled, // otherwise we might get visual 'jumps' when the trait is re-enabled. - var local = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation)); + var local = info.Offset.Rotate(body.QuantizeOrientation(self.Orientation)); trail.Update(self.CenterPosition + body.LocalToWorld(local)); } diff --git a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs index 58de209e8a01..43c1d34d4de0 100644 --- a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs @@ -23,7 +23,7 @@ class CustomTerrainDebugOverlayInfo : TraitInfo { public readonly string Font = "TinyBold"; - public override object Create(ActorInitializer init) { return new CustomTerrainDebugOverlay(init.Self, this); } + public override object Create(ActorInitializer init) { return new CustomTerrainDebugOverlay(this); } } class CustomTerrainDebugOverlay : IWorldLoaded, IChatCommand, IRenderAnnotations @@ -35,7 +35,7 @@ class CustomTerrainDebugOverlay : IWorldLoaded, IChatCommand, IRenderAnnotations readonly SpriteFont font; - public CustomTerrainDebugOverlay(Actor self, CustomTerrainDebugOverlayInfo info) + public CustomTerrainDebugOverlay(CustomTerrainDebugOverlayInfo info) { font = Game.Renderer.Fonts[info.Font]; } diff --git a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs index 53597f1edccc..6c56e01b6cca 100644 --- a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs +++ b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs @@ -35,7 +35,7 @@ public class DrawLineToTargetInfo : TraitInfo [Desc("Width (in pixels) of the queued end node markers.")] public readonly int QueuedMarkerWidth = 2; - public override object Create(ActorInitializer init) { return new DrawLineToTarget(init.Self, this); } + public override object Create(ActorInitializer init) { return new DrawLineToTarget(this); } } public class DrawLineToTarget : IRenderAboveShroud, IRenderAnnotationsWhenSelected, INotifySelected @@ -44,7 +44,7 @@ public class DrawLineToTarget : IRenderAboveShroud, IRenderAnnotationsWhenSelect readonly List renderableCache = new List(); long lifetime; - public DrawLineToTarget(Actor self, DrawLineToTargetInfo info) + public DrawLineToTarget(DrawLineToTargetInfo info) { this.info = info; } diff --git a/OpenRA.Mods.Common/Traits/Render/Hovers.cs b/OpenRA.Mods.Common/Traits/Render/Hovers.cs index d9b2dd68df89..c30dd990e923 100644 --- a/OpenRA.Mods.Common/Traits/Render/Hovers.cs +++ b/OpenRA.Mods.Common/Traits/Render/Hovers.cs @@ -39,7 +39,7 @@ public class HoversInfo : ConditionalTraitInfo, Requires [Desc("Initial Z axis modifier relative to actual position.")] public readonly WDist InitialHeight = new WDist(43); - public override object Create(ActorInitializer init) { return new Hovers(this, init.Self); } + public override object Create(ActorInitializer init) { return new Hovers(this); } public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { @@ -71,7 +71,7 @@ public class Hovers : ConditionalTrait, IRenderModifier, ITick int ticks; WVec worldVisualOffset; - public Hovers(HoversInfo info, Actor self) + public Hovers(HoversInfo info) : base(info) { this.info = info; diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs index f04f393de911..7a5e2c917c8a 100644 --- a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -62,7 +62,7 @@ public class LeavesTrailsInfo : ConditionalTraitInfo [Desc("Should the trail spawn relative to last position or current position?")] public readonly bool SpawnAtLastPosition = true; - public override object Create(ActorInitializer init) { return new LeavesTrails(init.Self, this); } + public override object Create(ActorInitializer init) { return new LeavesTrails(this); } } public class LeavesTrails : ConditionalTrait, ITick @@ -72,7 +72,7 @@ public class LeavesTrails : ConditionalTrait, ITick WAngle cachedFacing; int cachedInterval; - public LeavesTrails(Actor self, LeavesTrailsInfo info) + public LeavesTrails(LeavesTrailsInfo info) : base(info) { cachedInterval = Info.StartDelay; @@ -132,7 +132,7 @@ void ITick.Tick(Actor self) if (previouslySpawned && previousSpawnCell == spawnCell) spawnFacing = previousSpawnFacing; - var offsetRotation = Info.Offsets[offset].Rotate(body.QuantizeOrientation(self, self.Orientation)); + var offsetRotation = Info.Offsets[offset].Rotate(body.QuantizeOrientation(self.Orientation)); var spawnPosition = Info.SpawnAtLastPosition ? cachedPosition : self.CenterPosition; var pos = Info.Type == TrailType.CenterPosition ? spawnPosition + body.LocalToWorld(offsetRotation) : self.World.Map.CenterOfCell(spawnCell); diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs index 2fc13336d110..867614bd7b57 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs @@ -58,7 +58,7 @@ public RenderDetectionCircle(Actor self, RenderDetectionCircleInfo info) detectCloaked = self.TraitsImplementing().ToArray(); } - IEnumerable RenderCircle(Actor self, WorldRenderer wr, DetectionCircleVisibility visibility) + IEnumerable RenderCircle(Actor self, DetectionCircleVisibility visibility) { if (info.Visible != visibility || !self.Owner.IsAlliedWith(self.World.RenderPlayer)) yield break; @@ -85,14 +85,14 @@ IEnumerable RenderCircle(Actor self, WorldRenderer wr, DetectionCir IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { - return RenderCircle(self, wr, DetectionCircleVisibility.WhenSelected); + return RenderCircle(self, DetectionCircleVisibility.WhenSelected); } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; IEnumerable IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr) { - return RenderCircle(self, wr, DetectionCircleVisibility.Always); + return RenderCircle(self, DetectionCircleVisibility.Always); } bool IRenderAnnotations.SpatiallyPartitionable => false; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs index 28d8a5f94a44..a0063a0835d0 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs @@ -63,7 +63,7 @@ public IEnumerable RenderAnnotations(WorldRenderer wr, World w, Act var otherRanges = w.ActorsWithTrait() .Where(a => a.Trait.Info.RangeCircleType == RangeCircleType) - .SelectMany(a => a.Trait.RangeCircleRenderables(wr)); + .SelectMany(a => a.Trait.RangeCircleRenderables()); return otherRanges.Append(localRange); } @@ -99,7 +99,7 @@ public RenderRangeCircle(Actor self, RenderRangeCircleInfo info) attack = self.Trait(); } - public IEnumerable RangeCircleRenderables(WorldRenderer wr) + public IEnumerable RangeCircleRenderables() { if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) yield break; @@ -120,7 +120,7 @@ public IEnumerable RangeCircleRenderables(WorldRenderer wr) IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { - return RangeCircleRenderables(wr); + return RangeCircleRenderables(); } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs index fe0500c61d23..ee9f19db8475 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs @@ -50,12 +50,12 @@ public IEnumerable RenderAnnotations(WorldRenderer wr, World w, Act BorderWidth); var otherRangeRenderables = w.ActorsWithTrait() - .SelectMany(a => a.Trait.RangeCircleRenderables(a.Actor, wr)); + .SelectMany(a => a.Trait.RangeCircleRenderables(a.Actor)); return otherRangeRenderables.Append(localRangeRenderable); } - public override object Create(ActorInitializer init) { return new RenderShroudCircle(init.Self, this); } + public override object Create(ActorInitializer init) { return new RenderShroudCircle(this); } } class RenderShroudCircle : INotifyCreated, IRenderAnnotationsWhenSelected @@ -63,7 +63,7 @@ class RenderShroudCircle : INotifyCreated, IRenderAnnotationsWhenSelected readonly RenderShroudCircleInfo info; WDist range; - public RenderShroudCircle(Actor self, RenderShroudCircleInfo info) + public RenderShroudCircle(RenderShroudCircleInfo info) { this.info = info; } @@ -76,7 +76,7 @@ void INotifyCreated.Created(Actor self) .Max(); } - public IEnumerable RangeCircleRenderables(Actor self, WorldRenderer wr) + public IEnumerable RangeCircleRenderables(Actor self) { if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) yield break; @@ -93,7 +93,7 @@ public IEnumerable RangeCircleRenderables(Actor self, WorldRenderer IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { - return RangeCircleRenderables(self, wr); + return RangeCircleRenderables(self); } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index b7e673e60beb..889e7d24208d 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -48,7 +48,7 @@ public IEnumerable RenderPreview(ActorPreviewInitializer init) var sequenceProvider = init.World.Map.Rules.Sequences; var faction = init.GetValue(this); var ownerName = init.Get().InternalName; - var image = GetImage(init.Actor, sequenceProvider, faction); + var image = GetImage(init.Actor, faction); var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName); var facings = 0; @@ -69,7 +69,7 @@ public IEnumerable RenderPreview(ActorPreviewInitializer init) yield return preview; } - public string GetImage(ActorInfo actor, SequenceProvider sequenceProvider, string faction) + public string GetImage(ActorInfo actor, string faction) { if (FactionImages != null && !string.IsNullOrEmpty(faction) && FactionImages.TryGetValue(faction, out var factionImage)) return factionImage.ToLowerInvariant(); @@ -164,7 +164,7 @@ public string GetImage(Actor self) if (cachedImage != null) return cachedImage; - return cachedImage = Info.GetImage(self.Info, self.World.Map.Rules.Sequences, faction); + return cachedImage = Info.GetImage(self.Info, faction); } public void UpdatePalette() @@ -189,7 +189,7 @@ public virtual IEnumerable Render(Actor self, WorldRenderer wr) a.CachePalette(wr, owner); } - foreach (var r in a.Animation.Render(self, wr, a.PaletteReference)) + foreach (var r in a.Animation.Render(self, a.PaletteReference)) yield return r; } } @@ -261,13 +261,13 @@ public static string NormalizeSequence(Animation anim, DamageState state, string } // Required by WithSpriteBody and WithInfantryBody - public int2 AutoSelectionSize(Actor self) + public int2 AutoSelectionSize() { - return AutoRenderSize(self); + return AutoRenderSize(); } // Required by WithSpriteBody and WithInfantryBody - public int2 AutoRenderSize(Actor self) + public int2 AutoRenderSize() { return anims.Where(b => b.IsVisible && b.Animation.Animation.CurrentSequence != null) diff --git a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs index ae80cbbf4ffb..c93a1ba745fc 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs @@ -59,7 +59,7 @@ public WithAttackOverlay(ActorInitializer init, WithAttackOverlayInfo info) info.Palette, info.IsPlayerPalette); } - void PlayOverlay(Actor self) + void PlayOverlay() { attacking = true; overlay.PlayThen(info.Sequence, () => attacking = false); @@ -72,7 +72,7 @@ void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel ba if (info.Delay > 0) tick = info.Delay; else - PlayOverlay(self); + PlayOverlay(); } } @@ -83,14 +83,14 @@ void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Bar if (info.Delay > 0) tick = info.Delay; else - PlayOverlay(self); + PlayOverlay(); } } void ITick.Tick(Actor self) { if (info.Delay > 0 && --tick == 0) - PlayOverlay(self); + PlayOverlay(); } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs index 2bcb67770223..1ffd2ebba11c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs @@ -48,7 +48,7 @@ public WithBuildingPlacedOverlay(Actor self, WithBuildingPlacedOverlayInfo info) overlay = new Animation(self.World, rs.GetImage(self)); var anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => !visible || IsTraitDisabled); overlay.PlayThen(info.Sequence, () => visible = false); diff --git a/OpenRA.Mods.Common/Traits/Render/WithDockedOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithDockedOverlay.cs index f2002b84a417..70eed3ed3c48 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDockedOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDockedOverlay.cs @@ -49,7 +49,7 @@ public WithDockedOverlay(Actor self, WithDockedOverlayInfo info) overlay.Play(info.Sequence); anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled || !docked); rs.Add(anim, info.Palette, info.IsPlayerPalette); diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs index e7bf5b434d68..202d161b0051 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs @@ -49,7 +49,7 @@ public WithHarvestOverlay(Actor self, WithHarvestOverlayInfo info) anim.Play(info.Sequence); rs.Add(new AnimationWithOffset(anim, - () => body.LocalToWorld(info.LocalOffset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.LocalOffset.Rotate(body.QuantizeOrientation(self.Orientation))), () => !visible, p => ZOffsetFromCenter(self, p, 0)), info.Palette); } diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs index ba3b1d783d61..b56990d62760 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs @@ -109,7 +109,7 @@ public WithIdleOverlay(Actor self, WithIdleOverlayInfo info) overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)); var anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 1)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs index 8fed2799b234..4fa8cf26be70 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs @@ -80,7 +80,7 @@ public void Forward(Actor self, Action onComplete) }); foreach (var overlay in overlays) - overlay.Forward(self); + overlay.Forward(); } public void Reverse(Actor self, Action onComplete) @@ -106,7 +106,7 @@ public void Reverse(Actor self, Action onComplete) }); foreach (var overlay in overlays) - overlay.Reverse(self); + overlay.Reverse(); } public void Reverse(Actor self, Activity activity, bool queued = true) @@ -125,7 +125,7 @@ public void Reverse(Actor self, Activity activity, bool queued = true) }); foreach (var overlay in overlays) - overlay.Reverse(self); + overlay.Reverse(); } // TODO: Make this use Forward instead @@ -161,7 +161,7 @@ void INotifyDeployTriggered.Deploy(Actor self, bool skipMakeAnim) } foreach (var overlay in overlays) - overlay.Forward(self); + overlay.Forward(); } // TODO: Make this use Reverse instead @@ -197,7 +197,7 @@ void INotifyDeployTriggered.Undeploy(Actor self, bool skipMakeAnim) } foreach (var overlay in overlays) - overlay.Reverse(self); + overlay.Reverse(); } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithMakeOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMakeOverlay.cs index 8a3427a49a71..da63d459cec8 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMakeOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMakeOverlay.cs @@ -50,13 +50,13 @@ public WithMakeOverlay(Actor self, WithMakeOverlayInfo info) rs.Add(anim, info.Palette, info.IsPlayerPalette); } - public void Forward(Actor self) + public void Forward() { visible = true; anim.Animation.PlayThen(info.Sequence, () => visible = false); } - public void Reverse(Actor self) + public void Reverse() { visible = true; anim.Animation.PlayBackwardsThen(info.Sequence, () => visible = false); diff --git a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs index 3f36032ad9d4..23652dee15fc 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs @@ -93,7 +93,7 @@ IEnumerable IRender.Render(Actor self, WorldRenderer wr) if (anim.DisableFunc != null && anim.DisableFunc()) continue; - foreach (var r in anim.Render(self, wr, palette)) + foreach (var r in anim.Render(self, palette)) yield return r; } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs index 71aa55356605..12ec83c21c50 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs @@ -130,7 +130,7 @@ public WithParachute(Actor self, WithParachuteInfo info) var overlay = new Animation(self.World, info.Image); var body = self.Trait(); anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled && !renderProlonged, p => RenderUtils.ZOffsetFromCenter(self, p, 1)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs index 28d4b0b63be1..bc80fd527df4 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs @@ -66,7 +66,7 @@ public WithProductionOverlay(Actor self, WithProductionOverlayInfo info) overlay.PlayRepeating(info.Sequence); var anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => !IsProducing || IsTraitDisabled); rs.Add(anim, info.Palette, info.IsPlayerPalette); diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs index 8031b9e58ff4..2ddcee4c2844 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs @@ -65,7 +65,7 @@ public IEnumerable RenderAnnotations(WorldRenderer wr, World w, Act foreach (var a in w.ActorsWithTrait()) if (a.Trait.Info.Type == Type) - foreach (var r in a.Trait.RenderRangeCircle(a.Actor, wr, RangeCircleVisibility.WhenSelected)) + foreach (var r in a.Trait.RenderRangeCircle(a.Actor, RangeCircleVisibility.WhenSelected)) yield return r; } } @@ -95,7 +95,7 @@ bool Visible } } - public IEnumerable RenderRangeCircle(Actor self, WorldRenderer wr, RangeCircleVisibility visibility) + public IEnumerable RenderRangeCircle(Actor self, RangeCircleVisibility visibility) { if (Info.Visible == visibility && Visible) yield return new RangeCircleAnnotationRenderable( @@ -110,14 +110,14 @@ public IEnumerable RenderRangeCircle(Actor self, WorldRenderer wr, IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { - return RenderRangeCircle(self, wr, RangeCircleVisibility.WhenSelected); + return RenderRangeCircle(self, RangeCircleVisibility.WhenSelected); } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; IEnumerable IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr) { - return RenderRangeCircle(self, wr, RangeCircleVisibility.Always); + return RenderRangeCircle(self, RangeCircleVisibility.Always); } bool IRenderAnnotations.SpatiallyPartitionable => false; diff --git a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs index dd64f92cd2b0..51ceb814a7e3 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs @@ -59,7 +59,7 @@ public WithRepairOverlay(Actor self, WithRepairOverlayInfo info) overlay.PlayThen(info.Sequence, () => visible = false); var anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled || !visible, p => RenderUtils.ZOffsetFromCenter(self, p, 1)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithSupportPowerActivationOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithSupportPowerActivationOverlay.cs index dc6d7485af74..a585b3fc4474 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSupportPowerActivationOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSupportPowerActivationOverlay.cs @@ -49,7 +49,7 @@ public WithSupportPowerActivationOverlay(Actor self, WithSupportPowerActivationO overlay.PlayThen(info.Sequence, () => visible = false); var anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled || !visible, p => RenderUtils.ZOffsetFromCenter(self, p, 1)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs index 88a7562edd18..24f593d64f2a 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs @@ -88,7 +88,7 @@ WVec BarrelOffset() var localOffset = Info.LocalOffset + new WVec(-armament.Recoil, WDist.Zero, WDist.Zero); // Turret coordinates to body coordinates - var bodyOrientation = body.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = body.QuantizeOrientation(self.Orientation); localOffset = localOffset.Rotate(turreted.WorldOrientation) + turreted.Offset.Rotate(bodyOrientation); // Body coordinates to world coordinates diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs index 4769ae7739cf..6fe8c842e7da 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs @@ -52,7 +52,7 @@ public WithVoxelBody(Actor self, WithVoxelBodyInfo info) var model = self.World.ModelCache.GetModelSequence(rv.Image, info.Sequence); modelAnimation = new ModelAnimation(model, () => WVec.Zero, - () => body.QuantizeOrientation(self, self.Orientation), + () => body.QuantizeOrientation(self.Orientation), () => IsTraitDisabled, () => 0, info.ShowShadow); rv.Add(modelAnimation); diff --git a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs index 2d1405aa8385..31de064dedcf 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs @@ -34,14 +34,14 @@ public class RevealOnDeathInfo : ConditionalTraitInfo "Use an empty list (the default) to allow all DeathTypes.")] public readonly BitSet DeathTypes = default(BitSet); - public override object Create(ActorInitializer init) { return new RevealOnDeath(init.Self, this); } + public override object Create(ActorInitializer init) { return new RevealOnDeath(this); } } public class RevealOnDeath : ConditionalTrait, INotifyKilled { readonly RevealOnDeathInfo info; - public RevealOnDeath(Actor self, RevealOnDeathInfo info) + public RevealOnDeath(RevealOnDeathInfo info) : base(info) { this.info = info; diff --git a/OpenRA.Mods.Common/Traits/RevealOnFire.cs b/OpenRA.Mods.Common/Traits/RevealOnFire.cs index 6f186f491ea0..d471ec85e32e 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnFire.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnFire.cs @@ -33,14 +33,14 @@ public class RevealOnFireInfo : ConditionalTraitInfo [Desc("Can this actor be revealed through shroud generated by the `" + nameof(CreatesShroud) + "` trait?")] public readonly bool RevealGeneratedShroud = true; - public override object Create(ActorInitializer init) { return new RevealOnFire(init.Self, this); } + public override object Create(ActorInitializer init) { return new RevealOnFire(this); } } public class RevealOnFire : ConditionalTrait, INotifyAttack { readonly RevealOnFireInfo info; - public RevealOnFire(Actor self, RevealOnFireInfo info) + public RevealOnFire(RevealOnFireInfo info) : base(info) { this.info = info; diff --git a/OpenRA.Mods.Common/Traits/RevealsMap.cs b/OpenRA.Mods.Common/Traits/RevealsMap.cs index baad3d515fa8..bbd42f83523b 100644 --- a/OpenRA.Mods.Common/Traits/RevealsMap.cs +++ b/OpenRA.Mods.Common/Traits/RevealsMap.cs @@ -44,7 +44,7 @@ protected void AddCellsToPlayerShroud(Actor self, Player p, PPos[] uv) p.Shroud.AddSource(this, type, uv); } - protected void RemoveCellsFromPlayerShroud(Actor self, Player p) { p.Shroud.RemoveSource(this); } + protected void RemoveCellsFromPlayerShroud(Player p) { p.Shroud.RemoveSource(this); } protected PPos[] ProjectedCells(Actor self) { @@ -58,7 +58,7 @@ void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newO var cells = ProjectedCells(self); foreach (var player in self.World.Players) { - RemoveCellsFromPlayerShroud(self, player); + RemoveCellsFromPlayerShroud(player); AddCellsToPlayerShroud(self, player, cells); } } @@ -67,13 +67,13 @@ void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newO void INotifyActorDisposing.Disposing(Actor self) { foreach (var player in self.World.Players) - RemoveCellsFromPlayerShroud(self, player); + RemoveCellsFromPlayerShroud(player); } void INotifyKilled.Killed(Actor self, AttackInfo e) { foreach (var player in self.World.Players) - RemoveCellsFromPlayerShroud(self, player); + RemoveCellsFromPlayerShroud(player); } protected override void TraitEnabled(Actor self) @@ -86,7 +86,7 @@ protected override void TraitEnabled(Actor self) protected override void TraitDisabled(Actor self) { foreach (var player in self.World.Players) - RemoveCellsFromPlayerShroud(self, player); + RemoveCellsFromPlayerShroud(player); } } } diff --git a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs index e09a232902cd..438376e07296 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs @@ -23,7 +23,7 @@ public class AnnounceOnKillInfo : TraitInfo [Desc("Voice to use when killing something.")] public readonly string Voice = "Kill"; - public override object Create(ActorInitializer init) { return new AnnounceOnKill(init.Self, this); } + public override object Create(ActorInitializer init) { return new AnnounceOnKill(this); } } public class AnnounceOnKill : INotifyAppliedDamage @@ -32,7 +32,7 @@ public class AnnounceOnKill : INotifyAppliedDamage long lastAnnounce; - public AnnounceOnKill(Actor self, AnnounceOnKillInfo info) + public AnnounceOnKill(AnnounceOnKillInfo info) { this.info = info; lastAnnounce = -info.Interval; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 5dbb0637ae31..a88ffe6fe949 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -159,7 +159,7 @@ public Actor[] SendAirstrike(Actor self, WPos target, WAngle? facing = null) aircraftInRange.Add(a, false); var attack = a.Trait(); - attack.SetTarget(self.World, target + targetOffset); + attack.SetTarget(target + targetOffset); attack.OnEnteredAttackRange += onEnterRange; attack.OnExitedAttackRange += onExitRange; attack.OnRemovedFromWorld += onRemovedFromWorld; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index 27731fa36d87..f18d91bd5071 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -89,7 +89,7 @@ public override void Activate(Actor self, Order order, SupportPowerManager manag foreach (var a in UnitsInRange(self.World.Map.CellContaining(order.Target.CenterPosition))) a.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == info.Condition && t.CanGrantCondition(a, self)) + .FirstOrDefault(t => t.Info.Condition == info.Condition && t.CanGrantCondition(self)) ?.GrantCondition(a, self, info.Duration); } @@ -106,7 +106,7 @@ public IEnumerable UnitsInRange(CPos xy) return false; return a.TraitsImplementing() - .Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(a, Self)); + .Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(Self)); }); } diff --git a/OpenRA.Mods.Common/Traits/Targetable.cs b/OpenRA.Mods.Common/Traits/Targetable.cs index 2980385d6ff8..10ac273c4f09 100644 --- a/OpenRA.Mods.Common/Traits/Targetable.cs +++ b/OpenRA.Mods.Common/Traits/Targetable.cs @@ -25,7 +25,7 @@ public class TargetableInfo : ConditionalTraitInfo, ITargetableInfo public bool RequiresForceFire = false; - public override object Create(ActorInitializer init) { return new Targetable(init.Self, this); } + public override object Create(ActorInitializer init) { return new Targetable(this); } } public class Targetable : ConditionalTrait, ITargetable @@ -33,7 +33,7 @@ public class Targetable : ConditionalTrait, ITargetable protected static readonly string[] None = Array.Empty(); protected Cloak[] cloaks; - public Targetable(Actor self, TargetableInfo info) + public Targetable(TargetableInfo info) : base(info) { } protected override void Created(Actor self) diff --git a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs index 5c19f70d254d..51b2b6be2b25 100644 --- a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs +++ b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs @@ -74,7 +74,7 @@ public ThrowsParticle(ActorInitializer init, ThrowsParticleInfo info) var throwRotation = WRot.FromYaw(new WAngle(Game.CosmeticRandom.Next(1024))); var throwDistance = Game.CosmeticRandom.Next(info.MinThrowRange.Length, info.MaxThrowRange.Length); - initialPos = pos = info.Offset.Rotate(body.QuantizeOrientation(self, WRot.FromYaw(bodyFacing))); + initialPos = pos = info.Offset.Rotate(body.QuantizeOrientation(WRot.FromYaw(bodyFacing))); finalPos = initialPos + new WVec(throwDistance, 0, 0).Rotate(throwRotation); angle = new WAngle(Game.CosmeticRandom.Next(info.MinThrowAngle.Angle, info.MaxThrowAngle.Angle)); length = (finalPos - initialPos).Length / info.Velocity; diff --git a/OpenRA.Mods.Common/Traits/Turreted.cs b/OpenRA.Mods.Common/Traits/Turreted.cs index 759b32f6cce2..45528dc438eb 100644 --- a/OpenRA.Mods.Common/Traits/Turreted.cs +++ b/OpenRA.Mods.Common/Traits/Turreted.cs @@ -282,7 +282,7 @@ public virtual bool HasAchievedDesiredFacing // Turret offset in world-space public WVec Position(Actor self) { - var bodyOrientation = body.QuantizeOrientation(self, self.Orientation); + var bodyOrientation = body.QuantizeOrientation(self.Orientation); return body.LocalToWorld(Offset.Rotate(bodyOrientation)); } diff --git a/OpenRA.Mods.Common/Traits/Voiced.cs b/OpenRA.Mods.Common/Traits/Voiced.cs index 3db4d78e1b66..f017a9aa7961 100644 --- a/OpenRA.Mods.Common/Traits/Voiced.cs +++ b/OpenRA.Mods.Common/Traits/Voiced.cs @@ -24,14 +24,14 @@ public class VoicedInfo : TraitInfo [Desc("Multiply volume with this factor.")] public readonly float Volume = 1f; - public override object Create(ActorInitializer init) { return new Voiced(init.Self, this); } + public override object Create(ActorInitializer init) { return new Voiced(this); } } public class Voiced : IVoiced { public readonly VoicedInfo Info; - public Voiced(Actor self, VoicedInfo info) + public Voiced(VoicedInfo info) { Info = info; } diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index 3275575ca0f3..79e4ec84ffaa 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -33,7 +33,7 @@ void ICreatePlayersInfo.CreateServerPlayers(MapPreview map, Session lobbyInfo, L throw new NotImplementedException("EditorActorLayer must not be defined on the world actor"); } - public override object Create(ActorInitializer init) { return new EditorActorLayer(init.Self, this); } + public override object Create(ActorInitializer init) { return new EditorActorLayer(this); } } public class EditorActorLayer : IWorldLoaded, ITickRender, IRender, IRadarSignature, ICreatePlayers, IRenderAnnotations @@ -47,7 +47,7 @@ public class EditorActorLayer : IWorldLoaded, ITickRender, IRender, IRadarSignat public MapPlayers Players { get; private set; } - public EditorActorLayer(Actor self, EditorActorLayerInfo info) + public EditorActorLayer(EditorActorLayerInfo info) { this.info = info; } diff --git a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs index 06e0b19e7307..d97788f2682d 100644 --- a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs @@ -62,7 +62,7 @@ public void WorldLoaded(World w, WorldRenderer wr) // Link adjacent (long)-bridges so that artwork is updated correctly foreach (var p in w.ActorsWithTrait()) - p.Trait.LinkNeighbouringBridges(w, this); + p.Trait.LinkNeighbouringBridges(this); } void ConvertBridgeToActor(World w, CPos cell) diff --git a/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs b/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs index d42dd7f6965d..62b2ae4ecd0f 100644 --- a/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs +++ b/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs @@ -184,7 +184,7 @@ void IWorldLoaded.WorldLoaded(World world, WorldRenderer wr) foreach (var q in world.Players) if (p.IsAlliedWith(q)) - q.Shroud.ExploreProjectedCells(world, cells); + q.Shroud.ExploreProjectedCells(cells); } } } diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs index ecf509517f1c..6cb9dcb3791a 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs @@ -120,7 +120,7 @@ void TestMap(Map map, ModData modData) // Run all rule checks on the map if it defines custom rules. if (map.RuleDefinitions != null || map.VoiceDefinitions != null || map.WeaponDefinitions != null) - CheckRules(modData, map.Rules, map); + CheckRules(modData, map.Rules); // Run all map-level checks here. foreach (var customMapPassType in modData.ObjectCreator.GetTypesImplementing()) @@ -137,7 +137,7 @@ void TestMap(Map map, ModData modData) } } - void CheckRules(ModData modData, Ruleset rules, Map map = null) + void CheckRules(ModData modData, Ruleset rules) { foreach (var customRulesPassType in modData.ObjectCreator.GetTypesImplementing()) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index fbb8135cc740..58e3d2393d4b 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -224,9 +224,9 @@ void LoadVideos(IniFile file, string section) public virtual void ReadActors(IniFile file) { - LoadActors(file, "STRUCTURES", Players, MapSize, Map); - LoadActors(file, "UNITS", Players, MapSize, Map); - LoadActors(file, "INFANTRY", Players, MapSize, Map); + LoadActors(file, "STRUCTURES", Players, Map); + LoadActors(file, "UNITS", Players, Map); + LoadActors(file, "INFANTRY", Players, Map); } public abstract void LoadPlayer(IniFile file, string section); @@ -383,7 +383,7 @@ public virtual CPos ParseActorLocation(string input, int loc) return new CPos(loc % MapSize, loc / MapSize); } - public void LoadActors(IniFile file, string section, List players, int mapSize, Map map) + public void LoadActors(IniFile file, string section, List players, Map map) { foreach (var s in file.GetSection(section, true)) { diff --git a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs index 8ef4a5e3e3dd..9bc5c2431663 100644 --- a/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/GrantExternalConditionWarhead.cs @@ -43,7 +43,7 @@ public override void DoImpact(in Target target, WarheadArgs args) continue; a.TraitsImplementing() - .FirstOrDefault(t => t.Info.Condition == Condition && t.CanGrantCondition(a, firedBy)) + .FirstOrDefault(t => t.Info.Condition == Condition && t.CanGrantCondition(firedBy)) ?.GrantCondition(a, firedBy, Duration); } } diff --git a/OpenRA.Mods.Common/Widgets/ControlGroupsWidget.cs b/OpenRA.Mods.Common/Widgets/ControlGroupsWidget.cs index d9ec5457a876..6fcace2b95b3 100644 --- a/OpenRA.Mods.Common/Widgets/ControlGroupsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ControlGroupsWidget.cs @@ -40,7 +40,7 @@ public class ControlGroupsWidget : Widget public readonly string JumpToGroupKeyPrefix = null; [CustomLintableHotkeyNames] - public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError, Action emitWarning) + public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError) { var count = Game.ModData.DefaultRules.Actors[SystemActors.World].TraitInfo().Groups.Length; if (count == 0) diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index d0c53f6c6c6c..e4c4c1bf84a3 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -129,7 +129,7 @@ public AssetBrowserLogic(Widget widget, Action onExit, ModData modData, WorldRen var paletteDropDown = panel.GetOrNull("PALETTE_SELECTOR"); if (paletteDropDown != null) { - paletteDropDown.OnMouseDown = _ => ShowPaletteDropdown(paletteDropDown, world); + paletteDropDown.OnMouseDown = _ => ShowPaletteDropdown(paletteDropDown); paletteDropDown.GetText = () => currentPalette; paletteDropDown.IsVisible = () => currentSprites != null || currentVoxel != null; panel.GetOrNull("PALETTE_DESC").IsVisible = () => currentSprites != null || currentVoxel != null; @@ -587,7 +587,7 @@ void PopulateAssetList() } } - bool ShowPaletteDropdown(DropDownButtonWidget dropdown, World world) + bool ShowPaletteDropdown(DropDownButtonWidget dropdown) { Func setupItem = (name, itemTemplate) => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs index 9071009e1f9c..8a553da6cb82 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Widgets; @@ -25,7 +24,7 @@ public class HistoryLogLogic : ChromeLogic readonly Dictionary states = new Dictionary(); [ObjectCreator.UseCtor] - public HistoryLogLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary logicArgs) + public HistoryLogLogic(Widget widget, World world) { panel = widget.Get("HISTORY_LIST"); template = panel.Get("HISTORY_TEMPLATE"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs index 652b327a4d84..b8c340c7968b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs @@ -35,10 +35,10 @@ public LayerSelectorLogic(Widget widget, WorldRenderer worldRenderer) layerTemplateList.Layout = new GridLayout(layerTemplateList); layerPreviewTemplate = layerTemplateList.Get("LAYERPREVIEW_TEMPLATE"); - IntializeLayerPreview(widget); + IntializeLayerPreview(); } - void IntializeLayerPreview(Widget widget) + void IntializeLayerPreview() { layerTemplateList.RemoveChildren(); var rules = worldRenderer.World.Map.Rules; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorTabsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorTabsLogic.cs index 993c041a32a9..dbdb937bda9a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorTabsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorTabsLogic.cs @@ -9,7 +9,6 @@ */ #endregion -using OpenRA.Graphics; using OpenRA.Widgets; namespace OpenRA.Mods.Common.Widgets.Logic @@ -23,7 +22,7 @@ protected enum MenuType { Tiles, Layers, Actors, History } readonly Widget tabContainer; [ObjectCreator.UseCtor] - public MapEditorTabsLogic(Widget widget, WorldRenderer worldRenderer) + public MapEditorTabsLogic(Widget widget) { this.widget = widget; tabContainer = widget.Get("MAP_EDITOR_TAB_CONTAINER"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ClassicProductionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ClassicProductionLogic.cs index 10f61d380722..e1057159e0ce 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ClassicProductionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ClassicProductionLogic.cs @@ -12,7 +12,6 @@ using System; using System.Linq; using OpenRA.Mods.Common.Traits; -using OpenRA.Network; using OpenRA.Widgets; namespace OpenRA.Mods.Common.Widgets.Logic @@ -22,7 +21,7 @@ public class ClassicProductionLogic : ChromeLogic readonly ProductionPaletteWidget palette; readonly World world; - void SetupProductionGroupButton(OrderManager orderManager, ProductionTypeButtonWidget button) + void SetupProductionGroupButton(ProductionTypeButtonWidget button) { if (button == null) return; @@ -56,7 +55,7 @@ void SetupProductionGroupButton(OrderManager orderManager, ProductionTypeButtonW } [ObjectCreator.UseCtor] - public ClassicProductionLogic(Widget widget, OrderManager orderManager, World world) + public ClassicProductionLogic(Widget widget, World world) { this.world = world; palette = widget.Get("PRODUCTION_PALETTE"); @@ -124,7 +123,7 @@ public ClassicProductionLogic(Widget widget, OrderManager orderManager, World wo var typesContainer = widget.Get("PRODUCTION_TYPES"); foreach (var i in typesContainer.Children) - SetupProductionGroupButton(orderManager, i as ProductionTypeButtonWidget); + SetupProductionGroupButton(i as ProductionTypeButtonWidget); var ticker = widget.Get("PRODUCTION_TICKER"); ticker.OnTick = () => diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs index 791ed392f2a4..aa9f77031106 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs @@ -317,7 +317,7 @@ void PerformKeyboardOrderOnSelection(Func f) foreach (var o in orders) world.IssueOrder(o); - world.PlayVoiceForOrders(orders); + orders.PlayVoiceForOrders(); } void PerformDeployOrderOnSelection(bool queued) @@ -333,7 +333,7 @@ void PerformDeployOrderOnSelection(bool queued) foreach (var o in orders) world.IssueOrder(o); - world.PlayVoiceForOrders(orders); + orders.PlayVoiceForOrders(); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugLogic.cs index f1dd965f1a36..f52c55b0e3e4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugLogic.cs @@ -11,7 +11,6 @@ using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; -using OpenRA.Network; using OpenRA.Widgets; namespace OpenRA.Mods.Common.Widgets.Logic.Ingame @@ -19,7 +18,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame public class DebugLogic : ChromeLogic { [ObjectCreator.UseCtor] - public DebugLogic(Widget widget, OrderManager orderManager, World world, WorldRenderer worldRenderer) + public DebugLogic(Widget widget, World world, WorldRenderer worldRenderer) { var geometryOverlay = world.WorldActor.TraitOrDefault(); if (geometryOverlay != null) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs index 84c4b67a41ec..4bcede5b848f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic public class SupportPowerBinLogic : ChromeLogic { [ObjectCreator.UseCtor] - public SupportPowerBinLogic(Widget widget, World world) + public SupportPowerBinLogic(Widget widget) { var palette = widget.Get("SUPPORT_PALETTE"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromDiscLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromDiscLogic.cs index 6f82e8e8aa72..f2a2ec31b696 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromDiscLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromDiscLogic.cs @@ -54,14 +54,13 @@ enum Mode { Progress, Message, List } Mode visible = Mode.Progress; [ObjectCreator.UseCtor] - public InstallFromDiscLogic(Widget widget, ModContent content, Dictionary sources, Action afterInstall) + public InstallFromDiscLogic(Widget widget, ModContent content, Dictionary sources) { this.content = content; this.sources = sources; Log.AddChannel("install", "install.log"); - // this.afterInstall = afterInstall; panel = widget.Get("DISC_INSTALL_PANEL"); titleLabel = panel.Get("TITLE"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs index 96dc59d9dac0..633b4f6b5f35 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs @@ -30,7 +30,7 @@ public class ModContentLogic : ChromeLogic bool discAvailable; [ObjectCreator.UseCtor] - public ModContentLogic(Widget widget, ModData modData, Manifest mod, ModContent content, Action onCancel) + public ModContentLogic(Widget widget, Manifest mod, ModContent content, Action onCancel) { this.content = content; @@ -77,7 +77,6 @@ public ModContentLogic(Widget widget, ModData modData, Manifest mod, ModContent discButton.OnClick = () => Ui.OpenWindow("DISC_INSTALL_PANEL", new WidgetArgs { - { "afterInstall", () => { } }, { "sources", sources }, { "content", content } }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs index 4cfac3421cdf..db0140348a1f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs @@ -24,7 +24,7 @@ public class ModContentPromptLogic : ChromeLogic bool requiredContentInstalled; [ObjectCreator.UseCtor] - public ModContentPromptLogic(Widget widget, ModData modData, Manifest mod, ModContent content, Action continueLoading) + public ModContentPromptLogic(Widget widget, Manifest mod, ModContent content, Action continueLoading) { this.content = content; CheckRequiredContentInstalled(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LatencyTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LatencyTooltipLogic.cs index 6215bc4a548c..51c2b53461e1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LatencyTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LatencyTooltipLogic.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic public class LatencyTooltipLogic : ChromeLogic { [ObjectCreator.UseCtor] - public LatencyTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, OrderManager orderManager, Session.Client client) + public LatencyTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Session.Client client) { var latencyPrefix = widget.Get("LATENCY_PREFIX"); var latencyPrefixFont = Game.Renderer.Fonts[latencyPrefix.Font]; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index f39306c6938b..cbaddcc2ce5f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -602,7 +602,7 @@ void UpdatePlayerList() template = emptySlotTemplate.Clone(); if (isHost) - LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, worldRenderer, map); + LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map); else LobbyUtils.SetupSlotWidget(template, slot, client); @@ -621,16 +621,16 @@ void UpdatePlayerList() LobbyUtils.SetupLatencyWidget(template, client, orderManager); if (client.Bot != null) - LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, worldRenderer, map); + LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager, map); else - LobbyUtils.SetupEditableNameWidget(template, slot, client, orderManager, worldRenderer); + LobbyUtils.SetupEditableNameWidget(template, client, orderManager, worldRenderer); LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, worldRenderer, colorManager); LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions); LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, map); - LobbyUtils.SetupEditableHandicapWidget(template, slot, client, orderManager, map); + LobbyUtils.SetupEditableHandicapWidget(template, slot, client, orderManager); LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, map); - LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, map, MapIsPlayable); + LobbyUtils.SetupEditableReadyWidget(template, client, orderManager, map, MapIsPlayable); } else { @@ -639,26 +639,26 @@ void UpdatePlayerList() template = nonEditablePlayerTemplate.Clone(); LobbyUtils.SetupLatencyWidget(template, client, orderManager); - LobbyUtils.SetupColorWidget(template, slot, client); - LobbyUtils.SetupFactionWidget(template, slot, client, factions); + LobbyUtils.SetupColorWidget(template, client); + LobbyUtils.SetupFactionWidget(template, client, factions); if (isHost) { LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, map); - LobbyUtils.SetupEditableHandicapWidget(template, slot, client, orderManager, map); + LobbyUtils.SetupEditableHandicapWidget(template, slot, client, orderManager); LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, map); - LobbyUtils.SetupPlayerActionWidget(template, slot, client, orderManager, worldRenderer, + LobbyUtils.SetupPlayerActionWidget(template, client, orderManager, worldRenderer, lobby, () => panel = PanelType.Kick, () => panel = PanelType.Players); } else { - LobbyUtils.SetupNameWidget(template, slot, client, orderManager, worldRenderer); - LobbyUtils.SetupTeamWidget(template, slot, client); - LobbyUtils.SetupHandicapWidget(template, slot, client); - LobbyUtils.SetupSpawnWidget(template, slot, client); + LobbyUtils.SetupNameWidget(template, client, orderManager, worldRenderer); + LobbyUtils.SetupTeamWidget(template, client); + LobbyUtils.SetupHandicapWidget(template, client); + LobbyUtils.SetupSpawnWidget(template, client); } - LobbyUtils.SetupReadyWidget(template, slot, client); + LobbyUtils.SetupReadyWidget(template, client); } template.IsVisible = () => true; @@ -687,10 +687,10 @@ void UpdatePlayerList() if (template == null || template.Id != editableSpectatorTemplate.Id) template = editableSpectatorTemplate.Clone(); - LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager, worldRenderer); + LobbyUtils.SetupEditableNameWidget(template, c, orderManager, worldRenderer); if (client.IsAdmin) - LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager, map, MapIsPlayable); + LobbyUtils.SetupEditableReadyWidget(template, client, orderManager, map, MapIsPlayable); else LobbyUtils.HideReadyWidgets(template); } @@ -701,13 +701,13 @@ void UpdatePlayerList() template = nonEditableSpectatorTemplate.Clone(); if (isHost) - LobbyUtils.SetupPlayerActionWidget(template, null, client, orderManager, worldRenderer, + LobbyUtils.SetupPlayerActionWidget(template, client, orderManager, worldRenderer, lobby, () => panel = PanelType.Kick, () => panel = PanelType.Players); else - LobbyUtils.SetupNameWidget(template, null, client, orderManager, worldRenderer); + LobbyUtils.SetupNameWidget(template, client, orderManager, worldRenderer); if (client.IsAdmin) - LobbyUtils.SetupReadyWidget(template, null, client); + LobbyUtils.SetupReadyWidget(template, client); else LobbyUtils.HideReadyWidgets(template); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 6f8f8170aa0e..13eb5dbd4117 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -77,7 +77,7 @@ public SlotDropDownOption(string title, string order, Func selected) dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 180, options, setupItem); } - public static void ShowPlayerActionDropDown(DropDownButtonWidget dropdown, Session.Slot slot, + public static void ShowPlayerActionDropDown(DropDownButtonWidget dropdown, Session.Client c, OrderManager orderManager, Widget lobby, Action before, Action after) { Action okPressed = tempBan => { orderManager.IssueOrder(Order.Command($"kick {c.Index} {tempBan}")); after(); }; @@ -378,7 +378,7 @@ public static void SetupProfileWidget(Widget parent, Session.Client c, OrderMana } } - public static void SetupEditableNameWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) + public static void SetupEditableNameWidget(Widget parent, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) { var name = parent.Get("NAME"); name.IsVisible = () => true; @@ -420,7 +420,7 @@ public static void SetupEditableNameWidget(Widget parent, Session.Slot s, Sessio HideChildWidget(parent, "SLOT_OPTIONS"); } - public static void SetupNameWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) + public static void SetupNameWidget(Widget parent, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) { var name = parent.Get("NAME"); name.IsVisible = () => true; @@ -432,7 +432,7 @@ public static void SetupNameWidget(Widget parent, Session.Slot s, Session.Client } public static void SetupEditableSlotWidget(Widget parent, Session.Slot s, Session.Client c, - OrderManager orderManager, WorldRenderer worldRenderer, MapPreview map) + OrderManager orderManager, MapPreview map) { var slot = parent.Get("SLOT_OPTIONS"); slot.IsVisible = () => true; @@ -459,7 +459,7 @@ public static void SetupSlotWidget(Widget parent, Session.Slot s, Session.Client HideChildWidget(parent, "SLOT_OPTIONS"); } - public static void SetupPlayerActionWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, + public static void SetupPlayerActionWidget(Widget parent, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer, Widget lobby, Action before, Action after) { var slot = parent.Get("PLAYER_ACTION"); @@ -471,7 +471,7 @@ public static void SetupSlotWidget(Widget parent, Session.Slot s, Session.Client Game.Renderer.Fonts[slot.Font])); slot.GetText = () => truncated.Update(c != null ? c.Name : string.Empty); - slot.OnMouseDown = _ => ShowPlayerActionDropDown(slot, s, c, orderManager, lobby, before, after); + slot.OnMouseDown = _ => ShowPlayerActionDropDown(slot, c, orderManager, lobby, before, after); SetupProfileWidget(slot, c, orderManager, worldRenderer); @@ -525,10 +525,10 @@ public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Sessi color.IsDisabled = () => (s != null && s.LockColor) || orderManager.LocalClient.IsReady; color.OnMouseDown = _ => ShowColorDropDown(color, c, orderManager, worldRenderer, colorManager); - SetupColorWidget(color, s, c); + SetupColorWidget(color, c); } - public static void SetupColorWidget(Widget parent, Session.Slot s, Session.Client c) + public static void SetupColorWidget(Widget parent, Session.Client c) { var color = parent.Get("COLORBLOCK"); color.GetColor = () => c.Color; @@ -545,11 +545,10 @@ public static void SetupColorWidget(Widget parent, Session.Slot s, Session.Clien dropdown.GetTooltipText = () => tooltip.First; dropdown.GetTooltipDesc = () => tooltip.Second; - SetupFactionWidget(dropdown, s, c, factions); + SetupFactionWidget(dropdown, c, factions); } - public static void SetupFactionWidget(Widget parent, Session.Slot s, Session.Client c, - Dictionary factions) + public static void SetupFactionWidget(Widget parent, Session.Client c, Dictionary factions) { var factionName = parent.Get("FACTIONNAME"); factionName.GetText = () => factions[c.Faction].Name; @@ -569,7 +568,7 @@ public static void SetupEditableTeamWidget(Widget parent, Session.Slot s, Sessio HideChildWidget(parent, "TEAM"); } - public static void SetupTeamWidget(Widget parent, Session.Slot s, Session.Client c) + public static void SetupTeamWidget(Widget parent, Session.Client c) { var team = parent.Get("TEAM"); team.IsVisible = () => true; @@ -577,7 +576,7 @@ public static void SetupTeamWidget(Widget parent, Session.Slot s, Session.Client HideChildWidget(parent, "TEAM_DROPDOWN"); } - public static void SetupEditableHandicapWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map) + public static void SetupEditableHandicapWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager) { var dropdown = parent.Get("HANDICAP_DROPDOWN"); dropdown.IsVisible = () => true; @@ -590,7 +589,7 @@ public static void SetupEditableHandicapWidget(Widget parent, Session.Slot s, Se HideChildWidget(parent, "HANDICAP"); } - public static void SetupHandicapWidget(Widget parent, Session.Slot s, Session.Client c) + public static void SetupHandicapWidget(Widget parent, Session.Client c) { var team = parent.Get("HANDICAP"); team.IsVisible = () => true; @@ -618,7 +617,7 @@ public static void SetupEditableSpawnWidget(Widget parent, Session.Slot s, Sessi HideChildWidget(parent, "SPAWN"); } - public static void SetupSpawnWidget(Widget parent, Session.Slot s, Session.Client c) + public static void SetupSpawnWidget(Widget parent, Session.Client c) { var spawn = parent.Get("SPAWN"); spawn.IsVisible = () => true; @@ -626,7 +625,7 @@ public static void SetupSpawnWidget(Widget parent, Session.Slot s, Session.Clien HideChildWidget(parent, "SPAWN_DROPDOWN"); } - public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map, bool isEnabled) + public static void SetupEditableReadyWidget(Widget parent, Session.Client c, OrderManager orderManager, MapPreview map, bool isEnabled) { var status = parent.Get("STATUS_CHECKBOX"); status.IsChecked = () => orderManager.LocalClient.IsReady || c.Bot != null; @@ -637,7 +636,7 @@ public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Sessi status.OnClick = () => orderManager.IssueOrder(Order.Command($"state {state}")); } - public static void SetupReadyWidget(Widget parent, Session.Slot s, Session.Client c) + public static void SetupReadyWidget(Widget parent, Session.Client c) { parent.Get("STATUS_IMAGE").IsVisible = () => c.IsReady || c.Bot != null; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs index e21c5e21881e..b9fcba35e8a7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs @@ -25,7 +25,7 @@ public class MusicPlayerLogic : ChromeLogic MusicInfo currentSong = null; [ObjectCreator.UseCtor] - public MusicPlayerLogic(Widget widget, ModData modData, World world, Action onExit) + public MusicPlayerLogic(Widget widget, World world, Action onExit) { var panel = widget; diff --git a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs index 052203ef90c4..4c1f6b21d5d4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs @@ -310,7 +310,7 @@ public PlayerProfileBadgesLogic(Widget widget, PlayerProfile profile, Func("NAME"); var nameFont = Game.Renderer.Fonts[nameLabel.Font]; diff --git a/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs b/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs index 6c09fae717d5..fd458b4abb38 100644 --- a/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs @@ -25,7 +25,7 @@ public class MouseAttachmentWidget : Widget int2 location; [ObjectCreator.UseCtor] - public MouseAttachmentWidget(ModData modData, WorldRenderer worldRenderer) + public MouseAttachmentWidget(WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; graphicSettings = Game.Settings.Graphics; diff --git a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs index fd914dbb19e8..a13db6c1cf38 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs @@ -134,7 +134,7 @@ public override void Draw() continue; var rsi = actor.TraitInfo(); - var icon = new Animation(world, rsi.GetImage(actor, world.Map.Rules.Sequences, faction)); + var icon = new Animation(world, rsi.GetImage(actor, faction)); var bi = actor.TraitInfo(); icon.Play(bi.Icon); diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 449ce9c30790..4a2993552e3d 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -124,7 +124,7 @@ public ProductionQueue CurrentQueue IProductionIconOverlay[] pios; [CustomLintableHotkeyNames] - public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError, Action emitWarning) + public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError) { var prefix = ""; var prefixNode = widgetNode.Value.Nodes.FirstOrDefault(n => n.Key == "HotkeyPrefix"); @@ -457,7 +457,7 @@ public void RefreshIcons() var rect = new Rectangle(rb.X + x * (IconSize.X + IconMargin.X), rb.Y + y * (IconSize.Y + IconMargin.Y), IconSize.X, IconSize.Y); var rsi = item.TraitInfo(); - var icon = new Animation(World, rsi.GetImage(item, World.Map.Rules.Sequences, faction)); + var icon = new Animation(World, rsi.GetImage(item, faction)); var bi = item.TraitInfo(); icon.Play(bi.Icon); diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index b150a404697e..cea3a914db84 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -67,7 +67,7 @@ public class SupportPowersWidget : Widget float2 iconOffset, holdOffset, readyOffset, timeOffset; [CustomLintableHotkeyNames] - public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError, Action emitWarning) + public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError) { var prefix = ""; var prefixNode = widgetNode.Value.Nodes.FirstOrDefault(n => n.Key == "HotkeyPrefix"); diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index 4dc04c5473bf..07de706f56b7 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -102,7 +102,7 @@ public class ViewportControllerWidget : Widget WPos?[] bookmarkPositions; [CustomLintableHotkeyNames] - public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError, Action emitWarning) + public static IEnumerable LinterHotkeyNames(MiniYamlNode widgetNode, Action emitError) { var savePrefix = ""; var savePrefixNode = widgetNode.Value.Nodes.FirstOrDefault(n => n.Key == "BookmarkSaveKeyPrefix"); diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs index 2579c19184d8..41715d3df370 100644 --- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs @@ -185,7 +185,7 @@ void ApplyOrders(World world, MouseInput mi) var cell = worldRenderer.Viewport.ViewToWorld(mi.Location); var worldPixel = worldRenderer.Viewport.ViewToWorldPx(mi.Location); var orders = world.OrderGenerator.Order(world, cell, worldPixel, mi).ToArray(); - world.PlayVoiceForOrders(orders); + orders.PlayVoiceForOrders(); var flashed = false; foreach (var o in orders) diff --git a/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs b/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs index dd78b8075173..c0fab189077a 100644 --- a/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs +++ b/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs @@ -54,7 +54,7 @@ public WithDeliveryOverlay(Actor self, WithDeliveryOverlayInfo info) overlay.IsDecoration = true; anim = new AnimationWithOffset(overlay, - () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), + () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), () => IsTraitDisabled || !delivering); rs.Add(anim, info.Palette, info.IsPlayerPalette); diff --git a/OpenRA.Platforms.Default/DefaultPlatform.cs b/OpenRA.Platforms.Default/DefaultPlatform.cs index efbd6edbdbaa..9a6c74b087bc 100644 --- a/OpenRA.Platforms.Default/DefaultPlatform.cs +++ b/OpenRA.Platforms.Default/DefaultPlatform.cs @@ -30,7 +30,7 @@ public ISoundEngine CreateSound(string device) catch (InvalidOperationException e) { Log.Write("sound", "Failed to initialize OpenAL device. Error was {0}", e); - return new DummySoundEngine(device); + return new DummySoundEngine(); } } diff --git a/OpenRA.Platforms.Default/DummySoundEngine.cs b/OpenRA.Platforms.Default/DummySoundEngine.cs index 94206a3eca19..9b1cb3b5c5e5 100644 --- a/OpenRA.Platforms.Default/DummySoundEngine.cs +++ b/OpenRA.Platforms.Default/DummySoundEngine.cs @@ -27,7 +27,7 @@ public SoundDevice[] AvailableDevices() return defaultDevices; } - public DummySoundEngine(string deviceName) { } + public DummySoundEngine() { } public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate) { diff --git a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs index fb346a009322..2658f74e2013 100644 --- a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs +++ b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs @@ -363,7 +363,8 @@ public void Dispose() void Dispose(bool disposing) { - StopAllSounds(); + if (disposing) + StopAllSounds(); if (context != IntPtr.Zero) {