From 8ced155ca34a1938d79c3aa9f06cdac251ec0380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Mon, 2 May 2022 13:28:12 +0200 Subject: [PATCH] Simplify 'always true' expressions Co-authored-by: atlimit8 --- OpenRA.Mods.Cnc/Activities/Teleport.cs | 2 +- OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Cnc/Activities/Teleport.cs b/OpenRA.Mods.Cnc/Activities/Teleport.cs index fdd6519137..3e14f22610 100644 --- a/OpenRA.Mods.Cnc/Activities/Teleport.cs +++ b/OpenRA.Mods.Cnc/Activities/Teleport.cs @@ -133,7 +133,7 @@ namespace OpenRA.Mods.Cnc.Activities foreach (var tile in self.World.Map.FindTilesInCircle(destination, max)) { if (teleporter.Owner.Shroud.IsExplored(tile) - && (restrictTo == null || (restrictTo != null && restrictTo.Contains(tile))) + && (restrictTo == null || restrictTo.Contains(tile)) && pos.CanEnterCell(tile)) return tile; } diff --git a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs index 6cc4ad228e..ed19047f13 100644 --- a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs +++ b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs @@ -90,9 +90,8 @@ namespace OpenRA.Mods.Cnc.FileFormats static uint LenBigNum(uint[] n, uint len) { - uint i; - i = len - 1; - while ((i >= 0) && (n[i] == 0)) i--; + var i = len - 1; + while (n[i] == 0) i--; return i + 1; }