.Any(), .Count() -> .Count or .Length

This commit is contained in:
Eduardo Cáceres
2022-05-02 13:05:22 +02:00
committed by atlimit8
parent 6eb4fe8980
commit 79f321cb44
138 changed files with 233 additions and 258 deletions

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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" +

View File

@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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}"));

View File

@@ -29,11 +29,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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<int[]>());
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;

View File

@@ -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();

View File

@@ -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();

View File

@@ -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<string> 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" +

View File

@@ -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<string> 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" +

View File

@@ -49,18 +49,18 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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" +

View File

@@ -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<string> 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);

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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}"));

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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(

View File

@@ -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<string> 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" +

View File

@@ -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();

View File

@@ -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<string> 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" +

View File

@@ -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<string> 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.";
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> 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(

View File

@@ -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<string> 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.";

View File

@@ -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<string> 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);