From 9ce0bcb0b7d39a9d748e5f22e59b548e1ba5b835 Mon Sep 17 00:00:00 2001 From: Peter Antal <172160+PeterAntal@users.noreply.github.com> Date: Sun, 25 Feb 2018 12:41:54 -0800 Subject: [PATCH] Mop up active Stylecop nits. Style consistency cleanup. --- OpenRA.Game/Map/MapGrid.cs | 8 ++++++-- OpenRA.Game/Server/Connection.cs | 2 +- OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs | 2 +- OpenRA.Mods.Common/FileFormats/AudReader.cs | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/Map/MapGrid.cs b/OpenRA.Game/Map/MapGrid.cs index db35f7cd30..a48cddc0ef 100644 --- a/OpenRA.Game/Map/MapGrid.cs +++ b/OpenRA.Game/Map/MapGrid.cs @@ -89,8 +89,12 @@ namespace OpenRA var defaultSubCellIndex = (byte)DefaultSubCell; if (defaultSubCellIndex == byte.MaxValue) DefaultSubCell = (SubCell)(SubCellOffsets.Length / 2); - else if (defaultSubCellIndex < (SubCellOffsets.Length > 1 ? 1 : 0) || defaultSubCellIndex >= SubCellOffsets.Length) - throw new InvalidDataException("Subcell default index must be a valid index into the offset triples and must be greater than 0 for mods with subcells"); + else + { + var minSubCellOffset = SubCellOffsets.Length > 1 ? 1 : 0; + if (defaultSubCellIndex < minSubCellOffset || defaultSubCellIndex >= SubCellOffsets.Length) + throw new InvalidDataException("Subcell default index must be a valid index into the offset triples and must be greater than 0 for mods with subcells"); + } var makeCorners = Type == MapGridType.RectangularIsometric ? (Func)IsometricCellCorners : RectangularCellCorners; diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index add566b671..ba60fecaa2 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -55,7 +55,7 @@ namespace OpenRA.Server // from `socket.Receive(rx)`. if (!Socket.Poll(0, SelectMode.SelectRead)) break; - if (0 < (len = Socket.Receive(rx))) + if ((len = Socket.Receive(rx)) > 0) Data.AddRange(rx.Take(len)); else { diff --git a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs index ad484f2e81..8faae3ea2f 100644 --- a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs +++ b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs @@ -385,7 +385,7 @@ namespace OpenRA.Mods.Cnc.FileFormats MulBignumWord(esi, globOne, tmp, 2 * len); if ((*edi & 0x8000) == 0) { - if (0 != SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len)) + if (SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len) != 0) (*edi)--; } } diff --git a/OpenRA.Mods.Common/FileFormats/AudReader.cs b/OpenRA.Mods.Common/FileFormats/AudReader.cs index 06cca2ee07..8c7d2ed650 100644 --- a/OpenRA.Mods.Common/FileFormats/AudReader.cs +++ b/OpenRA.Mods.Common/FileFormats/AudReader.cs @@ -116,8 +116,8 @@ namespace OpenRA.Mods.Common.FileFormats var flags = (SoundFlags)s.ReadByte(); var samples = outputSize; - if (0 != (flags & SoundFlags.Stereo)) samples /= 2; - if (0 != (flags & SoundFlags._16Bit)) samples /= 2; + if ((flags & SoundFlags.Stereo) != 0) samples /= 2; + if ((flags & SoundFlags._16Bit) != 0) samples /= 2; return (float)samples / sampleRate; }