From 99c289e063346e4abe516aefc36e1499c00e1391 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sun, 19 Feb 2023 12:35:15 +0000 Subject: [PATCH] Fix IDE0075 --- .editorconfig | 3 +++ OpenRA.Mods.Cnc/Effects/GpsDotEffect.cs | 2 +- .../Traits/Palettes/PaletteFromGimpOrJascFile.cs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index f23e642f26..b77f6c91c0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -201,6 +201,9 @@ dotnet_diagnostic.IDE0061.severity = warning # Simplify interpolation. dotnet_diagnostic.IDE0071.severity = warning +# Simplify conditional expression. +dotnet_diagnostic.IDE0075.severity = warning + # Naming rule violation. dotnet_diagnostic.IDE1006.severity = warning diff --git a/OpenRA.Mods.Cnc/Effects/GpsDotEffect.cs b/OpenRA.Mods.Cnc/Effects/GpsDotEffect.cs index 415d557b89..652c441d84 100644 --- a/OpenRA.Mods.Cnc/Effects/GpsDotEffect.cs +++ b/OpenRA.Mods.Cnc/Effects/GpsDotEffect.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.Effects if (frozenLayer != null) { var frozenActor = frozenLayer.FromID(a.ActorID); - FrozenActorWithRenderables = frozenActor != null ? frozenActor.HasRenderables : false; + FrozenActorWithRenderables = frozenActor != null && frozenActor.HasRenderables; } } } diff --git a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs index 6570814c99..4a23897dc2 100644 --- a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs +++ b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs @@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits // Check if color has a (valid) alpha value. // Note: We can't throw on "rgba.Length > 3 but parse failed", because in GIMP palettes the 'invalid' value is probably a color name string. - var noAlpha = rgba.Length > 3 ? !byte.TryParse(rgba[3], out a) : true; + var noAlpha = rgba.Length <= 3 || !byte.TryParse(rgba[3], out a); // Index should be completely transparent/background color if (i == TransparentIndex)