diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 6286b7aa46..8329f29c15 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -564,7 +564,7 @@ namespace OpenRA fli.Field.SetValue(self, val); } - if (missing.Any()) + if (missing.Count > 0) throw new MissingFieldsException(missing.ToArray()); } diff --git a/OpenRA.Game/GameRules/ActorInfo.cs b/OpenRA.Game/GameRules/ActorInfo.cs index c856289732..684f88b391 100644 --- a/OpenRA.Game/GameRules/ActorInfo.cs +++ b/OpenRA.Game/GameRules/ActorInfo.cs @@ -114,7 +114,7 @@ namespace OpenRA OptionalDependencies = OptionalPrerequisitesOf(i).ToList() }).ToList(); - var resolved = source.Where(s => !s.Dependencies.Any() && !s.OptionalDependencies.Any()).ToList(); + var resolved = source.Where(s => s.Dependencies.Count == 0 && s.OptionalDependencies.Count == 0).ToList(); var unresolved = source.Except(resolved); var testResolve = new Func((a, b) => a == b || a.IsAssignableFrom(b)); diff --git a/OpenRA.Game/GameRules/Ruleset.cs b/OpenRA.Game/GameRules/Ruleset.cs index e814a06726..0169abacc0 100644 --- a/OpenRA.Game/GameRules/Ruleset.cs +++ b/OpenRA.Game/GameRules/Ruleset.cs @@ -235,7 +235,7 @@ namespace OpenRA static bool AnyCustomYaml(MiniYaml yaml) { - return yaml != null && (yaml.Value != null || yaml.Nodes.Any()); + return yaml != null && (yaml.Value != null || yaml.Nodes.Count > 0); } static bool AnyFlaggedTraits(ModData modData, List actors) diff --git a/OpenRA.Game/Graphics/ModelRenderer.cs b/OpenRA.Game/Graphics/ModelRenderer.cs index 99528a4e00..d557f6b786 100644 --- a/OpenRA.Game/Graphics/ModelRenderer.cs +++ b/OpenRA.Game/Graphics/ModelRenderer.cs @@ -223,7 +223,8 @@ namespace OpenRA.Graphics ShadowAmbient, ShadowDiffuse, shadowPalette.TextureMidIndex, normals.TextureMidIndex); } } - })); + } + )); var screenLightVector = Util.MatrixVectorMultiply(invShadowTransform, ZVector); screenLightVector = Util.MatrixVectorMultiply(cameraTransform, screenLightVector); diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 51f3f4304e..5ee3040b27 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -130,13 +130,13 @@ namespace OpenRA if (type == Type.NodeList) { var listValue = (List)value; - if (required || listValue.Any()) + if (required || listValue.Count > 0) nodes.Add(new MiniYamlNode(key, null, listValue)); } else if (type == Type.MiniYaml) { var yamlValue = (MiniYaml)value; - if (required || (yamlValue != null && (yamlValue.Value != null || yamlValue.Nodes.Any()))) + if (required || (yamlValue != null && (yamlValue.Value != null || yamlValue.Nodes.Count > 0))) nodes.Add(new MiniYamlNode(key, yamlValue)); } else @@ -521,7 +521,7 @@ namespace OpenRA while (true) { temp = new MPos(temp.U, temp.V - 1); - if (!inverseCellProjection.Contains(temp) || inverseCellProjection[temp].Any()) + if (!inverseCellProjection.Contains(temp) || inverseCellProjection[temp].Count > 0) break; projectedHeight[temp] = height; @@ -534,7 +534,7 @@ namespace OpenRA while (inverseCellProjection.Contains((MPos)puv)) { var inverse = inverseCellProjection[(MPos)puv]; - if (inverse.Any()) + if (inverse.Count > 0) { // The original games treat the top of cliffs the same way as the bottom // This information isn't stored in the map data, so query the offset from the tileset @@ -725,10 +725,10 @@ namespace OpenRA { var allTop = Unproject(new PPos(x, Bounds.Top)); var allBottom = Unproject(new PPos(x, Bounds.Bottom)); - if (allTop.Any()) + if (allTop.Count > 0) top = Math.Min(top, allTop.MinBy(uv => uv.V).V); - if (allBottom.Any()) + if (allBottom.Count > 0) bottom = Math.Max(bottom, allBottom.MaxBy(uv => uv.V).V); } } @@ -1135,7 +1135,7 @@ namespace OpenRA // Project this guessed cell and take the first available cell // If it is projected outside the layer, then make another guess. var allProjected = ProjectedCellsCovering(uv); - var projected = allProjected.Any() ? allProjected.First() + var projected = allProjected.Length > 0 ? allProjected.First() : new PPos(uv.U, uv.V.Clamp(Bounds.Top, Bounds.Bottom)); // Clamp the projected cell to the map area @@ -1145,7 +1145,7 @@ namespace OpenRA // This may fail if the projected cell covered a cliff or another feature // where there is a large change in terrain height. var unProjected = Unproject(projected); - if (!unProjected.Any()) + if (unProjected.Count == 0) { // Adjust V until we find a cell that works for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++) @@ -1156,12 +1156,12 @@ namespace OpenRA continue; unProjected = Unproject(test); - if (unProjected.Any()) + if (unProjected.Count > 0) break; } // This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode. - if (!unProjected.Any()) + if (unProjected.Count == 0) { Log.Write("debug", "Failed to clamp map cell {0} to map bounds", uv); return uv; @@ -1187,7 +1187,7 @@ namespace OpenRA cells = Unproject(new PPos(u, v)); } - while (!cells.Any()); + while (cells.Count == 0); return cells.Random(rand).ToCPos(Grid.Type); } @@ -1202,7 +1202,7 @@ namespace OpenRA var allProjected = ProjectedCellsCovering(uv); PPos edge; - if (allProjected.Any()) + if (allProjected.Length > 0) { var puv = allProjected.First(); var horizontalBound = ((puv.U - Bounds.Left) < Bounds.Width / 2) ? Bounds.Left : Bounds.Right; @@ -1217,7 +1217,7 @@ namespace OpenRA edge = new PPos(Bounds.Left, Bounds.Top); var unProjected = Unproject(edge); - if (!unProjected.Any()) + if (unProjected.Count == 0) { // Adjust V until we find a cell that works for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++) @@ -1228,12 +1228,12 @@ namespace OpenRA continue; unProjected = Unproject(test); - if (unProjected.Any()) + if (unProjected.Count > 0) break; } // This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode. - if (!unProjected.Any()) + if (unProjected.Count == 0) { Log.Write("debug", "Failed to find closest edge for map cell {0}", uv); return uv; @@ -1256,22 +1256,22 @@ namespace OpenRA for (var u = Bounds.Left; u < Bounds.Right; u++) { unProjected = Unproject(new PPos(u, Bounds.Top)); - if (unProjected.Any()) + if (unProjected.Count > 0) edgeCells.Add(unProjected.MinBy(x => x.V).ToCPos(Grid.Type)); unProjected = Unproject(new PPos(u, bottom)); - if (unProjected.Any()) + if (unProjected.Count > 0) edgeCells.Add(unProjected.MaxBy(x => x.V).ToCPos(Grid.Type)); } for (var v = Bounds.Top; v < Bounds.Bottom; v++) { unProjected = Unproject(new PPos(Bounds.Left, v)); - if (unProjected.Any()) + if (unProjected.Count > 0) edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type)); unProjected = Unproject(new PPos(Bounds.Right - 1, v)); - if (unProjected.Any()) + if (unProjected.Count > 0) edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type)); } diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index cadc31630f..5f07081c9d 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -133,7 +133,7 @@ namespace OpenRA } var sources = files.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s).Where(IsLoadableRuleDefinition).ToList()); - if (RuleDefinitions.Nodes.Any()) + if (RuleDefinitions.Nodes.Count > 0) sources = sources.Append(RuleDefinitions.Nodes.Where(IsLoadableRuleDefinition).ToList()); var yamlNodes = MiniYaml.Merge(sources); diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index 4d9169b72b..67df1e5c26 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -472,7 +472,7 @@ namespace OpenRA } var yaml = files.Select(s => FromStream(fileSystem.Open(s), s)); - if (mapRules != null && mapRules.Nodes.Any()) + if (mapRules != null && mapRules.Nodes.Count > 0) yaml = yaml.Append(mapRules.Nodes); return Merge(yaml); diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs index cf34d0736f..2cfe204610 100644 --- a/OpenRA.Game/Network/GameServer.cs +++ b/OpenRA.Game/Network/GameServer.cs @@ -227,7 +227,7 @@ namespace OpenRA.Network ModWebsite = manifest.Metadata.Website; ModIcon32 = manifest.Metadata.WebIcon32; Protected = !string.IsNullOrEmpty(server.Settings.Password); - Authentication = server.Settings.RequireAuthentication || server.Settings.ProfileIDWhitelist.Any(); + Authentication = server.Settings.RequireAuthentication || server.Settings.ProfileIDWhitelist.Length > 0; Clients = server.LobbyInfo.Clients.Select(c => new GameClient(c)).ToArray(); DisabledSpawnPoints = server.LobbyInfo.DisabledSpawnPoints?.ToArray() ?? Array.Empty(); } diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index 4cdaf1a04a..cbb7dcc7ff 100644 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -193,7 +193,7 @@ namespace OpenRA.Network var properties = type.GetProperties(Flags).Where(pi => pi.HasAttribute()); foreach (var prop in properties) - if (!prop.CanRead || prop.GetIndexParameters().Any()) + if (!prop.CanRead || prop.GetIndexParameters().Length > 0) throw new InvalidOperationException( "Properties using the Sync attribute must be readable and must not use index parameters.\n" + "Invalid Property: " + prop.DeclaringType.FullName + "." + prop.Name); diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 42a41816ad..a81e61dd00 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -113,7 +113,7 @@ namespace OpenRA ?? selectableFactions.Random(playerRandom); // Don't loop infinite - for (var i = 0; i <= 10 && selected.RandomFactionMembers.Any(); i++) + for (var i = 0; i <= 10 && selected.RandomFactionMembers.Count > 0; i++) { var faction = selected.RandomFactionMembers.Random(playerRandom); selected = selectableFactions.FirstOrDefault(f => f.InternalName == faction); diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index ecba784243..29d7743d4b 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -377,7 +377,7 @@ namespace OpenRA public void EnableScissor(Rectangle rect) { // Must remain inside the current scissor rect - if (scissorState.Any()) + if (scissorState.Count > 0) rect = Rectangle.Intersect(rect, scissorState.Peek()); Flush(); @@ -405,7 +405,7 @@ namespace OpenRA if (renderType == RenderType.World) { // Restore previous scissor rect - if (scissorState.Any()) + if (scissorState.Count > 0) { var rect = scissorState.Peek(); var r = Rectangle.FromLTRB( @@ -421,7 +421,7 @@ namespace OpenRA else { // Restore previous scissor rect - if (scissorState.Any()) + if (scissorState.Count > 0) { var rect = scissorState.Peek(); Context.EnableScissor(rect.X, rect.Y, rect.Width, rect.Height); diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index c7cf0381a9..54085d899b 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -635,9 +635,9 @@ namespace OpenRA.Server events.Add(new CallbackEvent(() => { - var notAuthenticated = Type == ServerType.Dedicated && profile == null && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Any()); + var notAuthenticated = Type == ServerType.Dedicated && profile == null && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Length > 0); var blacklisted = Type == ServerType.Dedicated && profile != null && Settings.ProfileIDBlacklist.Contains(profile.ProfileID); - var notWhitelisted = Type == ServerType.Dedicated && Settings.ProfileIDWhitelist.Any() && + var notWhitelisted = Type == ServerType.Dedicated && Settings.ProfileIDWhitelist.Length > 0 && (profile == null || !Settings.ProfileIDWhitelist.Contains(profile.ProfileID)); if (notAuthenticated) @@ -663,7 +663,7 @@ namespace OpenRA.Server } else { - if (Type == ServerType.Dedicated && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Any())) + if (Type == ServerType.Dedicated && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Length > 0)) { Log.Write("server", $"Rejected connection from {newConn.EndPoint}; Not authenticated."); SendOrderTo(newConn, "ServerError", RequiresForumAccount); diff --git a/OpenRA.Game/Support/AssemblyLoader.cs b/OpenRA.Game/Support/AssemblyLoader.cs index e34a884b6d..ae085dd15d 100644 --- a/OpenRA.Game/Support/AssemblyLoader.cs +++ b/OpenRA.Game/Support/AssemblyLoader.cs @@ -306,7 +306,7 @@ namespace OpenRA.Support public static AssemblyLoadContextBuilder AddDependencyContext(this AssemblyLoadContextBuilder builder, DependencyContext dependencyContext) { - var ridGraph = dependencyContext.RuntimeGraph.Any() + var ridGraph = dependencyContext.RuntimeGraph.Count > 0 ? dependencyContext.RuntimeGraph : DependencyContext.Default.RuntimeGraph; diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index 6ced0c96fb..cbbf7457a3 100644 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -217,7 +217,7 @@ namespace OpenRA.Traits return Renderables; } - public bool HasRenderables => !Shrouded && Renderables.Any(); + public bool HasRenderables => !Shrouded && Renderables.Length > 0; public override string ToString() { diff --git a/OpenRA.Game/Traits/World/ScreenShaker.cs b/OpenRA.Game/Traits/World/ScreenShaker.cs index 7a3df58794..fadc5308d5 100644 --- a/OpenRA.Game/Traits/World/ScreenShaker.cs +++ b/OpenRA.Game/Traits/World/ScreenShaker.cs @@ -41,7 +41,7 @@ namespace OpenRA.Traits void ITick.Tick(Actor self) { - if (shakeEffects.Any()) + if (shakeEffects.Count > 0) { worldRenderer.Viewport.Scroll(GetScrollOffset(), true); shakeEffects.RemoveAll(t => t.ExpiryTime == ticks); diff --git a/OpenRA.Game/Translation.cs b/OpenRA.Game/Translation.cs index cf0aff70cb..0ab532778b 100644 --- a/OpenRA.Game/Translation.cs +++ b/OpenRA.Game/Translation.cs @@ -38,7 +38,7 @@ namespace OpenRA public Translation(string language, string[] translations, IReadOnlyFileSystem fileSystem) { - if (translations == null || !translations.Any()) + if (translations == null || translations.Length == 0) return; messageContexts = GetMessageContext(language, translations, fileSystem).ToList(); diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 35990fe385..125cc8b20a 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -270,7 +270,7 @@ namespace OpenRA.Widgets public void PostInit(WidgetArgs args) { - if (!Logic.Any()) + if (Logic.Length == 0) return; args["widget"] = this; diff --git a/OpenRA.Mods.Cnc/Projectiles/DropPodImpact.cs b/OpenRA.Mods.Cnc/Projectiles/DropPodImpact.cs index d8e1eaab3e..12a49283f7 100644 --- a/OpenRA.Mods.Cnc/Projectiles/DropPodImpact.cs +++ b/OpenRA.Mods.Cnc/Projectiles/DropPodImpact.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Traits; @@ -42,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Effects entryAnimation = new Animation(world, entryEffect); entryAnimation.PlayThen(entrySequence, () => Finish(world)); - if (weapon.Report != null && weapon.Report.Any()) + if (weapon.Report != null && weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos); } diff --git a/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs b/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs index 592e2307c9..e1cd98ccc4 100644 --- a/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Traits; @@ -38,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Effects anim = new Animation(world, effect); anim.PlayThen(sequence, () => Finish(world)); - if (weapon.Report != null && weapon.Report.Any()) + if (weapon.Report != null && weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos); } diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index 730e0c1133..48fa0e00cd 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -289,7 +289,7 @@ namespace OpenRA.Mods.Cnc.Traits { minelayers.Clear(); minelayers.AddRange(selected.Where(s => !s.IsDead && s.Info.HasTraitInfo())); - if (!minelayers.Any()) + if (minelayers.Count == 0) world.CancelInputMode(); } diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs index 91a3aa36e1..66c8734710 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render // HACK: We don't have an efficient way to know when the preview // bounds change, so assume that we need to update the screen map // (only) when the facing changes - if (facing.Facing != cachedFacing && previews.Any()) + if (facing.Facing != cachedFacing && previews.Count > 0) { self.World.ScreenMap.AddOrUpdate(self); cachedFacing = facing.Facing; diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs index b24e49a88c..7c42bdcd1b 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs @@ -634,7 +634,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands lightingNodes.Add(new MiniYamlNode(node.Value, FieldSaver.FormatValue(val))); } - if (lightingNodes.Any()) + if (lightingNodes.Count > 0) { map.RuleDefinitions.Nodes.Add(new MiniYamlNode("^BaseWorld", new MiniYaml("", new List() { @@ -674,7 +674,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands } } - if (lightingNodes.Any()) + if (lightingNodes.Count > 0) { map.RuleDefinitions.Nodes.Add(new MiniYamlNode(lamp, new MiniYaml("", new List() { diff --git a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs index e4ebe98b2a..f47329b949 100644 --- a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs +++ b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs @@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Activities searchCells.Add(cell); } - if (!searchCells.Any()) + if (searchCells.Count == 0) return PathFinder.NoPath; var path = Mobile.PathFinder.FindUnitPathToTargetCell(self, searchCells, loc, check); diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index fb4dca04db..4c93d9657c 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities unitCost = valued != null ? valued.Cost : 0; var cannotRepairAtHost = health == null || health.DamageState == DamageState.Undamaged - || !allRepairsUnits.Any() + || allRepairsUnits.Length == 0 || ((repairable == null || !repairable.Info.RepairActors.Contains(host.Info.Name)) && (repairableNear == null || !repairableNear.Info.RepairActors.Contains(host.Info.Name))); diff --git a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs index 1c0cbceb83..d15cd280d2 100644 --- a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs +++ b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Lint } // Logic classes can declare the data key names that specify hotkeys - if (node.Key == "Logic" && node.Value.Nodes.Any()) + if (node.Key == "Logic" && node.Value.Nodes.Count > 0) { var typeNames = FieldLoader.GetValue(node.Key, node.Value.Value); var checkArgKeys = new List(); diff --git a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs index 5613c47712..63c0ab8cbb 100644 --- a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs +++ b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Lint var ios = actorInfo.Value.TraitInfoOrDefault(); if (ios == null) emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits!"); - else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any()) + else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0) emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells!"); } } diff --git a/OpenRA.Mods.Common/Lint/CheckMapMetadata.cs b/OpenRA.Mods.Common/Lint/CheckMapMetadata.cs index 9cfd157bab..de0ce9526e 100644 --- a/OpenRA.Mods.Common/Lint/CheckMapMetadata.cs +++ b/OpenRA.Mods.Common/Lint/CheckMapMetadata.cs @@ -10,7 +10,6 @@ #endregion using System; -using System.Linq; using OpenRA.Server; namespace OpenRA.Mods.Common.Lint @@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Lint if (title == null) emitError("Map does not define a valid title."); - if (!categories.Any()) + if (categories.Length == 0) emitError("Map does not define any categories."); } } diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index f77467a190..773689a6dd 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint if (player.OwnsWorld) { worldOwnerFound = true; - if (player.Enemies.Any() || player.Allies.Any()) + if (player.Enemies.Length > 0 || player.Allies.Length > 0) emitWarning($"The player {player.Name} owning the world should not have any allies or enemies."); if (player.Playable) diff --git a/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs b/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs index fb544e9b83..226e0bce38 100644 --- a/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs +++ b/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs @@ -10,7 +10,6 @@ #endregion using System; -using System.Linq; using OpenRA.Mods.Common.Traits; using OpenRA.Server; using OpenRA.Traits; @@ -41,7 +40,7 @@ namespace OpenRA.Mods.Common.Lint if (ios == null) emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!"); - else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any()) + else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0) emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but does not have any footprint cells!"); } } diff --git a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs index a63edaea92..2aed68efc3 100644 --- a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs +++ b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.FileSystem; using OpenRA.Server; @@ -53,7 +52,7 @@ namespace OpenRA.Mods.Common.Lint // Removals can never define children or values if (t.Key.StartsWith("-", StringComparison.Ordinal)) { - if (t.Value.Nodes.Any()) + if (t.Value.Nodes.Count > 0) emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals."); if (!string.IsNullOrEmpty(t.Value.Value)) @@ -65,7 +64,7 @@ namespace OpenRA.Mods.Common.Lint var traitName = NormalizeName(t.Key); // Inherits can never define children - if (traitName == "Inherits" && t.Value.Nodes.Any()) + if (traitName == "Inherits" && t.Value.Nodes.Count > 0) { emitError($"{t.Location} defines child nodes, which are not valid for Inherits."); continue; @@ -91,7 +90,7 @@ namespace OpenRA.Mods.Common.Lint foreach (var f in mapFiles) CheckActors(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, modData); - if (ruleDefinitions.Nodes.Any()) + if (ruleDefinitions.Nodes.Count > 0) CheckActors(ruleDefinitions.Nodes, emitError, modData); } } diff --git a/OpenRA.Mods.Common/Lint/CheckUnknownWeaponFields.cs b/OpenRA.Mods.Common/Lint/CheckUnknownWeaponFields.cs index a39d258d5c..9014c918f4 100644 --- a/OpenRA.Mods.Common/Lint/CheckUnknownWeaponFields.cs +++ b/OpenRA.Mods.Common/Lint/CheckUnknownWeaponFields.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.FileSystem; using OpenRA.GameRules; using OpenRA.Server; @@ -55,7 +54,7 @@ namespace OpenRA.Mods.Common.Lint // Removals can never define children or values if (field.Key.StartsWith("-", StringComparison.Ordinal)) { - if (field.Value.Nodes.Any()) + if (field.Value.Nodes.Count > 0) emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals."); if (!string.IsNullOrEmpty(field.Value.Value)) @@ -108,7 +107,7 @@ namespace OpenRA.Mods.Common.Lint foreach (var f in mapFiles) CheckWeapons(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, emitWarning, modData); - if (weaponDefinitions.Nodes.Any()) + if (weaponDefinitions.Nodes.Count > 0) CheckWeapons(weaponDefinitions.Nodes, emitError, emitWarning, modData); } } diff --git a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs index 1bc6b66506..acbca3db23 100644 --- a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs +++ b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs @@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Effects if (!isLaunched) { - if (weapon.Report != null && weapon.Report.Any()) + if (weapon.Report != null && weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, weapon.Report, world, pos); if (anim != null) diff --git a/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs index aea2bfdb34..d892408dcc 100644 --- a/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Scripting try { group.Remove(m); - if (!group.Any()) + if (group.Count == 0) using (f) f.Call(); } @@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Scripting if (!group.Remove(m)) return; - if (!group.Any()) + if (group.Count == 0) { // Functions can only be .Call()ed once, so operate on a copy so we can reuse it later var temp = (LuaFunction)f.CopyReference(); @@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Scripting if (!group.Remove(m)) return; - if (!group.Any()) + if (group.Count == 0) using (f) f.Call().Dispose(); } diff --git a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs index dbf7fc773a..357f73ff55 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs @@ -134,10 +134,10 @@ namespace OpenRA.Mods.Common.Terrain if (terrainInfo.IgnoreTileSpriteOffsets) allSprites = allSprites.Select(s => new Sprite(s.Sheet, s.Bounds, s.ZRamp, new float3(float2.Zero, s.Offset.Z), s.Channel, s.BlendMode)); - if (onMissingImage != null && !variants.Any()) + if (onMissingImage != null && variants.Count == 0) continue; - templates.Add(t.Value.Id, new TheaterTemplate(allSprites.ToArray(), variants.First().Count(), templateInfo.Images.Length)); + templates.Add(t.Value.Id, new TheaterTemplate(allSprites.ToArray(), variants.First().Length, templateInfo.Images.Length)); } // 1x1px transparent tile diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index de71eafe40..0f5864952c 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -1012,13 +1012,13 @@ namespace OpenRA.Mods.Common.Traits Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued) { - if (IsTraitDisabled || rearmable == null || !rearmable.Info.RearmActors.Any()) + if (IsTraitDisabled || rearmable == null || rearmable.Info.RearmActors.Count == 0) return null; return new Order("ReturnToBase", self, queued); } - bool IIssueDeployOrder.CanIssueDeployOrder(Actor self, bool queued) { return rearmable != null && rearmable.Info.RearmActors.Any(); } + bool IIssueDeployOrder.CanIssueDeployOrder(Actor self, bool queued) { return rearmable != null && rearmable.Info.RearmActors.Count > 0; } public string VoicePhraseForOrder(Actor self, Order order) { @@ -1043,7 +1043,7 @@ namespace OpenRA.Mods.Common.Traits case "Scatter": return Info.Voice; case "ReturnToBase": - return rearmable != null && rearmable.Info.RearmActors.Any() ? Info.Voice : null; + return rearmable != null && rearmable.Info.RearmActors.Count > 0 ? Info.Voice : null; default: return null; } } @@ -1123,7 +1123,7 @@ namespace OpenRA.Mods.Common.Traits else if (orderString == "ReturnToBase") { // Do nothing if not rearmable and don't restart activity every time deploy hotkey is triggered - if (rearmable == null || !rearmable.Info.RearmActors.Any() || self.CurrentActivity is ReturnToBase || GetActorBelow() != null) + if (rearmable == null || rearmable.Info.RearmActors.Count == 0 || self.CurrentActivity is ReturnToBase || GetActorBelow() != null) return; if (!order.Queued) diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index cb263e9752..dd52426286 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -330,10 +330,10 @@ namespace OpenRA.Mods.Common.Traits if (projectile != null) self.World.Add(projectile); - if (args.Weapon.Report != null && args.Weapon.Report.Any()) + if (args.Weapon.Report != null && args.Weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition); - if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Any()) + if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Length > 0) Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition); foreach (var na in notifyAttacks) @@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Traits FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers); Burst = Weapon.Burst; - if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Any()) + if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Length > 0) ScheduleDelayedAction(Weapon.AfterFireSoundDelay, Burst, (burst) => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition)); foreach (var nbc in notifyBurstComplete) diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index d202c59d2b..1a76783553 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits .Where(Exts.IsTraitEnabled).Where(t => t.ValidRelationships.HasRelationship(a.Owner.RelationshipWith(owner))) .ToList(); - if (!blockers.Any()) + if (blockers.Count == 0) continue; var hitPos = WorldExtensions.MinimumPointLineProjection(start, end, a.CenterPosition); diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index 53006a2ef9..44aa894b90 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Traits // Require at least one refinery, unless we can't build it. public bool HasAdequateRefineryCount => - !Info.RefineryTypes.Any() || + Info.RefineryTypes.Count == 0 || AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount || AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 || AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 4e4cc7b03f..b6955d1eb6 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits this.category = category; failRetryTicks = baseBuilder.Info.StructureProductionResumeDelay; minimumExcessPower = baseBuilder.Info.MinimumExcessPower; - if (!baseBuilder.Info.NavalProductionTypes.Any()) + if (baseBuilder.Info.NavalProductionTypes.Count == 0) waterState = WaterCheck.DontCheck; } @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits return; playerBuildings = world.ActorsHavingTrait().Where(a => a.Owner == player).ToArray(); - var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Count() / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue)); + var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue)); minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower); var active = false; diff --git a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs index f4969f4f8b..2c2f603e00 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits void QueueCaptureOrders(IBot bot) { - if (!Info.CapturingActorTypes.Any() || player.WinState != WinState.Undefined) + if (Info.CapturingActorTypes.Count == 0 || player.WinState != WinState.Undefined) return; activeCapturers.RemoveAll(unitCannotBeOrderedOrIsIdle); @@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits .OrderByDescending(target => target.GetSellValue()) .Take(maximumCaptureTargetOptions); - if (Info.CapturableActorTypes.Any()) + if (Info.CapturableActorTypes.Count > 0) capturableTargetOptions = capturableTargetOptions.Where(target => Info.CapturableActorTypes.Contains(target.Info.Name.ToLowerInvariant())); if (!capturableTargetOptions.Any()) diff --git a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs index f5bd8bc9db..4108efe83e 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs @@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits // Less harvesters than refineries - build a new harvester var unitBuilder = requestUnitProduction.FirstOrDefault(Exts.IsTraitEnabled); - if (unitBuilder != null && Info.HarvesterTypes.Any()) + if (unitBuilder != null && Info.HarvesterTypes.Count > 0) { var harvInfo = AIUtils.GetInfoByCommonName(Info.HarvesterTypes, player); var harvCountTooLow = AIUtils.CountActorByCommonName(Info.HarvesterTypes, player) < AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player); diff --git a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs index 69ae8ffbbb..5d522b0201 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs @@ -317,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits .Where(unit => unit.IsIdle && unit.Info.HasTraitInfo() && !Info.AirUnitsTypes.Contains(unit.Info.Name) && !Info.NavalUnitsTypes.Contains(unit.Info.Name) && !Info.ExcludeFromSquadsTypes.Contains(unit.Info.Name)).ToList(); - if (!allEnemyBaseBuilder.Any() || ownUnits.Count < Info.SquadSize) + if (allEnemyBaseBuilder.Count == 0 || ownUnits.Count < Info.SquadSize) return; foreach (var b in allEnemyBaseBuilder) @@ -328,7 +328,7 @@ namespace OpenRA.Mods.Common.Traits if (AttackOrFleeFuzzy.Rush.CanAttack(ownUnits, enemies)) { - var target = enemies.Any() ? enemies.Random(World.LocalRandom) : b; + var target = enemies.Count > 0 ? enemies.Random(World.LocalRandom) : b; var rush = GetSquadOfType(SquadType.Rush); if (rush == null) rush = RegisterNewSquad(bot, SquadType.Rush, target); diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs index 2e0924c0c4..f0972d2e84 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads FuzzyStateMachine.Update(this); } - public bool IsValid => Units.Any(); + public bool IsValid => Units.Count > 0; public Actor TargetActor { diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs index 784f920172..3f0cb2ef76 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads var unitsAroundPos = owner.World.FindActorsInCircle(loc, WDist.FromCells(dangerRadius)) .Where(owner.SquadManager.IsPreferredEnemyUnit).ToList(); - if (!unitsAroundPos.Any()) + if (unitsAroundPos.Count == 0) return true; if (CountAntiAirUnits(unitsAroundPos) * MissileUnitMultiplier < owner.Units.Count) diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs index 5014e2eaac..4cedbe428a 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs @@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits while (true) { var step = NextNeighbourStep(seed, processed).ToList(); - if (!step.Any()) + if (step.Count == 0) break; foreach (var s in step) @@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Traits { get { - if (!segments.Any()) + if (segments.Count == 0) return DamageState.Undamaged; return segments.Values.Max(s => s.DamageState); diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs index f01de140f0..3d91e2c13e 100644 --- a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits float ISelectionBar.GetValue() { - if (IsTraitDisabled || !progress.Any()) + if (IsTraitDisabled || progress.Count == 0) return 0f; return progress.Values.Max(p => (float)p.Current / p.Total); diff --git a/OpenRA.Mods.Common/Traits/CaptureManager.cs b/OpenRA.Mods.Common/Traits/CaptureManager.cs index 7fae1e3b4e..108406f72b 100644 --- a/OpenRA.Mods.Common/Traits/CaptureManager.cs +++ b/OpenRA.Mods.Common/Traits/CaptureManager.cs @@ -221,7 +221,7 @@ namespace OpenRA.Mods.Common.Traits if (enterMobile != null && enterMobile.IsMovingBetweenCells) return false; - if (progressWatchers.Any() || targetManager.progressWatchers.Any()) + if (progressWatchers.Length > 0 || targetManager.progressWatchers.Length > 0) { currentTargetTotal = captures.Info.CaptureDelay; if (move != null && captures.Info.ConsumedByCapture) diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 7edf58dbbc..4225766d18 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Traits { aircraft = self.TraitOrDefault(); - if (cargo.Any()) + if (cargo.Count > 0) { foreach (var c in cargo) if (Info.PassengerConditions.TryGetValue(c.Info.Name, out var passengerCondition)) @@ -350,10 +350,10 @@ namespace OpenRA.Mods.Common.Traits var p = passenger.Trait(); p.Transport = null; - if (passengerTokens.TryGetValue(passenger.Info.Name, out var passengerToken) && passengerToken.Any()) + if (passengerTokens.TryGetValue(passenger.Info.Name, out var passengerToken) && passengerToken.Count > 0) self.RevokeCondition(passengerToken.Pop()); - if (loadedTokens.Any()) + if (loadedTokens.Count > 0) self.RevokeCondition(loadedTokens.Pop()); return passenger; diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index 114d61dedf..140ad5c610 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -261,7 +261,7 @@ namespace OpenRA.Mods.Common.Traits if (!IsValidTerrain(self.Location)) return; - if (Info.DeploySounds != null && Info.DeploySounds.Any()) + if (Info.DeploySounds != null && Info.DeploySounds.Length > 0) Game.Sound.Play(SoundType.World, Info.DeploySounds, self.World, self.CenterPosition); // Revoke condition that is applied while undeployed. @@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits // If there is no animation to play just grant the condition that is used while deployed. // Alternatively, play the deploy animation and then grant the condition. - if (!notify.Any()) + if (notify.Length == 0) OnDeployCompleted(); else foreach (var n in notify) @@ -285,7 +285,7 @@ namespace OpenRA.Mods.Common.Traits if (!init && deployState != DeployState.Deployed) return; - if (Info.UndeploySounds != null && Info.UndeploySounds.Any()) + if (Info.UndeploySounds != null && Info.UndeploySounds.Length > 0) Game.Sound.Play(SoundType.World, Info.UndeploySounds, self.World, self.CenterPosition); if (!init) @@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Traits // If there is no animation to play just grant the condition that is used while undeployed. // Alternatively, play the undeploy animation and then grant the condition. - if (!notify.Any()) + if (notify.Length == 0) OnUndeployCompleted(); else foreach (var n in notify) diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs index 8e8f3fc7d9..d399137045 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnPrerequisite.cs @@ -10,7 +10,6 @@ #endregion using System; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -50,13 +49,13 @@ namespace OpenRA.Mods.Common.Traits void INotifyAddedToWorld.AddedToWorld(Actor self) { - if (info.Prerequisites.Any()) + if (info.Prerequisites.Length > 0) globalManager.Register(self, this, info.Prerequisites); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) { - if (info.Prerequisites.Any()) + if (info.Prerequisites.Length > 0) globalManager.Unregister(self, this, info.Prerequisites); } diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs index b7c2272143..d08b33db96 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit) { - if (info.Actors.Any() && !info.Actors.Select(a => a.ToLowerInvariant()).Contains(other.Info.Name)) + if (info.Actors.Count > 0 && !info.Actors.Select(a => a.ToLowerInvariant()).Contains(other.Info.Name)) return; if (token == Actor.InvalidConditionToken) diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs index 1322e31b9d..7195c7cdaf 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantRandomCondition.cs @@ -9,7 +9,6 @@ */ #endregion -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Conditions @@ -36,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Conditions void INotifyCreated.Created(Actor self) { - if (!info.Conditions.Any()) + if (info.Conditions.Length == 0) return; var condition = info.Conditions.Random(self.World.SharedRandom); diff --git a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs index 78c6ef8ce9..11b16a77cd 100644 --- a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits if (Info.ExcludedActorTypes.Contains(collector.Info.Name)) return 0; - if (Info.Prerequisites.Any() && !collector.Owner.PlayerActor.Trait().HasPrerequisites(Info.Prerequisites)) + if (Info.Prerequisites.Length > 0 && !collector.Owner.PlayerActor.Trait().HasPrerequisites(Info.Prerequisites)) return 0; return GetSelectionShares(collector); diff --git a/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs index 9006430f8b..4b99342799 100644 --- a/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits if (collector.Owner.NonCombatant) return false; - if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName)) + if (info.ValidFactions.Count > 0 && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName)) return false; if (!info.ValidTargets.Overlaps(collector.GetEnabledTargetTypes())) diff --git a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs index e148519a52..4b9358a50a 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits { this.self = self; this.info = info; - if (!info.Units.Any()) + if (info.Units.Length == 0) throw new YamlException("A GiveUnitCrateAction does not specify any units to give. This might be because the yaml is referring to 'Unit' rather than 'Units'."); } @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits if (collector.Owner.NonCombatant) return false; - if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName)) + if (info.ValidFactions.Count > 0 && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName)) return false; foreach (var unit in info.Units) diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index 9a6522f596..8ffee9d531 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits return; var source = Info.DamageSource == DamageSource.Self ? self : e.Attacker; - if (weapon.Report != null && weapon.Report.Any()) + if (weapon.Report != null && weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, weapon.Report, self.World, self.CenterPosition); if (Info.Type == ExplosionType.Footprint && buildingInfo != null) diff --git a/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs index acddc5bfd8..a3d621a6b8 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue) { - if ((!Queue.Any() || Queue.Contains(queue)) && (!Prerequisites.Any() || techTree.HasPrerequisites(Prerequisites))) + if ((Queue.Count == 0 || Queue.Contains(queue)) && (Prerequisites.Length == 0 || techTree.HasPrerequisites(Prerequisites))) return Multiplier; return 100; diff --git a/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs index 0ab3955782..79516bb6a2 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits int IProductionTimeModifierInfo.GetProductionTimeModifier(TechTree techTree, string queue) { - if ((!Queue.Any() || Queue.Contains(queue)) && (!Prerequisites.Any() || techTree.HasPrerequisites(Prerequisites))) + if ((Queue.Count == 0 || Queue.Contains(queue)) && (Prerequisites.Length == 0 || techTree.HasPrerequisites(Prerequisites))) return Multiplier; return 100; diff --git a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs index 43d1fe51a0..fef226c665 100644 --- a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs +++ b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits var list = upgradables[key]; list.RemoveAll(x => x.Actor == actor && x.GrantConditionOnPrerequisite == u); - if (!list.Any()) + if (list.Count == 0) { upgradables.Remove(key); techTree.Remove(key); diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index e140ccb663..fd10cbbb9e 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits .SelectMany(r => r.ReplaceableTypes) .ToHashSet(); - if (replaceableTypes.Any()) + if (replaceableTypes.Count > 0) foreach (var t in buildingInfo.Tiles(targetLocation)) foreach (var a in self.World.ActorMap.GetActorsAt(t)) if (a.TraitsImplementing().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableTypes))) @@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits .SelectMany(r => r.ReplaceableTypes) .ToHashSet(); - if (replaceableSegments.Any()) + if (replaceableSegments.Count > 0) foreach (var a in self.World.ActorMap.GetActorsAt(t.Cell)) if (a.TraitsImplementing().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableSegments))) self.World.Remove(a); diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index 748f88eab1..31f81db611 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits { var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString()); - if (startingCash.Any()) + if (startingCash.Count > 0) yield return new LobbyOption("startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder, startingCash, DefaultCash.ToString(), DefaultCashDropdownLocked); } diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index a7aa277143..566f75ef8b 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits Info = info; Faction = init.GetValue(self.Owner.Faction.InternalName); - IsValidFaction = !info.Factions.Any() || info.Factions.Contains(Faction); + IsValidFaction = info.Factions.Count == 0 || info.Factions.Contains(Faction); Enabled = IsValidFaction; allProducibles = Producible.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key); @@ -196,7 +196,7 @@ namespace OpenRA.Mods.Common.Traits if (!Info.Sticky) { Faction = self.Owner.Faction.InternalName; - IsValidFaction = !Info.Factions.Any() || Info.Factions.Contains(Faction); + IsValidFaction = Info.Factions.Count == 0 || Info.Factions.Contains(Faction); } // Regenerate the producibles and tech tree state @@ -274,7 +274,7 @@ namespace OpenRA.Mods.Common.Traits public virtual IEnumerable AllItems() { - if (productionTraits.Any() && productionTraits.All(p => p.IsTraitDisabled)) + if (productionTraits.Length > 0 && productionTraits.All(p => p.IsTraitDisabled)) return Enumerable.Empty(); if (developerMode.AllTech) return Producible.Keys; @@ -284,7 +284,7 @@ namespace OpenRA.Mods.Common.Traits public virtual IEnumerable BuildableItems() { - if (productionTraits.Any() && productionTraits.All(p => p.IsTraitDisabled)) + if (productionTraits.Length > 0 && productionTraits.All(p => p.IsTraitDisabled)) return Enumerable.Empty(); if (!Enabled) return Enumerable.Empty(); diff --git a/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs b/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs index da8260fd41..2198b1673c 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -93,10 +92,10 @@ namespace OpenRA.Mods.Common.Traits if (IsTraitDisabled) return; - if (Info.Factions.Any()) + if (Info.Factions.Count > 0) enabled = Info.Factions.Contains(faction); - if (Info.RequiresPrerequisites.Any() && enabled) + if (Info.RequiresPrerequisites.Length > 0 && enabled) enabled = techTree.HasPrerequisites(Info.RequiresPrerequisites); } diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index d1095eadb0..698104ba72 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits IEnumerable IEditorActorOptions.ActorOptions(ActorInfo ai, World world) { - if (!EditorOptions.Any()) + if (EditorOptions.Count == 0) yield break; // Make sure the no-plug option is always available diff --git a/OpenRA.Mods.Common/Traits/RejectsOrders.cs b/OpenRA.Mods.Common/Traits/RejectsOrders.cs index 362bb99f68..8d85712a2a 100644 --- a/OpenRA.Mods.Common/Traits/RejectsOrders.cs +++ b/OpenRA.Mods.Common/Traits/RejectsOrders.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public static bool AcceptsOrder(this Actor self, string orderString) { var rejectsOrdersTraits = self.TraitsImplementing().Where(Exts.IsTraitEnabled).ToArray(); - if (!rejectsOrdersTraits.Any()) + if (rejectsOrdersTraits.Length == 0) return true; var reject = rejectsOrdersTraits.SelectMany(t => t.Reject); diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs index 7a5e2c917c..ec440760d2 100644 --- a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; using OpenRA.Mods.Common.Effects; using OpenRA.Traits; @@ -125,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits.Render if (++offset >= Info.Offsets.Length) offset = 0; - if (!Info.TerrainTypes.Any() || Info.TerrainTypes.Contains(type)) + if (Info.TerrainTypes.Count == 0 || Info.TerrainTypes.Contains(type)) { var spawnFacing = Info.SpawnAtLastPosition ? cachedFacing : facing?.Facing ?? WAngle.Zero; diff --git a/OpenRA.Mods.Common/Traits/Render/WithAmmoPipsDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithAmmoPipsDecoration.cs index 610a50848e..2e1bda8f34 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAmmoPipsDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAmmoPipsDecoration.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits.Render public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info) : base(self, info) { - if (info.AmmoPools.Any()) + if (info.AmmoPools.Length > 0) ammo = self.TraitsImplementing() .Where(ap => info.AmmoPools.Contains(ap.Info.Name)) .ToArray(); diff --git a/OpenRA.Mods.Common/Traits/Render/WithBridgeSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithBridgeSpriteBody.cs index e213832e21..893bb5fb8f 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBridgeSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBridgeSpriteBody.cs @@ -106,11 +106,11 @@ namespace OpenRA.Mods.Common.Traits.Render var bDestroyed = bridgeInfo.BOffset != CVec.Zero && NeighbourIsDestroyed(bridgeInfo.BOffset); var sequence = DefaultAnimation.CurrentSequence.Name; - if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Any()) + if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Length > 0) sequence = bridgeInfo.ABDestroyedSequences.Random(Game.CosmeticRandom); - else if (aDestroyed && bridgeInfo.ADestroyedSequences.Any()) + else if (aDestroyed && bridgeInfo.ADestroyedSequences.Length > 0) sequence = bridgeInfo.ADestroyedSequences.Random(Game.CosmeticRandom); - else if (bDestroyed && bridgeInfo.BDestroyedSequences.Any()) + else if (bDestroyed && bridgeInfo.BDestroyedSequences.Length > 0) sequence = bridgeInfo.BDestroyedSequences.Random(Game.CosmeticRandom); else sequence = bridgeInfo.Sequences.Random(Game.CosmeticRandom); diff --git a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs index 3b92aafa9e..52498f0319 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.Common.Graphics; using OpenRA.Traits; @@ -59,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render var rs = self.Trait(); var image = rs.GetImage(self); - var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image }; + var images = info.XmasImages.Length > 0 && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image }; anim = new Animation(self.World, images.Random(Game.CosmeticRandom)); anim.Play(info.IdleSequence); diff --git a/OpenRA.Mods.Common/Traits/Render/WithDeadBridgeSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithDeadBridgeSpriteBody.cs index 72638a99ff..fd3216b8c2 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDeadBridgeSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDeadBridgeSpriteBody.cs @@ -92,11 +92,11 @@ namespace OpenRA.Mods.Common.Traits.Render var bRamp = bridgeInfo.BOffset != CVec.Zero && RampExists(self, bridgeInfo.BOffset); var sequence = DefaultAnimation.CurrentSequence.Name; - if (aRamp && bRamp && bridgeInfo.ABRampSequences.Any()) + if (aRamp && bRamp && bridgeInfo.ABRampSequences.Length > 0) sequence = bridgeInfo.ABRampSequences.Random(Game.CosmeticRandom); - else if (aRamp && bridgeInfo.ARampSequences.Any()) + else if (aRamp && bridgeInfo.ARampSequences.Length > 0) sequence = bridgeInfo.ARampSequences.Random(Game.CosmeticRandom); - else if (bRamp && bridgeInfo.BRampSequences.Any()) + else if (bRamp && bridgeInfo.BRampSequences.Length > 0) sequence = bridgeInfo.BRampSequences.Random(Game.CosmeticRandom); DefaultAnimation.PlayRepeating(NormalizeSequence(self, sequence)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs index 4c6544702c..195a4d9d85 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits.Render if (self.World.FogObscures(self)) return false; - if (blinkPattern != null && blinkPattern.Any()) + if (blinkPattern != null && blinkPattern.Length > 0) { var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length; if (blinkPattern[i] != BlinkState.On) diff --git a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs index bc80fd527d..621144fc4c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs @@ -77,15 +77,15 @@ namespace OpenRA.Mods.Common.Traits.Render // Per-actor production queues = self.TraitsImplementing() .Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type))) - .Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type)) + .Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type)) .ToArray(); - if (!queues.Any()) + if (queues.Length == 0) { // Player-wide production queues = self.Owner.PlayerActor.TraitsImplementing() .Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type))) - .Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type)) + .Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type)) .ToArray(); } } diff --git a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs index b24e683f2c..3f21b4f260 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs @@ -10,7 +10,6 @@ #endregion using System; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Sound @@ -43,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits.Sound void PlaySound(Actor self) { - if (info.Sounds.Any()) + if (info.Sounds.Length > 0) Game.Sound.Play(SoundType.World, info.Sounds, self.World, self.CenterPosition); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index 6fcecf63bc..9e65c9b2e1 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Mods.Common.Effects; @@ -126,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new NukePower(init.Self, this); } public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { - if (!string.IsNullOrEmpty(TrailImage) && !TrailSequences.Any()) + if (!string.IsNullOrEmpty(TrailImage) && TrailSequences.Length == 0) throw new YamlException("At least one entry in TrailSequences must be defined when TrailImage is defined."); var weaponToLower = (MissileWeapon ?? string.Empty).ToLowerInvariant(); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 43bb27689e..ae01d400de 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits { Powers.Add(key, t.CreateInstance(key, this)); - if (t.Info.Prerequisites.Any()) + if (t.Info.Prerequisites.Length > 0) { TechTree.Add(key, t.Info.Prerequisites, 0, this); TechTree.Update(); diff --git a/OpenRA.Mods.Common/Traits/Targetable.cs b/OpenRA.Mods.Common/Traits/Targetable.cs index 9a41e26514..4d1c9e7117 100644 --- a/OpenRA.Mods.Common/Traits/Targetable.cs +++ b/OpenRA.Mods.Common/Traits/Targetable.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits if (IsTraitDisabled) return false; - if (!cloaks.Any() || (!viewer.IsDead && viewer.Info.HasTraitInfo())) + if (cloaks.Length == 0 || (!viewer.IsDead && viewer.Info.HasTraitInfo())) return true; return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner)); diff --git a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs index 2a64e2a565..f65f915e4f 100644 --- a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs +++ b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits if (projectile != null) self.World.Add(projectile); - if (args.Weapon.Report != null && args.Weapon.Report.Any()) + if (args.Weapon.Report != null && args.Weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition); } }); diff --git a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs index 0a444583fd..876121237e 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs @@ -120,10 +120,10 @@ namespace OpenRA.Mods.Common.Traits Actor GetRandomSpawnPoint(World world, Support.MersenneTwister random) { var spawnPointActors = world.ActorsWithTrait() - .Where(x => !x.Trait.IsTraitDisabled && (info.Types.Overlaps(x.Trait.Types) || !x.Trait.Types.Any())) + .Where(x => !x.Trait.IsTraitDisabled && (info.Types.Overlaps(x.Trait.Types) || x.Trait.Types.Count == 0)) .ToArray(); - return spawnPointActors.Any() ? spawnPointActors.Random(random).Actor : null; + return spawnPointActors.Length > 0 ? spawnPointActors.Random(random).Actor : null; } public void DecreaseActorCount() diff --git a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs index 7044a4ec43..3dd92856eb 100644 --- a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits var terrainLinear = terrainColors.Select(c => c.ToLinear()).ToList(); var playerLinear = playerColors.Select(c => c.ToLinear()).ToList(); - if (PresetHues.Any()) + if (PresetHues.Length > 0) { foreach (var i in Exts.MakeArray(PresetHues.Length, x => x).Shuffle(random)) { diff --git a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs index 6b09c5dfa1..263379b29c 100644 --- a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs +++ b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits for (var i = 0; i < controlGroups.Length; i++) { var cg = controlGroups[i]; - if (cg.Any()) + if (cg.Count > 0) { var actorIds = cg.Select(a => a.ActorID).ToArray(); groups.Add(new MiniYamlNode(i.ToString(), FieldSaver.FormatValue(actorIds))); diff --git a/OpenRA.Mods.Common/Traits/World/CreateMapPlayers.cs b/OpenRA.Mods.Common/Traits/World/CreateMapPlayers.cs index 86d02490e3..8e2e4dd4fe 100644 --- a/OpenRA.Mods.Common/Traits/World/CreateMapPlayers.cs +++ b/OpenRA.Mods.Common/Traits/World/CreateMapPlayers.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits Team = client.Team, Handicap = client.Handicap, SpawnPoint = resolvedSpawnPoint, - IsRandomFaction = clientFaction.RandomFactionMembers.Any(), + IsRandomFaction = clientFaction.RandomFactionMembers.Count > 0, IsRandomSpawnPoint = client.SpawnPoint == 0, Fingerprint = client.Fingerprint, }; diff --git a/OpenRA.Mods.Common/Traits/World/DomainIndex.cs b/OpenRA.Mods.Common/Traits/World/DomainIndex.cs index a4a0026f4a..e3cceaff81 100644 --- a/OpenRA.Mods.Common/Traits/World/DomainIndex.cs +++ b/OpenRA.Mods.Common/Traits/World/DomainIndex.cs @@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits var toProcess = new Stack(); toProcess.Push(d1); - while (toProcess.Any()) + while (toProcess.Count > 0) { var current = toProcess.Pop(); if (!transientConnections.ContainsKey(current)) diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index 79e4ec84ff..c7a1b04940 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits // Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint var footprint = preview.Footprint.Select(kv => kv.Key).ToArray(); - if (!footprint.Any()) + if (footprint.Length == 0) footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) }; foreach (var cell in footprint) @@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits // Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint var footprint = preview.Footprint.Select(kv => kv.Key).ToArray(); - if (!footprint.Any()) + if (footprint.Length == 0) footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) }; foreach (var cell in footprint) @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits list.Remove(preview); - if (!list.Any()) + if (list.Count == 0) cellMap.Remove(cell); } @@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits { var map = worldRenderer.World.Map; var previews = PreviewsAt(cell).ToList(); - if (!previews.Any()) + if (previews.Count == 0) return map.Grid.DefaultSubCell; for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++) diff --git a/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs b/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs index 59d08c69be..9b36b2297b 100644 --- a/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs @@ -9,7 +9,6 @@ */ #endregion -using System.Linq; using OpenRA.Mods.Common.Pathfinder; using OpenRA.Traits; @@ -79,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits { var terrainType = map.GetTerrainInfo(cell).Type; var jli = (JumpjetLocomotorInfo)li; - if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Any()) + if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Count > 0) return false; if (jli.JumpjetTransitionOnRamps) diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index ac6ccdc77c..95d4f83216 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits var techLevels = map.PlayerActorInfo.TraitInfos() .ToDictionary(t => t.Id, t => t.Name); - if (techLevels.Any()) + if (techLevels.Count > 0) yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder, techLevels, TechLevel, TechLevelDropdownLocked); diff --git a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs index 9e2f3d122d..ad765cabfc 100644 --- a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs +++ b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits .ToArray(); random = playlist.Shuffle(Game.CosmeticRandom).ToArray(); - IsMusicAvailable = playlist.Any(); + IsMusicAvailable = playlist.Length > 0; AllowMuteBackgroundMusic = info.AllowMuteBackgroundMusic; if (SongExists(info.BackgroundMusic)) diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index 390fc99edc..a301b6c0da 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits { Info = info; world = self.World; - hasSmoke = !string.IsNullOrEmpty(info.SmokeImage) && info.SmokeSequences.Any(); + hasSmoke = !string.IsNullOrEmpty(info.SmokeImage) && info.SmokeSequences.Length > 0; var sequenceProvider = world.Map.Rules.Sequences; var types = sequenceProvider.Sequences(Info.Sequence); diff --git a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs index 53e61da618..5a84a81cc2 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var t in map.WorldActorInfo.TraitInfos()) startingUnits[t.Class] = t.ClassName; - if (startingUnits.Any()) + if (startingUnits.Count > 0) yield return new LobbyOption("startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder, startingUnits, StartingUnitsClass, DropdownLocked); } @@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits }); } - if (!unitGroup.SupportActors.Any()) + if (unitGroup.SupportActors.Length == 0) return; var supportSpawnCells = w.Map.FindTilesInAnnulus(p.HomeLocation, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius); diff --git a/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs b/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs index bd6ca6f025..7129f5b3ee 100644 --- a/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs @@ -9,7 +9,6 @@ */ #endregion -using System.Linq; using OpenRA.Mods.Common.Pathfinder; using OpenRA.Traits; @@ -77,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits bool ValidTransitionCell(CPos cell, SubterraneanLocomotorInfo sli) { var terrainType = map.GetTerrainInfo(cell).Type; - if (!sli.SubterraneanTransitionTerrainTypes.Contains(terrainType) && sli.SubterraneanTransitionTerrainTypes.Any()) + if (!sli.SubterraneanTransitionTerrainTypes.Contains(terrainType) && sli.SubterraneanTransitionTerrainTypes.Count > 0) return false; if (sli.SubterraneanTransitionOnRamps) diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs index 84d171b231..bc7a9e7cb8 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "[D2k]ResourceRenderer has been added.\n" + "You need to adjust the field RenderTypes on trait [D2k]ResourceRenderer\n" + "on the following actors:\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs index 67401471e3..2c52b70c27 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (weaponsToUpdate.Any()) + if (weaponsToUpdate.Count > 0) yield return "Add a ScreenShakeWarhead to the following weapons:\n" + UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}")); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs index 438f7d3ab9..50b4bb239d 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs @@ -29,11 +29,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (overrideLocations.Any()) + if (overrideLocations.Count > 0) yield return "Region-specific image overrides are no longer supported. The following definitions must be replaced:\n" + UpdateUtils.FormatMessageList(overrideLocations); - if (panelLocations.Any()) + if (panelLocations.Count > 0) yield return "The following definitions appear to be panels, but could not be converted to the new PanelRegion format.\n" + "You may wish to define PanelRegion/PanelSides manually to reduce duplication:\n" + UpdateUtils.FormatMessageList(panelLocations); @@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules // Reformat region as a list regionsNode.AddNode(n.Key, n.NodeValue()); - if (n.Value.Nodes.Any()) + if (n.Value.Nodes.Count > 0) overrideLocations.Add($"{chromeProviderNode.Key}.{n.Key} ({chromeProviderNode.Location.Filename})"); } @@ -199,7 +199,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules if (!ExtractPanelDefinition(chromeProviderNode, regionsNode)) panelLocations.Add($"{chromeProviderNode.Key} ({chromeProviderNode.Location.Filename})"); - if (regionsNode.Value.Nodes.Any()) + if (regionsNode.Value.Nodes.Count > 0) chromeProviderNode.AddNode(regionsNode); yield break; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs index 1c4c9a0b57..67d6944e63 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules + "You may have to define it manually now in the following places:\n" + UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")")); - if (missingActorTypes.Any()) + if (missingActorTypes.Count > 0) yield return message; missingActorTypes.Clear(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs index 689805ac9c..6b6c0baa3c 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules + "You may have to set it manually now in the following places:\n" + UpdateUtils.FormatMessageList(nonVTOLs.Select(n => n.Item1 + " (" + n.Item2 + ")")); - if (nonVTOLs.Any()) + if (nonVTOLs.Count > 0) yield return message; nonVTOLs.Clear(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs index a2d0ee72fd..308e8cb3db 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -27,7 +26,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "The WithPermanentInjury trait has been removed from the following actors.\n" + "You must manually define TakeCover with a negative ProneTime and use\n" + "GrantConditionOnDamageState/-Health with 'GrantPermanently: true'\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs index 471dce2f03..1e618f2750 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "The Spins property has been refactored to MaximumSpinSpeed.\n" + "MaximumSpinSpeed defaults to 'unlimited', while disabling is done by setting it to 0.\n" + "You may want to set a custom MaximumSpinSpeed limiting value in the following places:\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs index db1796697e..f2026641ff 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs @@ -49,18 +49,18 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (customPips && locations.Any()) + if (customPips && locations.Count > 0) yield return "Custom pip Images and Palettes are now defined on the individual With*PipsDecoration traits.\n" + "You should review the following definitions and manually define the Image and Palette properties as required:\n" + UpdateUtils.FormatMessageList(locations); - if (cargoCustomPips.Any() && cargoPipLocations.Any()) + if (cargoCustomPips.Count > 0 && cargoPipLocations.Count > 0) yield return "Some passenger types define custom cargo pips. Review the following definitions:\n" + UpdateUtils.FormatMessageList(cargoPipLocations) + "\nand, if required, add the following to the WithCargoPipsDecoration traits:\n" + "CustomPipSequences:\n" + cargoCustomPips.Select(p => $"\t{p}: {PipReplacements[p]}").JoinWith("\n"); - if (harvesterCustomPips.Any() && harvesterPipLocations.Any()) + if (harvesterCustomPips.Count > 0 && harvesterPipLocations.Count > 0) yield return "Review the following definitions:\n" + UpdateUtils.FormatMessageList(harvesterPipLocations) + "\nand, if required, add the following to the WithHarvesterPipsDecoration traits:\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs index 0e40badb80..a76fb68d7b 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -87,7 +86,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "Please check and adjust the new auto-generated dimensions.\n" + UpdateUtils.FormatMessageList(locations); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs index 02235f8800..20fc882a67 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (weaponsToUpdate.Any()) + if (weaponsToUpdate.Count > 0) yield return "Add a FlashPaletteEffectWarhead to the following weapons:\n" + UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}")); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs index 0276103014..e133396fa7 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "The way that decorations are positioned relative to the selection box has changed.\n" + "Review the following definitions and define Margin properties as required:\n" + UpdateUtils.FormatMessageList(locations.Select( diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs index 4bc62177b2..38e7ed7a58 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -26,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "UseClassicFacingFudge property on BodyOrientation was replaced with ClassicFacingBodyOrientation trait.\n" + "UseClassicFacingFudge for sequences was renamed to UseClassicFacings and moved to\n" + "Classic(TileSetSpecific)SpriteSequence loaders in Mods.Cnc.\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs index 0247dcea5a..febc475de0 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules " you will need to define a 'Facing' parameter on the 'Exit' trait of the host building. This change" + " does not affect the behaviour for landing on terrain which is governed by TurnToLand."; - if (turningAircraft.Any()) + if (turningAircraft.Count > 0) yield return message; turningAircraft.Clear(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs index ac82172e10..2e665f368c 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -27,7 +26,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "The *Palette fields have been removed from the *PlaceBuildingPreview traits.\n" + "You may wish to inspect the following definitions and define new Alpha or\n" + "LineBuildSegmentAlpha properties as appropriate to recreate transparency effects:\n" + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveResourceType.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveResourceType.cs index a1fb299cfd..3784fd68f4 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveResourceType.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveResourceType.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -36,21 +35,21 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (resourceLayer.Nodes.Any()) + if (resourceLayer.Nodes.Count > 0) yield return "Add the following definitions to your ResourceLayer and EditorResourceLayer definitions:\n\t" + "RecalculateResourceDensity: true\n\t" + resourceLayer.ToLines("ResourceTypes").JoinWith("\n\t"); - if (resourceLayer.Nodes.Any()) + if (resourceLayer.Nodes.Count > 0) yield return "Add the following definitions to your ResourceRenderer definition:\n\t" + resourceRenderer.ToLines("ResourceTypes").JoinWith("\n\t"); - if (values.Nodes.Any()) + if (values.Nodes.Count > 0) yield return "Add the following definition to your ^BasePlayer definition:\n\t" + "PlayerResources:\n\t\t" + values.ToLines("ResourceValues").JoinWith("\n\t\t"); - if (resourceLayer.Nodes.Any()) + if (resourceLayer.Nodes.Count > 0) yield return "Support for AllowUnderActors, AllowUnderBuildings, and AllowOnRamps have been removed.\n" + "You must define a custom ResourceLayer subclass if you want to customize the default behaviour."; } diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveSmokeTrailWhenDamaged.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveSmokeTrailWhenDamaged.cs index d8ac35a633..507b4e30d6 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveSmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveSmokeTrailWhenDamaged.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "Some actor(s) defined a MinDamage of neither 'Heavy' nor 'Undamaged' on SmokeTrailWhenDamaged before update.\n" + "Review the following definitions and add custom GrandConditionOnDamageState configs as required:\n" + UpdateUtils.FormatMessageList(locations.Select( diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs index aca3c6a9a9..6726f725ac 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -26,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "The shadow palette overrides have been removed from the following locations:\n" + UpdateUtils.FormatMessageList(locations) + "\n\n" + "You may wish to inspect and change these."; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs index 11e02b82ed..058baac408 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs @@ -10,7 +10,6 @@ #endregion using System.Collections.Generic; -using System.Linq; namespace OpenRA.Mods.Common.UpdateRules.Rules { @@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override IEnumerable AfterUpdate(ModData modData) { - if (locations.Any()) + if (locations.Count > 0) yield return "You must define new Color fields on the following traits:\n" + UpdateUtils.FormatMessageList(locations); diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs index 525253b296..b575f83c2a 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs @@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var mi = property.Item2; var required = property.Item3; var hasDesc = mi.HasAttribute(); - var hasRequires = required.Any(); + var hasRequires = required.Length > 0; var isActivity = mi.HasAttribute(); Console.Write($"| **{mi.LuaDocString()}**"); @@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var mi = property.Item2; var required = property.Item3; var hasDesc = mi.HasAttribute(); - var hasRequires = required.Any(); + var hasRequires = required.Length > 0; var isActivity = mi.HasAttribute(); Console.Write($"| **{mi.LuaDocString()}**"); diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index 7886795fcd..e211c63ded 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.UtilityCommands } } - if (videos.Any()) + if (videos.Count > 0) { var worldNode = Map.RuleDefinitions.Nodes.FirstOrDefault(n => n.Key == "World"); if (worldNode == null) @@ -311,21 +311,21 @@ namespace OpenRA.Mods.Common.UtilityCommands if (worldNode == null) worldNode = new MiniYamlNode("World", new MiniYaml("", new List())); - if (scorches.Any()) + if (scorches.Count > 0) { var initialScorches = new MiniYamlNode("InitialSmudges", new MiniYaml("", scorches)); var smudgeLayer = new MiniYamlNode("SmudgeLayer@SCORCH", new MiniYaml("", new List() { initialScorches })); worldNode.Value.Nodes.Add(smudgeLayer); } - if (craters.Any()) + if (craters.Count > 0) { var initialCraters = new MiniYamlNode("InitialSmudges", new MiniYaml("", craters)); var smudgeLayer = new MiniYamlNode("SmudgeLayer@CRATER", new MiniYaml("", new List() { initialCraters })); worldNode.Value.Nodes.Add(smudgeLayer); } - if (worldNode.Value.Nodes.Any() && !Map.RuleDefinitions.Nodes.Contains(worldNode)) + if (worldNode.Value.Nodes.Count > 0 && !Map.RuleDefinitions.Nodes.Contains(worldNode)) Map.RuleDefinitions.Nodes.Add(worldNode); } diff --git a/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs index d99a3453ed..b103e089a9 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine(" Individual Rules:"); foreach (var kv in ruleGroups) { - if (!kv.Value.Any()) + if (kv.Value.Count == 0) continue; Console.WriteLine(" " + kv.Key + ":"); @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.UtilityCommands mapFiles.Save(); Console.WriteLine("COMPLETE"); - if (manualSteps.Any()) + if (manualSteps.Count > 0) { Console.WriteLine(" Manual changes are required to complete this update:"); foreach (var manualStep in manualSteps) @@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine(); } - if (externalFilenames.Any()) + if (externalFilenames.Count > 0) { Console.WriteLine("The following shared yaml files referenced by the map have been ignored:"); Console.WriteLine(UpdateUtils.FormatMessageList(externalFilenames)); diff --git a/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs index 64d8ac83fc..28dd1ffc80 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Console.WriteLine(" Individual Rules:"); foreach (var kv in ruleGroups) { - if (!kv.Value.Any()) + if (kv.Value.Count == 0) continue; Console.WriteLine(" " + kv.Key + ":"); @@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var mapSteps = UpdateUtils.UpdateMap(modData, package, rule, out var mapFiles, mapExternalFilenames); allFiles.AddRange(mapFiles); - if (mapSteps.Any()) + if (mapSteps.Count > 0) manualSteps.Add("Map: " + package.Name + ":\n" + UpdateUtils.FormatMessageList(mapSteps)); } catch (Exception ex) @@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.UtilityCommands // Files are saved after each successful automated rule update allFiles.Save(); - if (manualSteps.Any()) + if (manualSteps.Count > 0) { LogLine(logWriter, " Manual changes are required to complete this update:"); LogLine(logWriter, UpdateUtils.FormatMessageList(manualSteps, 1)); @@ -246,7 +246,7 @@ namespace OpenRA.Mods.Common.UtilityCommands LogLine(logWriter); } - if (externalFilenames.Any()) + if (externalFilenames.Count > 0) { LogLine(logWriter, "The following external mod files have been ignored:"); LogLine(logWriter, UpdateUtils.FormatMessageList(externalFilenames)); diff --git a/OpenRA.Mods.Common/Warheads/FireClusterWarhead.cs b/OpenRA.Mods.Common/Warheads/FireClusterWarhead.cs index 8e0dcda39a..01b1a66deb 100644 --- a/OpenRA.Mods.Common/Warheads/FireClusterWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/FireClusterWarhead.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Warheads if (projectile != null) firedBy.World.AddFrameEndTask(w => w.Add(projectile)); - if (projectileArgs.Weapon.Report != null && projectileArgs.Weapon.Report.Any()) + if (projectileArgs.Weapon.Report != null && projectileArgs.Weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, projectileArgs.Weapon.Report, firedBy.World, target.CenterPosition); } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs index b83592aafa..09d925a8f0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs @@ -169,7 +169,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic protected override void InitializePreviews() { Panel.RemoveChildren(); - if (!SelectedCategories.Any()) + if (SelectedCategories.Count == 0) return; foreach (var a in allActors) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs index 2d70031646..6ed4191b03 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic protected override void InitializePreviews() { Panel.RemoveChildren(); - if (!SelectedCategories.Any()) + if (SelectedCategories.Count == 0) return; foreach (var t in allTemplates) diff --git a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs index 3a92300c5e..2b06819c24 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs @@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Delete(selectedSave); - if (!games.Any() && !isSavePanel) + if (games.Count == 0 && !isSavePanel) { Ui.CloseWindow(); onExit(); @@ -150,7 +150,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic }; var deleteAllButton = panel.Get("DELETE_ALL_BUTTON"); - deleteAllButton.IsDisabled = () => !games.Any(); + deleteAllButton.IsDisabled = () => games.Count == 0; deleteAllButton.OnClick = () => { ConfirmationDialogs.ButtonPrompt( @@ -355,7 +355,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (!Directory.Exists(baseSavePath)) return false; - return Directory.GetFiles(baseSavePath, "*.orasav", SearchOption.AllDirectories).Any(); + return Directory.GetFiles(baseSavePath, "*.orasav", SearchOption.AllDirectories).Length > 0; } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 0fa52a9033..2deb05a8d7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var spectators = orderManager.LobbyInfo.Clients.Where(c => c.IsObserver).ToList(); - if (spectators.Any()) + if (spectators.Count > 0) { var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { }); spectatorHeader.Get("TEAM").GetText = () => "Spectators"; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleBasesHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleBasesHotkeyLogic.cs index aa00c9bf15..6bc6c35fc2 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleBasesHotkeyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleBasesHotkeyLogic.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame .ToList(); // If no BaseBuilding exist pick the first selectable Building. - if (!bases.Any()) + if (bases.Count == 0) { var building = world.ActorsHavingTrait() .FirstOrDefault(a => a.Owner == player && a.Info.HasTraitInfo()); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleHarvestersHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleHarvestersHotkeyLogic.cs index 44e7200209..fcbb1bbf5a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleHarvestersHotkeyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleHarvestersHotkeyLogic.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame .Where(a => a.IsInWorld && a.Owner == player) .ToList(); - if (!harvesters.Any()) + if (harvesters.Count == 0) return true; var next = harvesters diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleProductionActorsHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleProductionActorsHotkeyLogic.cs index bc509edccf..26abf95dfd 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleProductionActorsHotkeyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/CycleProductionActorsHotkeyLogic.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame .OrderBy(f => f.TraitsImplementing().First(t => !t.IsTraitDisabled).Info.Produces.First()) .ToList(); - if (!facilities.Any()) + if (facilities.Count == 0) return true; var next = facilities diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectUnitsByTypeHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectUnitsByTypeHotkeyLogic.cs index 3912380e9c..190209827b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectUnitsByTypeHotkeyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/Hotkeys/SelectUnitsByTypeHotkeyLogic.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame .Where(x => !x.IsDead && eligiblePlayers.Contains(x.Owner)) .ToList(); - if (!ownedActors.Any()) + if (ownedActors.Count == 0) return false; // Get all the selected actors' selection classes diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/StanceSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/StanceSelectorLogic.cs index a66ed0a758..9b44ecfc9d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/StanceSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/StanceSelectorLogic.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets { WidgetUtils.BindButtonIcon(button); - button.IsDisabled = () => { UpdateStateIfNecessary(); return !actorStances.Any(); }; + button.IsDisabled = () => { UpdateStateIfNecessary(); return actorStances.Length == 0; }; button.IsHighlighted = () => actorStances.Any( at => !at.Trait.IsTraitDisabled && at.Trait.PredictedStance == stance); button.OnClick = () => SetSelectionStance(stance); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs index 633b4f6b5f..027c045016 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs @@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic scrollPanel.AddChild(container); } - discAvailable = content.Packages.Values.Any(p => p.Sources.Any() && !p.IsInstalled()); + discAvailable = content.Packages.Values.Any(p => p.Sources.Length > 0 && !p.IsInstalled()); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs index 394ee1f688..6193e8f38f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs @@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic foreach (var option in allOptions.Where(o => o is LobbyBooleanOption)) { - if (!checkboxColumns.Any()) + if (checkboxColumns.Count == 0) { row = checkboxRowTemplate.Clone(); row.Bounds.Y = optionsContainer.Bounds.Height; @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic foreach (var option in allOptions.Where(o => !(o is LobbyBooleanOption))) { - if (!dropdownColumns.Any()) + if (dropdownColumns.Count == 0) { row = dropdownRowTemplate.Clone() as Widget; row.Bounds.Y = optionsContainer.Bounds.Height; @@ -155,7 +155,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return item; }; - dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", option.Values.Count() * 30, option.Values, setupItem); + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", option.Values.Count * 30, option.Values, setupItem); }; var label = row.GetOrNull(dropdown.Id + "_DESC"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 13eb5dbd41..14d617cac0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } } - options.Add(bots.Any() ? "Bots" : "Bots Disabled", bots); + options.Add(bots.Count > 0 ? "Bots" : "Bots Disabled", bots); Func setupItem = (o, itemTemplate) => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index 7dc3692a16..13d3e165ae 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var missionsButton = singleplayerMenu.Get("MISSIONS_BUTTON"); missionsButton.OnClick = OpenMissionBrowserPanel; - var hasCampaign = modData.Manifest.Missions.Any(); + var hasCampaign = modData.Manifest.Missions.Length > 0; var hasMissions = modData.MapCache .Any(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector)); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index 02f3bc5d34..62eaad26e1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { RefreshMaps(currentTab, filter); EnumerateMaps(currentTab, itemTemplate); - if (!tabMaps[currentTab].Any()) + if (tabMaps[currentTab].Length == 0) SwitchTab(modData.MapCache[newUid].Class, itemTemplate); }); }; @@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic SetupMapTab(MapClassification.User, filter, "USER_MAPS_TAB_BUTTON", "USER_MAPS_TAB", itemTemplate); SetupMapTab(MapClassification.System, filter, "SYSTEM_MAPS_TAB_BUTTON", "SYSTEM_MAPS_TAB", itemTemplate); - if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Any()) + if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Length > 0) { selectedUid = Game.ModData.MapCache.ChooseInitialMap(tabMaps[initialTab].Select(mp => mp.Uid).First(), Game.CosmeticRandom); @@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var tabButton = widget.Get(tabButtonName); tabButton.IsHighlighted = () => currentTab == tab; - tabButton.IsVisible = () => tabMaps[tab].Any(); + tabButton.IsVisible = () => tabMaps[tab].Length > 0; tabButton.OnClick = () => SwitchTab(tab, itemTemplate); RefreshMaps(tab, filter); @@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic .ToList(); // 'all game types' extra item - categories.Insert(0, (null as string, tabMaps[tab].Count())); + categories.Insert(0, (null as string, tabMaps[tab].Length)); Func<(string Category, int Count), string> showItem = x => $"{x.Category ?? "All Maps"} ({x.Count})"; diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index 2084ee76fa..deb4229668 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic missionList.RemoveChildren(); // Add a group for each campaign - if (modData.Manifest.Missions.Any()) + if (modData.Manifest.Missions.Length > 0) { var yaml = MiniYaml.Merge(modData.Manifest.Missions.Select( m => MiniYaml.FromStream(modData.DefaultFileSystem.Open(m), m))); @@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic allPreviews.AddRange(loosePreviews); } - if (allPreviews.Any()) + if (allPreviews.Count > 0) SelectMap(allPreviews.First()); // Preload map preview to reduce jank diff --git a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs index 4c1f6b21d5..605c1e6c92 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs @@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (localProfile.State == LocalPlayerProfile.LinkState.Linked) { - if (localProfile.ProfileData.Badges.Any()) + if (localProfile.ProfileData.Badges.Count > 0) { Func negotiateWidth = _ => widget.Get("PROFILE_HEADER").Bounds.Width; @@ -207,7 +207,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return profileWidth; }; - if (profile.Badges.Any()) + if (profile.Badges.Count > 0) { var badges = Ui.LoadWidget("PLAYER_PROFILE_BADGES_INSERT", badgeContainer, new WidgetArgs() { @@ -262,7 +262,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic [ObjectCreator.UseCtor] public PlayerProfileBadgesLogic(Widget widget, PlayerProfile profile, Func negotiateWidth) { - var showBadges = profile.Badges.Any(); + var showBadges = profile.Badges.Count > 0; widget.IsVisible = () => showBadges; var badgeTemplate = widget.Get("BADGE_TEMPLATE"); @@ -279,7 +279,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic widget.Bounds.Width = negotiateWidth(2 * templateLabel.Bounds.Left - templateIcon.Bounds.Right + maxLabelWidth); var badgeOffset = badgeTemplate.Bounds.Y; - if (profile.Badges.Any()) + if (profile.Badges.Count > 0) badgeOffset += 3; foreach (var badge in profile.Badges) diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs index 16852a4540..014990ac72 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs @@ -291,7 +291,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var players = widget.GetOrNull("SELECTED_PLAYERS"); if (players != null) { - players.IsVisible = () => currentServer != null && (clientContainer == null || !currentServer.Clients.Any()); + players.IsVisible = () => currentServer != null && (clientContainer == null || currentServer.Clients.Length == 0); players.GetText = () => PlayersLabel(currentServer); } @@ -299,7 +299,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (clientContainer != null) { clientList = Ui.LoadWidget("MULTIPLAYER_CLIENT_LIST", clientContainer, new WidgetArgs()) as ScrollPanelWidget; - clientList.IsVisible = () => currentServer != null && currentServer.Clients.Any(); + clientList.IsVisible = () => currentServer != null && currentServer.Clients.Length > 0; clientHeader = clientList.Get("HEADER"); clientTemplate = clientList.Get("TEMPLATE"); clientList.RemoveChildren(); @@ -449,7 +449,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic mapPreview.DisabledSpawnPoints = () => server.DisabledSpawnPoints; } - if (server == null || !server.Clients.Any()) + if (server == null || server.Clients.Length == 0) { if (joinButton != null) joinButton.Bounds.Y = joinButtonY; @@ -546,7 +546,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return; } - if (!rows.Any()) + if (rows.Count == 0) { searchStatus = SearchStatus.NoGames; return; @@ -649,7 +649,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic players.GetText = () => label; players.GetColor = () => color; - if (game.Clients.Any()) + if (game.Clients.Length > 0) { var displayClients = game.Clients.Select(c => c.Name); if (game.Clients.Length > 10) diff --git a/OpenRA.Mods.Common/Widgets/Logic/TabCompletionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/TabCompletionLogic.cs index c41647f33a..ad23e2c8bc 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/TabCompletionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/TabCompletionLogic.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (string.IsNullOrWhiteSpace(text)) return text; - if (lastCompleted == text && candidates.Any()) + if (lastCompleted == text && candidates.Count > 0) { lastCompleted = prefix + candidates[++currentCandidateIndex % candidates.Count] + suffix; return lastCompleted; diff --git a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs index 3381d63785..a41fc9500b 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets clocks.Add(power.a.Key, new Animation(world, ClockAnimation)); } - Bounds.Width = powers.Count() * (IconWidth + IconSpacing); + Bounds.Width = powers.Count * (IconWidth + IconSpacing); Game.Renderer.EnableAntialiasingFilter(); diff --git a/OpenRA.Mods.Common/Widgets/RadarWidget.cs b/OpenRA.Mods.Common/Widgets/RadarWidget.cs index 2875cdbc85..6c978876fa 100644 --- a/OpenRA.Mods.Common/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/RadarWidget.cs @@ -189,10 +189,10 @@ namespace OpenRA.Mods.Common.Widgets { var allTop = map.Unproject(new PPos(x, projectedTop)); var allBottom = map.Unproject(new PPos(x, projectedBottom)); - if (allTop.Any()) + if (allTop.Count > 0) top = Math.Min(top, allTop.MinBy(uv => uv.V).V); - if (allBottom.Any()) + if (allBottom.Count > 0) bottom = Math.Max(bottom, allBottom.MaxBy(uv => uv.V).V); } diff --git a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs index ffb1c20c80..e3c5845c0d 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Widgets powers = world.ActorsWithTrait() .Where(p => !p.Actor.IsDead && !p.Actor.Owner.NonCombatant) .SelectMany(s => s.Trait.Powers.Values) - .Where(p => p.Instances.Any() && p.Info.DisplayTimerRelationships != PlayerRelationship.None && !p.Disabled); + .Where(p => p.Instances.Count > 0 && p.Info.DisplayTimerRelationships != PlayerRelationship.None && !p.Disabled); bgDark = ChromeMetrics.Get("TextContrastColorDark"); bgLight = ChromeMetrics.Get("TextContrastColorLight"); diff --git a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs index fb2fa61104..185fd95e58 100644 --- a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs +++ b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs @@ -11,7 +11,6 @@ using System.Collections.Generic; using System.IO; -using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.Common.Graphics; using OpenRA.Primitives; @@ -121,7 +120,7 @@ namespace OpenRA.Mods.D2k.SpriteLoaders s.Position = start; frames = tmp.ToArray(); - if (palettes.Any()) + if (palettes.Count > 0) metadata = new TypeDictionary { new EmbeddedSpritePalette(framePalettes: palettes) }; return true; diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs index 9b101a156b..0cdd97d98b 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs @@ -75,7 +75,7 @@ namespace OpenRA.Mods.D2k.Traits var sequences = world.Map.Rules.Sequences; var techTree = init.Get().Value(world).PlayerActor.Trait(); - checkUnsafeTiles = info.RequiresPrerequisites.Any() && techTree.HasPrerequisites(info.RequiresPrerequisites); + checkUnsafeTiles = info.RequiresPrerequisites.Length > 0 && techTree.HasPrerequisites(info.RequiresPrerequisites); var validSequence = sequences.GetSequence(info.Image, info.TileValidName); validTile = validSequence.GetSprite(0); diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs index da0079212c..480fa6a6a6 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.D2k.Traits.Buildings { base.AddedToWorld(self); - if (layer != null && (!info.ConcretePrerequisites.Any() || techTree == null || techTree.HasPrerequisites(info.ConcretePrerequisites))) + if (layer != null && (info.ConcretePrerequisites.Length == 0 || techTree == null || techTree.HasPrerequisites(info.ConcretePrerequisites))) { var map = self.World.Map; diff --git a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs index b87ed35397..2116382875 100644 --- a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs +++ b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs @@ -161,7 +161,7 @@ namespace OpenRA.Mods.D2k.Traits if (projectile != null) self.World.Add(projectile); - if (args.Weapon.Report != null && args.Weapon.Report.Any()) + if (args.Weapon.Report != null && args.Weapon.Report.Length > 0) Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition); } }); diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index 4027b39cea..1cebfb999f 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -156,7 +156,7 @@ namespace OpenRA.Platforms.Default .Where(profile => CanCreateGLWindow(profile, errorLog)) .ToArray(); - if (!supportedProfiles.Any()) + if (supportedProfiles.Length == 0) { foreach (var error in errorLog) Log.Write("graphics", error);