Fix IDE0090

This commit is contained in:
RoosterDragon
2023-04-05 19:34:12 +01:00
committed by Pavel Penev
parent 164abfdae1
commit 8a285f9b19
385 changed files with 790 additions and 794 deletions

View File

@@ -38,8 +38,8 @@ namespace OpenRA.Mods.Common.Traits
class Bin
{
public readonly List<Actor> Actors = new List<Actor>();
public readonly List<ProximityTrigger> ProximityTriggers = new List<ProximityTrigger>();
public readonly List<Actor> Actors = new();
public readonly List<ProximityTrigger> ProximityTriggers = new();
}
class CellTrigger
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits
readonly Action<Actor> onActorEntered;
readonly Action<Actor> onActorExited;
readonly HashSet<Actor> oldActors = new HashSet<Actor>();
readonly HashSet<Actor> currentActors = new HashSet<Actor>();
readonly HashSet<Actor> oldActors = new();
readonly HashSet<Actor> currentActors = new();
public CellTrigger(CPos[] footprint, Action<Actor> onActorEntered, Action<Actor> onActorExited)
{
@@ -98,8 +98,8 @@ namespace OpenRA.Mods.Common.Traits
readonly Action<Actor> onActorEntered;
readonly Action<Actor> onActorExited;
readonly HashSet<Actor> oldActors = new HashSet<Actor>();
readonly HashSet<Actor> currentActors = new HashSet<Actor>();
readonly HashSet<Actor> oldActors = new();
readonly HashSet<Actor> currentActors = new();
WPos position;
WDist range;
@@ -166,9 +166,9 @@ namespace OpenRA.Mods.Common.Traits
readonly ActorMapInfo info;
readonly Map map;
readonly Dictionary<int, CellTrigger> cellTriggers = new Dictionary<int, CellTrigger>();
readonly Dictionary<CPos, List<CellTrigger>> cellTriggerInfluence = new Dictionary<CPos, List<CellTrigger>>();
readonly Dictionary<int, ProximityTrigger> proximityTriggers = new Dictionary<int, ProximityTrigger>();
readonly Dictionary<int, CellTrigger> cellTriggers = new();
readonly Dictionary<CPos, List<CellTrigger>> cellTriggerInfluence = new();
readonly Dictionary<int, ProximityTrigger> proximityTriggers = new();
int nextTriggerId;
CellLayer<InfluenceNode>[] influence;
@@ -181,8 +181,8 @@ namespace OpenRA.Mods.Common.Traits
// Position updates are done in one pass
// to ensure consistency during a tick
readonly HashSet<Actor> addActorPosition = new HashSet<Actor>();
readonly HashSet<Actor> removeActorPosition = new HashSet<Actor>();
readonly HashSet<Actor> addActorPosition = new();
readonly HashSet<Actor> removeActorPosition = new();
readonly Predicate<Actor> actorShouldBeRemoved;
public WDist LargestActorRadius { get; }

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Owner = "Creeps";
[Desc("Type of ActorSpawner with which it connects.")]
public readonly HashSet<string> Types = new HashSet<string>() { };
public readonly HashSet<string> Types = new() { };
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
[SequenceReference(dictionaryReference: LintDictionaryReference.Values)]
[Desc("Actor type to show in the color picker for specific factions. Overrides PreviewActor.",
"A dictionary of [faction name]: [actor name].")]
public readonly Dictionary<string, string> FactionPreviewActors = new Dictionary<string, string>();
public readonly Dictionary<string, string> FactionPreviewActors = new();
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -54,10 +54,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly int InitialSpawnDelay = 0;
[Desc("Which terrain types can we drop on?")]
public readonly HashSet<string> ValidGround = new HashSet<string> { "Clear", "Rough", "Road", "Ore", "Beach" };
public readonly HashSet<string> ValidGround = new() { "Clear", "Rough", "Road", "Ore", "Beach" };
[Desc("Which terrain types count as water?")]
public readonly HashSet<string> ValidWater = new HashSet<string> { "Water" };
public readonly HashSet<string> ValidWater = new() { "Water" };
[Desc("Chance of generating a water crate instead of a land crate.")]
public readonly int WaterChance = 20;
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int QuantizedFacings = 32;
[Desc("Spawn and remove the plane this far outside the map.")]
public readonly WDist Cordon = new WDist(5120);
public readonly WDist Cordon = new(5120);
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
{

View File

@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits
public class EditorActionManager : IWorldLoaded
{
readonly Stack<EditorActionContainer> undoStack = new Stack<EditorActionContainer>();
readonly Stack<EditorActionContainer> redoStack = new Stack<EditorActionContainer>();
readonly Stack<EditorActionContainer> undoStack = new();
readonly Stack<EditorActionContainer> redoStack = new();
public event Action<EditorActionContainer> ItemAdded;
public event Action<EditorActionContainer> ItemRemoved;

View File

@@ -39,8 +39,8 @@ namespace OpenRA.Mods.Common.Traits
public class EditorActorLayer : IWorldLoaded, ITickRender, IRender, IRadarSignature, ICreatePlayers, IRenderAnnotations
{
readonly EditorActorLayerInfo info;
readonly List<EditorActorPreview> previews = new List<EditorActorPreview>();
readonly Dictionary<CPos, List<EditorActorPreview>> cellMap = new Dictionary<CPos, List<EditorActorPreview>>();
readonly List<EditorActorPreview> previews = new();
readonly Dictionary<CPos, List<EditorActorPreview>> cellMap = new();
SpatiallyPartitioned<EditorActorPreview> screenMap;
WorldRenderer worldRenderer;

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
readonly TooltipInfoBase tooltip;
IActorPreview[] previews;
readonly ActorReference reference;
readonly Dictionary<INotifyEditorPlacementInfo, object> editorData = new Dictionary<INotifyEditorPlacementInfo, object>();
readonly Dictionary<INotifyEditorPlacementInfo, object> editorData = new();
public EditorActorPreview(WorldRenderer worldRenderer, string id, ActorReference reference, PlayerReference owner)
{

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Required for the map editor to work. Attach this to the world actor.")]
public class EditorCursorLayerInfo : TraitInfo, Requires<EditorActorLayerInfo>, Requires<ITiledTerrainRendererInfo>
{
public readonly WAngle PreviewFacing = new WAngle(384);
public readonly WAngle PreviewFacing = new(384);
public override object Create(ActorInitializer init) { return new EditorCursorLayer(init.Self, this); }
}
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
public string ResourceType { get; private set; }
CPos terrainOrResourceCell;
bool terrainOrResourceDirty;
readonly List<IRenderable> terrainOrResourcePreview = new List<IRenderable>();
readonly List<IRenderable> terrainOrResourcePreview = new();
public EditorCursorLayer(Actor self, EditorCursorLayerInfo info)
{

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Map map;
readonly CellLayer<WPos> cellCenters;
readonly CellLayer<byte> terrainIndices;
readonly HashSet<CPos> ends = new HashSet<CPos>();
readonly HashSet<CPos> ends = new();
bool enabled;
public ElevatedBridgeLayer(Actor self, ElevatedBridgeLayerInfo info)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public class LegacyBridgeLayer : IWorldLoaded
{
readonly LegacyBridgeLayerInfo info;
readonly Dictionary<ushort, (string Template, int Health)> bridgeTypes = new Dictionary<ushort, (string, int)>();
readonly Dictionary<ushort, (string Template, int Health)> bridgeTypes = new();
readonly ITemplatedTerrainInfo terrainInfo;
CellLayer<Bridge> bridges;

View File

@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits
public class TerrainInfo
{
public static readonly TerrainInfo Impassable = new TerrainInfo();
public static readonly TerrainInfo Impassable = new();
public readonly short Cost;
public readonly int Speed;
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
readonly LocomotorInfo.TerrainInfo[] terrainInfos;
readonly World world;
readonly HashSet<CPos> dirtyCells = new HashSet<CPos>();
readonly HashSet<CPos> dirtyCells = new();
readonly bool sharesCell;
CellLayer<short>[] cellsCost;

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
{
public CPos[] SpawnLocations;
public List<int> AvailableSpawnPoints;
public readonly Dictionary<int, Session.Client> OccupiedSpawnPoints = new Dictionary<int, Session.Client>();
public readonly Dictionary<int, Session.Client> OccupiedSpawnPoints = new();
}
object IAssignSpawnPointsInfo.InitializeState(MapPreview map, Session lobbyInfo)
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
public class MapStartingLocations : IWorldLoaded, INotifyCreated, IAssignSpawnPoints
{
readonly MapStartingLocationsInfo info;
readonly Dictionary<int, Session.Client> occupiedSpawnPoints = new Dictionary<int, Session.Client>();
readonly Dictionary<int, Session.Client> occupiedSpawnPoints = new();
bool separateTeamSpawns;
CPos[] spawnLocations;
List<int> availableSpawnPoints;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string ClassName = "Unlabeled";
[Desc("Only available when selecting one of these factions.", "Leave empty for no restrictions.")]
public readonly HashSet<string> Factions = new HashSet<string>();
public readonly HashSet<string> Factions = new();
[Desc("The actor at the center, usually the mobile construction vehicle.")]
[ActorReference]

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly float ActorFlashOverlayAlpha = 0.5f;
[Desc("The tint to apply when ActorFlashType is Tint.")]
public readonly float3 ActorFlashTint = new float3(1.4f, 1.4f, 1.4f);
public readonly float3 ActorFlashTint = new(1.4f, 1.4f, 1.4f);
[Desc("Number of times to flash (frozen) actors.")]
public readonly int ActorFlashCount = 2;

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public class PathFinder : IPathFinder, IWorldLoaded
{
public static readonly List<CPos> NoPath = new List<CPos>(0);
public static readonly List<CPos> NoPath = new(0);
/// <summary>
/// When searching for paths, use a default weight of 125% to reduce

View File

@@ -46,8 +46,7 @@ namespace OpenRA.Mods.Common.Traits
sealed class Record : PathSearch.IRecorder, IEnumerable<(CPos Source, CPos Destination, int CostSoFar, int EstimatedRemainingCost)>
{
readonly Dictionary<CPos, (CPos Source, int CostSoFar, int EstimatedRemainingCost)> edges
= new Dictionary<CPos, (CPos Source, int CostSoFar, int EstimatedRemainingCost)>();
readonly Dictionary<CPos, (CPos Source, int CostSoFar, int EstimatedRemainingCost)> edges = new();
public void Add(CPos source, CPos destination, int costSoFar, int estimatedRemainingCost)
{

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
public class RadarPings : ITick
{
public readonly List<RadarPing> Pings = new List<RadarPing>();
public readonly List<RadarPing> Pings = new();
readonly RadarPingsInfo info;
public WPos? LastPingPosition;

View File

@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits
public sealed class ResourceClaimLayer
{
readonly Dictionary<CPos, List<Actor>> claimByCell = new Dictionary<CPos, List<Actor>>(32);
readonly Dictionary<Actor, CPos> claimByActor = new Dictionary<Actor, CPos>(32);
readonly Dictionary<CPos, List<Actor>> claimByCell = new(32);
readonly Dictionary<Actor, CPos> claimByActor = new(32);
/// <summary>
/// Attempt to reserve the resource in a cell for the given actor.

View File

@@ -98,11 +98,11 @@ namespace OpenRA.Mods.Common.Traits
protected readonly ResourceRendererInfo Info;
protected readonly IResourceLayer ResourceLayer;
protected readonly CellLayer<RendererCellContents> RenderContents;
protected readonly Dictionary<string, Dictionary<string, ISpriteSequence>> Variants = new Dictionary<string, Dictionary<string, ISpriteSequence>>();
protected readonly Dictionary<string, Dictionary<string, ISpriteSequence>> Variants = new();
protected readonly World World;
readonly HashSet<CPos> dirty = new HashSet<CPos>();
readonly Queue<CPos> cleanDirty = new Queue<CPos>();
readonly HashSet<CPos> dirty = new();
readonly Queue<CPos> cleanDirty = new();
TerrainSpriteLayer shadowLayer;
TerrainSpriteLayer spriteLayer;
bool disposed;

View File

@@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Traits
public int Hash { get; private set; }
public IEnumerable<Actor> Actors => actors;
readonly HashSet<Actor> actors = new HashSet<Actor>();
readonly List<Actor> rolloverActors = new List<Actor>();
readonly HashSet<Actor> actors = new();
readonly List<Actor> rolloverActors = new();
World world;
INotifySelection[] worldNotifySelection;

View File

@@ -90,9 +90,9 @@ namespace OpenRA.Mods.Common.Traits
}
public readonly SmudgeLayerInfo Info;
readonly Dictionary<CPos, Smudge> tiles = new Dictionary<CPos, Smudge>();
readonly Dictionary<CPos, Smudge> dirty = new Dictionary<CPos, Smudge>();
readonly Dictionary<string, ISpriteSequence> smudges = new Dictionary<string, ISpriteSequence>();
readonly Dictionary<CPos, Smudge> tiles = new();
readonly Dictionary<CPos, Smudge> dirty = new();
readonly Dictionary<string, ISpriteSequence> smudges = new();
readonly World world;
readonly bool hasSmoke;

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
public class SpawnMapActors : IWorldLoaded
{
public Dictionary<string, Actor> Actors = new Dictionary<string, Actor>();
public Dictionary<string, Actor> Actors = new();
public uint LastMapActorID { get; private set; }
public void WorldLoaded(World world, WorldRenderer wr)

View File

@@ -22,13 +22,13 @@ namespace OpenRA.Mods.Common.Traits
public readonly short SubterraneanTransitionCost = 0;
[Desc("The terrain types that this actor can transition on. Leave empty to allow any.")]
public readonly HashSet<string> SubterraneanTransitionTerrainTypes = new HashSet<string>();
public readonly HashSet<string> SubterraneanTransitionTerrainTypes = new();
[Desc("Can this actor transition on slopes?")]
public readonly bool SubterraneanTransitionOnRamps = false;
[Desc("Depth at which the subterranean condition is applied.")]
public readonly WDist SubterraneanTransitionDepth = new WDist(-1024);
public readonly WDist SubterraneanTransitionDepth = new(-1024);
public override bool DisableDomainPassabilityCheck => true;

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
readonly TerrainLightingInfo info;
readonly Map map;
readonly Dictionary<int, LightSource> lightSources = new Dictionary<int, LightSource>();
readonly Dictionary<int, LightSource> lightSources = new();
readonly SpatiallyPartitioned<LightSource> partitionedLightSources;
readonly float3 globalTint;
int nextLightSourceToken = 1;

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Map map;
readonly CellLayer<WPos> cellCenters;
readonly CellLayer<byte> terrainIndices;
readonly HashSet<CPos> portals = new HashSet<CPos>();
readonly HashSet<CPos> portals = new();
bool enabled;
public TerrainTunnelLayer(Actor self, TerrainTunnelLayerInfo info)

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int[] TimeLimitOptions = { 0, 10, 20, 30, 40, 60, 90 };
[Desc("List of remaining minutes of game time when a text and optional speech notification should be made to players.")]
public readonly Dictionary<int, string> TimeLimitWarnings = new Dictionary<int, string>
public readonly Dictionary<int, string> TimeLimitWarnings = new()
{
{ 1, null },
{ 2, null },

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
}
readonly WarheadDebugOverlayInfo info;
readonly List<WHImpact> impacts = new List<WHImpact>();
readonly List<WHImpact> impacts = new();
public WarheadDebugOverlay(WarheadDebugOverlayInfo info)
{