From 498c6e3d8b1332c7d0c36852f66ecbc0a544a06a Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 18 Mar 2023 13:16:05 +0000 Subject: [PATCH] Fix RCS1205 --- .editorconfig | 3 +++ .../Pathfinder/HierarchicalPathFinder.cs | 4 ++-- OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs | 4 ++-- .../Widgets/Logic/Editor/SaveMapLogic.cs | 4 ++-- .../Widgets/Logic/Ingame/GameInfoStatsLogic.cs | 12 ++++++------ .../Widgets/Logic/Ingame/IngameMenuLogic.cs | 10 +++++----- .../Widgets/Logic/MissionBrowserLogic.cs | 8 ++++---- .../Widgets/Logic/Settings/SettingsLogic.cs | 6 +++--- 8 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.editorconfig b/.editorconfig index 4e7022ac73..e2bbdd824d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1097,6 +1097,9 @@ dotnet_diagnostic.RCS1199.severity = warning # Use EventArgs.Empty. dotnet_diagnostic.RCS1204.severity = warning +# Order named arguments according to the order of parameters. +dotnet_diagnostic.RCS1205.severity = warning + # Order type parameter constraints. dotnet_diagnostic.RCS1209.severity = warning diff --git a/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs b/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs index 7f5e70bb6d..7ac12bca5d 100644 --- a/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs +++ b/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs @@ -936,8 +936,8 @@ namespace OpenRA.Mods.Common.Pathfinder using (var fromDest = GetLocalPathSearch( self, new[] { target }, source, customCost, ignoreActor, check, laneBias, null, heuristicWeightPercentage, heuristic: Heuristic(forwardAbstractSearch, estimatedSearchSize, null, null), - recorder: pathFinderOverlay?.RecordLocalEdges(self), - inReverse: true)) + inReverse: true, + recorder: pathFinderOverlay?.RecordLocalEdges(self))) return PathSearch.FindBidiPath(fromDest, fromSrc); } } diff --git a/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs b/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs index b3eac40fc9..92e6a1b187 100644 --- a/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs +++ b/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs @@ -24,10 +24,10 @@ namespace OpenRA.Mods.Common.Widgets Dictionary titleArguments = null, Dictionary textArguments = null, Action onConfirm = null, - Action onCancel = null, - Action onOther = null, string confirmText = null, + Action onCancel = null, string cancelText = null, + Action onOther = null, string otherText = null) { var promptName = onOther != null ? "THREEBUTTON_PROMPT" : "TWOBUTTON_PROMPT"; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs index 0b5566bb63..768b3cb983 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs @@ -250,13 +250,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: OverwriteMapFailedTitle, text: OverwriteMapFailedPrompt, - confirmText: OverwriteMapFailedConfirm, onConfirm: () => { saveMap(combinedPath); if (actionManager != null) actionManager.SaveFailed = false; }, + confirmText: OverwriteMapFailedConfirm, onCancel: () => { if (actionManager != null) @@ -278,13 +278,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: OverwriteMapOutsideEditTitle, text: OverwriteMapOutsideEditPrompt, - confirmText: SaveMapMapOutsideConfirm, onConfirm: () => { saveMap(combinedPath); if (actionManager != null) actionManager.SaveFailed = false; }, + confirmText: SaveMapMapOutsideConfirm, onCancel: () => { if (actionManager != null) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 39694e2656..8131d86b87 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -158,8 +158,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { ConfirmationDialogs.ButtonPrompt(modData, title: VoteKickTitle, - titleArguments: Translation.Arguments("player", client.Name), text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt, + titleArguments: Translation.Arguments("player", client.Name), textArguments: Translation.Arguments("bots", botsCount), onConfirm: () => { @@ -174,8 +174,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: VoteKickTitle, - titleArguments: Translation.Arguments("player", client.Name), text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt, + titleArguments: Translation.Arguments("player", client.Name), textArguments: Translation.Arguments("bots", botsCount), onConfirm: () => { @@ -184,6 +184,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic closeMenu(); }, confirmText: VoteKickVoteFor, + onCancel: () => hideMenu(false), + cancelText: VoteKickVoteCancel, onOther: () => { Ui.CloseWindow(); @@ -191,16 +193,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic hideMenu(false); closeMenu(); }, - otherText: VoteKickVoteAgainst, - onCancel: () => hideMenu(false), - cancelText: VoteKickVoteCancel); + otherText: VoteKickVoteAgainst); } else { ConfirmationDialogs.ButtonPrompt(modData, title: KickTitle, - titleArguments: Translation.Arguments("player", client.Name), text: KickPrompt, + titleArguments: Translation.Arguments("player", client.Name), onConfirm: () => { orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}")); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs index 7f4886ff7d..62f585a849 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs @@ -322,8 +322,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic title: LeaveMissionTitle, text: LeaveMissionPrompt, onConfirm: () => { OnQuit(world); leaving = true; }, - onCancel: ShowMenu, confirmText: LeaveMissionAccept, + onCancel: ShowMenu, cancelText: LeaveMissionCancel); }; } @@ -358,8 +358,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic title: RestartMissionTitle, text: RestartMissionPrompt, onConfirm: OnRestart, - onCancel: ShowMenu, confirmText: RestartMissionAccept, + onCancel: ShowMenu, cancelText: RestartMissionCancel); }; } @@ -384,8 +384,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic title: SurrenderTitle, text: SurrenderPrompt, onConfirm: OnSurrender, - onCancel: ShowMenu, confirmText: SurrenderAccept, + onCancel: ShowMenu, cancelText: SurrenderCancel); }; } @@ -591,8 +591,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic title: ExitToMapEditorTitle, text: ExitToMapEditorPrompt, onConfirm: OnConfirm, - onCancel: ShowMenu, confirmText: ExitToMapEditorConfirm, + onCancel: ShowMenu, cancelText: ExitToMapEditorCancel); }; } @@ -617,8 +617,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: ExitMapEditorTitle, text: deletedOrUnavailable ? ExitMapEditorPromptDeleted : ExitMapEditorPromptUnsaved, - confirmText: deletedOrUnavailable ? ExitMapEditorAnywayConfirm : ExitMapEditorConfirm, onConfirm: () => { onSuccess(); leaving = true; }, + confirmText: deletedOrUnavailable ? ExitMapEditorAnywayConfirm : ExitMapEditorConfirm, onCancel: ShowMenu); } else diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index 546c8c56c0..66ad33cf52 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -438,8 +438,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: NoVideoTitle, text: NoVideoPrompt, - cancelText: NoVideoCancel, - onCancel: () => { }); + onCancel: () => { }, + cancelText: NoVideoCancel); } else { @@ -455,8 +455,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: CantPlayTitle, text: CantPlayPrompt, - cancelText: CantPlayCancel, - onCancel: () => { }); + onCancel: () => { }, + cancelText: CantPlayCancel); } else { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs index b3211ef8c8..635d3ca064 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs @@ -124,8 +124,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic title: RestartTitle, text: RestartPrompt, onConfirm: () => Game.SwitchToExternalMod(external, null, NoRestart), - onCancel: CloseAndExit, confirmText: RestartAccept, + onCancel: CloseAndExit, cancelText: RestartCancel); } else @@ -142,11 +142,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic ConfirmationDialogs.ButtonPrompt(modData, title: ResetTitle, - titleArguments: Translation.Arguments("panel", panels[activePanel]), text: ResetPrompt, + titleArguments: Translation.Arguments("panel", panels[activePanel]), onConfirm: Reset, - onCancel: () => { }, confirmText: ResetAccept, + onCancel: () => { }, cancelText: ResetCancel); }; }