From 4fe2ed3df0a3df6650e3618fc08071da2f61617c Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 18 Mar 2023 12:19:22 +0000 Subject: [PATCH] Fix RCS1068 --- .editorconfig | 3 +++ OpenRA.Game/Support/VariableExpression.cs | 2 +- .../Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 543fe960b8..9e1052f1b7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -983,6 +983,9 @@ dotnet_diagnostic.RCS1059.severity = warning # Remove empty 'finally' clause. dotnet_diagnostic.RCS1066.severity = warning +# Simplify logical negation. +dotnet_diagnostic.RCS1068.severity = warning + # Remove empty namespace declaration. dotnet_diagnostic.RCS1072.severity = warning diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index 275f8d720a..08fed5dc98 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -676,7 +676,7 @@ namespace OpenRA.Support else if (t.Closes != Grouping.None) { Token temp; - while (!((temp = s.Pop()).Opens != Grouping.None)) + while ((temp = s.Pop()).Opens == Grouping.None) yield return temp; } else if (t.OperandSides == Sides.None) diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs index ddd9526656..be738f7d00 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs @@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var minelayer in minelayers) { var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false); - if (cells != null && !(cells.Count == 0)) + if (cells != null && cells.Count != 0) { AIUtils.BotDebug($"{player}: try find a location to lay mine."); EnqueueConflictPosition(cells[cells.Count / 2]); @@ -193,7 +193,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var minelayer in minelayers) { var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false); - if (cells != null && !(cells.Count == 0)) + if (cells != null && cells.Count != 0) { orderedActors.Add(minelayer.Actor);