From 8a285f9b19f1ddfb0b2006e4ad916d15907e14aa Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Wed, 5 Apr 2023 19:34:12 +0100 Subject: [PATCH] Fix IDE0090 --- .editorconfig | 2 +- OpenRA.Game/Actor.cs | 10 ++-- OpenRA.Game/CPos.cs | 2 +- OpenRA.Game/CVec.cs | 2 +- OpenRA.Game/ExternalMods.cs | 2 +- OpenRA.Game/FieldLoader.cs | 12 ++-- OpenRA.Game/FileFormats/Png.cs | 2 +- OpenRA.Game/FileSystem/FileSystem.cs | 8 +-- OpenRA.Game/FileSystem/ZipFile.cs | 2 +- OpenRA.Game/Game.cs | 4 +- OpenRA.Game/GameInformation.cs | 2 +- OpenRA.Game/GameRules/ActorInfo.cs | 2 +- OpenRA.Game/GameRules/SoundInfo.cs | 14 ++--- OpenRA.Game/GameRules/WeaponInfo.cs | 8 +-- OpenRA.Game/Graphics/ChromeProvider.cs | 2 +- OpenRA.Game/Graphics/CursorManager.cs | 2 +- OpenRA.Game/Graphics/HardwarePalette.cs | 6 +- OpenRA.Game/Graphics/ModelRenderer.cs | 8 +-- OpenRA.Game/Graphics/RgbaColorRenderer.cs | 2 +- OpenRA.Game/Graphics/SheetBuilder.cs | 2 +- OpenRA.Game/Graphics/SpriteCache.cs | 12 ++-- OpenRA.Game/Graphics/TerrainSpriteLayer.cs | 2 +- OpenRA.Game/Graphics/Viewport.cs | 2 +- OpenRA.Game/Graphics/WorldRenderer.cs | 14 ++--- OpenRA.Game/HotkeyDefinition.cs | 4 +- OpenRA.Game/HotkeyManager.cs | 6 +- OpenRA.Game/IUtilityCommand.cs | 8 +-- OpenRA.Game/Input/Hotkey.cs | 2 +- OpenRA.Game/Input/Keycode.cs | 2 +- OpenRA.Game/MPos.cs | 4 +- OpenRA.Game/Manifest.cs | 2 +- OpenRA.Game/Map/CellRegion.cs | 2 +- OpenRA.Game/Map/Map.cs | 8 +-- OpenRA.Game/Map/MapCache.cs | 12 ++-- OpenRA.Game/Map/MapDirectoryTracker.cs | 2 +- OpenRA.Game/Map/MapGrid.cs | 2 +- OpenRA.Game/Map/ProjectedCellRegion.cs | 2 +- OpenRA.Game/Map/TerrainInfo.cs | 2 +- OpenRA.Game/Network/Connection.cs | 16 ++--- OpenRA.Game/Network/GameSave.cs | 4 +- OpenRA.Game/Network/Nat.cs | 2 +- OpenRA.Game/Network/OrderIO.cs | 2 +- OpenRA.Game/Network/OrderManager.cs | 14 ++--- OpenRA.Game/Network/ReplayConnection.cs | 4 +- OpenRA.Game/Network/ReplayRecorder.cs | 2 +- OpenRA.Game/Network/Session.cs | 10 ++-- OpenRA.Game/Network/SyncReport.cs | 10 ++-- OpenRA.Game/ObjectCreator.cs | 2 +- OpenRA.Game/Primitives/ActionQueue.cs | 2 +- OpenRA.Game/Primitives/BitSet.cs | 2 +- OpenRA.Game/Primitives/LongBitSet.cs | 2 +- OpenRA.Game/Primitives/Polygon.cs | 2 +- .../Primitives/ReadOnlyAdapterStream.cs | 2 +- OpenRA.Game/Primitives/Rectangle.cs | 10 ++-- .../Primitives/SpatiallyPartitioned.cs | 2 +- OpenRA.Game/Primitives/TypeDictionary.cs | 2 +- OpenRA.Game/Primitives/float2.cs | 2 +- OpenRA.Game/Primitives/float3.cs | 6 +- OpenRA.Game/Primitives/int2.cs | 2 +- OpenRA.Game/Renderer.cs | 4 +- OpenRA.Game/Scripting/ScriptMemberExts.cs | 2 +- OpenRA.Game/Scripting/ScriptObjectWrapper.cs | 2 +- OpenRA.Game/Server/Connection.cs | 4 +- OpenRA.Game/Server/MapStatusCache.cs | 2 +- OpenRA.Game/Server/OrderBuffer.cs | 4 +- OpenRA.Game/Server/PlayerMessageTracker.cs | 2 +- OpenRA.Game/Server/Server.cs | 16 ++--- OpenRA.Game/Settings.cs | 22 +++---- OpenRA.Game/Sound/Sound.cs | 4 +- OpenRA.Game/Support/Arguments.cs | 4 +- OpenRA.Game/Support/AssemblyLoader.cs | 4 +- OpenRA.Game/Support/Benchmark.cs | 2 +- OpenRA.Game/Support/Evaluator.cs | 2 +- OpenRA.Game/Support/HttpClientFactory.cs | 2 +- OpenRA.Game/Support/HttpQueryBuilder.cs | 2 +- OpenRA.Game/Support/Log.cs | 4 +- OpenRA.Game/Support/PerfHistory.cs | 2 +- OpenRA.Game/Support/PerfTimer.cs | 2 +- OpenRA.Game/Support/VariableExpression.cs | 8 +-- OpenRA.Game/Sync.cs | 4 +- OpenRA.Game/TextNotificationsManager.cs | 4 +- OpenRA.Game/TraitDictionary.cs | 10 ++-- OpenRA.Game/Traits/Player/FrozenActorLayer.cs | 4 +- OpenRA.Game/Traits/Player/Shroud.cs | 2 +- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Game/Traits/World/Faction.cs | 2 +- OpenRA.Game/Traits/World/ScreenMap.cs | 6 +- OpenRA.Game/Traits/World/ScreenShaker.cs | 6 +- OpenRA.Game/WAngle.cs | 2 +- OpenRA.Game/WDist.cs | 4 +- OpenRA.Game/WPos.cs | 2 +- OpenRA.Game/WRot.cs | 2 +- OpenRA.Game/WVec.cs | 2 +- OpenRA.Game/Widgets/ChromeMetrics.cs | 2 +- OpenRA.Game/Widgets/Widget.cs | 10 ++-- OpenRA.Game/Widgets/WidgetLoader.cs | 2 +- OpenRA.Game/World.cs | 14 ++--- OpenRA.Game/WorldViewportSizes.cs | 8 +-- .../FileFormats/BlowfishKeyProvider.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/BigFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/MegFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/PackageEntry.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/Pak.cs | 2 +- .../Graphics/ClassicSpriteSequence.cs | 2 +- .../ClassicTilesetSpecificSpriteSequence.cs | 2 +- OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs | 2 +- .../Graphics/VoxelModelSequenceLoader.cs | 2 +- .../SpriteLoaders/ShpRemasteredLoader.cs | 4 +- OpenRA.Mods.Cnc/Traits/Attack/AttackLeap.cs | 2 +- OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs | 2 +- OpenRA.Mods.Cnc/Traits/Disguise.cs | 4 +- OpenRA.Mods.Cnc/Traits/GpsWatcher.cs | 4 +- .../Infiltration/InfiltrateForDecoration.cs | 2 +- OpenRA.Mods.Cnc/Traits/Minelayer.cs | 4 +- .../PaletteEffects/LightPaletteRotator.cs | 2 +- .../Traits/Render/WithBuildingBib.cs | 2 +- OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs | 4 +- .../Render/WithLandingCraftAnimation.cs | 2 +- .../Traits/SupportPowers/DropPodsPower.cs | 4 +- OpenRA.Mods.Cnc/Traits/TDGunboat.cs | 8 +-- .../Traits/World/JumpjetActorLayer.cs | 2 +- .../Traits/World/JumpjetLocomotor.cs | 2 +- .../Traits/World/TSEditorResourceLayer.cs | 2 +- .../Traits/World/TSResourceLayer.cs | 4 +- .../Traits/World/TSTiberiumRenderer.cs | 16 ++--- .../Traits/World/TSVeinsRenderer.cs | 10 ++-- .../ImportRedAlertLegacyMapCommand.cs | 2 +- .../UtilityCommands/ImportTSMapCommand.cs | 10 ++-- .../ImportTiberianDawnLegacyMapCommand.cs | 2 +- OpenRA.Mods.Common/Activities/Air/Fly.cs | 2 +- .../Activities/Move/MoveAdjacentTo.cs | 2 +- OpenRA.Mods.Common/Activities/Transform.cs | 2 +- .../EditorBrushes/EditorCopyPasteBrush.cs | 6 +- .../EditorBrushes/EditorResourceBrush.cs | 2 +- .../EditorBrushes/EditorTileBrush.cs | 4 +- OpenRA.Mods.Common/Effects/FloatingText.cs | 2 +- .../Effects/RallyPointIndicator.cs | 2 +- OpenRA.Mods.Common/FileFormats/Blast.cs | 6 +- OpenRA.Mods.Common/FileFormats/IniFile.cs | 6 +- .../InstallShieldCABCompression.cs | 2 +- .../FileSystem/InstallShieldPackage.cs | 2 +- .../Graphics/DefaultSpriteSequence.cs | 58 +++++++++---------- ...ometricSelectionBoxAnnotationRenderable.cs | 6 +- .../Graphics/TilesetSpecificSpriteSequence.cs | 2 +- OpenRA.Mods.Common/HitShapes/Capsule.cs | 2 +- OpenRA.Mods.Common/HitShapes/Circle.cs | 2 +- .../Lint/CheckTranslationReference.cs | 6 +- OpenRA.Mods.Common/ModContent.cs | 2 +- .../Pathfinder/CellInfoLayerPool.cs | 4 +- .../Pathfinder/HierarchicalPathFinder.cs | 2 +- OpenRA.Mods.Common/Pathfinder/PathSearch.cs | 2 +- OpenRA.Mods.Common/Projectiles/AreaBeam.cs | 4 +- OpenRA.Mods.Common/Projectiles/Bullet.cs | 6 +- OpenRA.Mods.Common/Projectiles/GravityBomb.cs | 2 +- OpenRA.Mods.Common/Projectiles/InstantHit.cs | 4 +- OpenRA.Mods.Common/Projectiles/LaserZap.cs | 4 +- OpenRA.Mods.Common/Projectiles/Missile.cs | 26 ++++----- OpenRA.Mods.Common/Projectiles/Railgun.cs | 10 ++-- .../Scripting/Global/AngleGlobal.cs | 14 ++--- OpenRA.Mods.Common/Scripting/LuaScript.cs | 2 +- .../ServerTraits/MasterServerPinger.cs | 4 +- OpenRA.Mods.Common/Terrain/DefaultTerrain.cs | 4 +- .../Terrain/DefaultTileCache.cs | 2 +- .../Traits/AcceptsDeliveredCash.cs | 2 +- .../Traits/AcceptsDeliveredExperience.cs | 2 +- OpenRA.Mods.Common/Traits/ActorSpawner.cs | 2 +- OpenRA.Mods.Common/Traits/AffectsShroud.cs | 2 +- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 14 ++--- OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs | 2 +- OpenRA.Mods.Common/Traits/AmmoPool.cs | 2 +- OpenRA.Mods.Common/Traits/Armament.cs | 4 +- .../Traits/Attack/AttackBase.cs | 2 +- OpenRA.Mods.Common/Traits/AutoTarget.cs | 2 +- .../Traits/AutoTargetPriority.cs | 2 +- .../Traits/BotModules/BaseBuilderBotModule.cs | 26 ++++----- .../BotModuleLogic/SupportPowerDecision.cs | 4 +- .../BotModules/CaptureManagerBotModule.cs | 6 +- .../Traits/BotModules/HarvesterBotModule.cs | 6 +- .../Traits/BotModules/McvManagerBotModule.cs | 6 +- .../BotModules/SquadManagerBotModule.cs | 18 +++--- .../BotModules/Squads/AttackOrFleeFuzzy.cs | 6 +- .../Traits/BotModules/Squads/Squad.cs | 2 +- .../BotModules/Squads/States/AirStates.cs | 2 +- .../BotModules/SupportPowerBotModule.cs | 8 +-- .../Traits/BotModules/UnitBuilderBotModule.cs | 4 +- OpenRA.Mods.Common/Traits/Buildable.cs | 2 +- .../Traits/Buildings/BridgeHut.cs | 6 +- .../Traits/Buildings/Building.cs | 4 +- OpenRA.Mods.Common/Traits/Buildings/Exit.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/Gate.cs | 4 +- .../Traits/Buildings/GivesBuildableArea.cs | 4 +- .../Traits/Buildings/LineBuild.cs | 2 +- .../Traits/Buildings/LineBuildNode.cs | 2 +- .../Traits/Buildings/ProductionAirdrop.cs | 2 +- .../Traits/Buildings/RepairableBuilding.cs | 4 +- .../Traits/Buildings/RequiresBuildableArea.cs | 2 +- .../Buildings/TransformsIntoAircraft.cs | 2 +- .../Traits/Buildings/TransformsIntoMobile.cs | 2 +- .../Buildings/TransformsIntoRepairable.cs | 2 +- .../Traits/CapturableProgressBar.cs | 2 +- .../Traits/CapturableProgressBlink.cs | 4 +- OpenRA.Mods.Common/Traits/CaptureManager.cs | 2 +- OpenRA.Mods.Common/Traits/Cargo.cs | 16 ++--- OpenRA.Mods.Common/Traits/Carryall.cs | 2 +- OpenRA.Mods.Common/Traits/Cloak.cs | 2 +- .../Traits/Conditions/ExternalCondition.cs | 4 +- .../Conditions/GrantConditionOnAttack.cs | 4 +- .../Conditions/GrantConditionOnDeploy.cs | 2 +- .../Conditions/GrantConditionOnFaction.cs | 2 +- .../Conditions/GrantConditionOnProduction.cs | 2 +- .../LineBuildSegmentExternalCondition.cs | 4 +- .../Conditions/ProximityExternalCondition.cs | 2 +- OpenRA.Mods.Common/Traits/Crates/Crate.cs | 2 +- .../Traits/Crates/DuplicateUnitCrateAction.cs | 4 +- .../Traits/Crates/GiveUnitCrateAction.cs | 4 +- .../GrantExternalConditionCrateAction.cs | 2 +- .../Traits/Crates/LevelUpCrateAction.cs | 2 +- OpenRA.Mods.Common/Traits/Crushable.cs | 2 +- OpenRA.Mods.Common/Traits/Demolishable.cs | 4 +- OpenRA.Mods.Common/Traits/DetectCloaked.cs | 2 +- OpenRA.Mods.Common/Traits/Encyclopedia.cs | 2 +- OpenRA.Mods.Common/Traits/GainsExperience.cs | 2 +- OpenRA.Mods.Common/Traits/GivesBounty.cs | 2 +- OpenRA.Mods.Common/Traits/Harvester.cs | 8 +-- OpenRA.Mods.Common/Traits/Husk.cs | 4 +- .../Traits/Infantry/ScaredyCat.cs | 2 +- .../Traits/Infantry/TakeCover.cs | 4 +- OpenRA.Mods.Common/Traits/Mobile.cs | 8 +-- .../Multipliers/ProductionCostMultiplier.cs | 2 +- .../Multipliers/ProductionTimeMultiplier.cs | 2 +- .../PaletteEffects/FlashPaletteEffect.cs | 2 +- .../GlobalLightingPaletteEffect.cs | 4 +- .../PaletteEffects/RotationPaletteEffect.cs | 8 +-- .../Traits/Palettes/IndexedPalette.cs | 2 +- .../Palettes/PaletteFromGimpOrJascFile.cs | 4 +- OpenRA.Mods.Common/Traits/Parachutable.cs | 2 +- OpenRA.Mods.Common/Traits/Passenger.cs | 2 +- .../GrantConditionOnPrerequisiteManager.cs | 2 +- .../Player/LobbyPrerequisiteCheckbox.cs | 4 +- .../Traits/Player/MissionObjectives.cs | 2 +- .../Traits/Player/ModularBot.cs | 2 +- .../Traits/Player/PlaceBuilding.cs | 2 +- .../Traits/Player/PlayerResources.cs | 2 +- .../Traits/Player/PlayerStatistics.cs | 6 +- .../Traits/Player/ProductionQueue.cs | 6 +- .../Traits/Player/ProvidesPrerequisite.cs | 2 +- OpenRA.Mods.Common/Traits/Player/TechTree.cs | 2 +- OpenRA.Mods.Common/Traits/Pluggable.cs | 4 +- .../Traits/Power/Player/PowerManager.cs | 2 +- .../Traits/ProximityCapturable.cs | 4 +- OpenRA.Mods.Common/Traits/Rearmable.cs | 4 +- OpenRA.Mods.Common/Traits/RejectsOrders.cs | 4 +- OpenRA.Mods.Common/Traits/Render/Contrail.cs | 2 +- .../Traits/Render/DrawLineToTarget.cs | 2 +- OpenRA.Mods.Common/Traits/Render/Hovers.cs | 4 +- .../Traits/Render/LeavesTrails.cs | 2 +- .../Render/ProductionIconOverlayManager.cs | 2 +- .../Traits/Render/RenderDetectionCircle.cs | 2 +- .../Traits/Render/RenderSprites.cs | 2 +- .../Traits/Render/RenderVoxels.cs | 4 +- .../Render/WithAircraftLandingEffect.cs | 4 +- .../Traits/Render/WithCargoPipsDecoration.cs | 2 +- .../Traits/Render/WithCrateBody.cs | 2 +- .../Traits/Render/WithDeathAnimation.cs | 2 +- .../Traits/Render/WithDecorationBase.cs | 4 +- .../Render/WithHarvesterPipsDecoration.cs | 2 +- .../Traits/Render/WithInfantryBody.cs | 2 +- .../Traits/Render/WithMuzzleOverlay.cs | 4 +- .../Traits/Render/WithParachute.cs | 4 +- .../Traits/Render/WithProductionOverlay.cs | 2 +- OpenRA.Mods.Common/Traits/Repairable.cs | 2 +- OpenRA.Mods.Common/Traits/RepairableNear.cs | 2 +- OpenRA.Mods.Common/Traits/Replaceable.cs | 2 +- OpenRA.Mods.Common/Traits/Replacement.cs | 2 +- .../Traits/RequiresSpecificOwners.cs | 2 +- OpenRA.Mods.Common/Traits/RevealOnDeath.cs | 2 +- OpenRA.Mods.Common/Traits/RevealOnFire.cs | 2 +- OpenRA.Mods.Common/Traits/ScriptTags.cs | 2 +- .../Traits/Sound/AmbientSound.cs | 2 +- .../Traits/SpawnActorsOnSell.cs | 2 +- .../Traits/SupportPowers/AirstrikePower.cs | 4 +- .../Traits/SupportPowers/NukePower.cs | 2 +- .../Traits/SupportPowers/ParatroopersPower.cs | 4 +- .../SupportPowers/SupportPowerManager.cs | 4 +- OpenRA.Mods.Common/Traits/ThrowsParticle.cs | 6 +- OpenRA.Mods.Common/Traits/Transforms.cs | 2 +- OpenRA.Mods.Common/Traits/Turreted.cs | 2 +- OpenRA.Mods.Common/Traits/Wanders.cs | 2 +- OpenRA.Mods.Common/Traits/World/ActorMap.cs | 22 +++---- .../Traits/World/ActorSpawnManager.cs | 2 +- .../Traits/World/ColorPickerManager.cs | 2 +- .../Traits/World/CrateSpawner.cs | 6 +- .../Traits/World/EditorActionManager.cs | 4 +- .../Traits/World/EditorActorLayer.cs | 4 +- .../Traits/World/EditorActorPreview.cs | 2 +- .../Traits/World/EditorCursorLayer.cs | 4 +- .../Traits/World/ElevatedBridgeLayer.cs | 2 +- .../Traits/World/LegacyBridgeLayer.cs | 2 +- OpenRA.Mods.Common/Traits/World/Locomotor.cs | 4 +- .../Traits/World/MapStartingLocations.cs | 4 +- .../Traits/World/MapStartingUnits.cs | 2 +- .../Traits/World/OrderEffects.cs | 2 +- OpenRA.Mods.Common/Traits/World/PathFinder.cs | 2 +- .../Traits/World/PathFinderOverlay.cs | 3 +- OpenRA.Mods.Common/Traits/World/RadarPings.cs | 2 +- .../Traits/World/ResourceClaimLayer.cs | 4 +- .../Traits/World/ResourceRenderer.cs | 6 +- OpenRA.Mods.Common/Traits/World/Selection.cs | 4 +- .../Traits/World/SmudgeLayer.cs | 6 +- .../Traits/World/SpawnMapActors.cs | 2 +- .../Traits/World/SubterraneanLocomotor.cs | 4 +- .../Traits/World/TerrainLighting.cs | 2 +- .../Traits/World/TerrainTunnelLayer.cs | 2 +- .../Traits/World/TimeLimitManager.cs | 2 +- .../Traits/World/WarheadDebugOverlay.cs | 2 +- .../Rules/20200503/AddPipDecorationTraits.cs | 12 ++-- .../ConvertSupportPowerRangesToFootprint.cs | 2 +- .../CreateFlashPaletteEffectWarhead.cs | 2 +- .../20200503/ModernizeDecorationTraits.cs | 4 +- .../Rules/20200503/MoveClassicFacingFudge.cs | 2 +- .../Rules/20200503/RemoveTurnToDock.cs | 2 +- .../Rules/20200503/ReplaceFacingAngles.cs | 4 +- .../20210321/RemovePlaceBuildingPalette.cs | 2 +- .../20210321/RemoveSmokeTrailWhenDamaged.cs | 2 +- .../Rules/20210321/ReplaceShadowPalette.cs | 2 +- .../ReplaceWithColoredOverlayPalette.cs | 2 +- .../Rules/20210321/UnhardcodeSquadManager.cs | 2 +- .../UnhardcodeVeteranProductionIconOverlay.cs | 2 +- .../20221203/ExplicitSequenceFilenames.cs | 4 +- .../RemoveSequenceHasEmbeddedPalette.cs | 2 +- .../Rules/CopyIsometricSelectableHeight.cs | 2 +- .../UtilityCommands/ExtractEmmyLuaAPI.cs | 2 +- .../UtilityCommands/ImportLegacyMapCommand.cs | 4 +- .../Warheads/CreateEffectWarhead.cs | 2 +- OpenRA.Mods.Common/Warheads/DamageWarhead.cs | 2 +- .../Warheads/DestroyResourceWarhead.cs | 2 +- .../Warheads/LeaveSmudgeWarhead.cs | 2 +- .../Warheads/ShakeScreenWarhead.cs | 2 +- .../Warheads/SpreadDamageWarhead.cs | 2 +- OpenRA.Mods.Common/Warheads/Warhead.cs | 4 +- OpenRA.Mods.Common/Widgets/ButtonWidget.cs | 2 +- OpenRA.Mods.Common/Widgets/CheckboxWidget.cs | 3 +- OpenRA.Mods.Common/Widgets/ImageWidget.cs | 2 +- .../Widgets/Logic/AssetBrowserLogic.cs | 2 +- .../Widgets/Logic/Editor/ActorEditLogic.cs | 4 +- .../Logic/Editor/CommonSelectorLogic.cs | 4 +- .../Widgets/Logic/Editor/HistoryLogLogic.cs | 2 +- .../Widgets/Logic/GameSaveBrowserLogic.cs | 2 +- .../Widgets/Logic/Ingame/IngameChatLogic.cs | 4 +- .../Widgets/Logic/Ingame/IngameMenuLogic.cs | 2 +- .../Ingame/ObserverShroudSelectorLogic.cs | 4 +- .../Logic/Ingame/ReplayControlBarLogic.cs | 2 +- .../Logic/Installation/ModContentLogic.cs | 4 +- .../Widgets/Logic/Lobby/LobbyLogic.cs | 8 +-- .../Widgets/Logic/MapChooserLogic.cs | 4 +- .../Widgets/Logic/ReplayBrowserLogic.cs | 6 +- .../Logic/Settings/HotkeysSettingsLogic.cs | 4 +- .../Widgets/Logic/Settings/SettingsLogic.cs | 8 +-- .../Widgets/LogicKeyListenerWidget.cs | 2 +- .../Widgets/ObserverArmyIconsWidget.cs | 4 +- .../Widgets/ObserverProductionIconsWidget.cs | 4 +- .../ObserverSupportPowerIconsWidget.cs | 4 +- .../Widgets/ProductionPaletteWidget.cs | 8 +-- .../Widgets/ProductionTabsWidget.cs | 6 +- .../Widgets/ProgressBarWidget.cs | 2 +- .../Widgets/ResourceBarWidget.cs | 4 +- .../Widgets/SupportPowersWidget.cs | 4 +- .../Widgets/TextNotificationsDisplayWidget.cs | 4 +- .../Widgets/TooltipContainerWidget.cs | 2 +- .../Widgets/VideoPlayerWidget.cs | 2 +- .../Widgets/ViewportControllerWidget.cs | 26 ++++----- .../PackageLoaders/D2kSoundResources.cs | 2 +- OpenRA.Mods.D2k/Traits/AttractsWorms.cs | 2 +- .../D2kActorPreviewPlaceBuildingPreview.cs | 2 +- OpenRA.Mods.D2k/Traits/SpiceBloom.cs | 2 +- .../Traits/World/BuildableTerrainLayer.cs | 2 +- .../Traits/World/D2kResourceRenderer.cs | 2 +- .../UtilityCommands/D2kMapImporter.cs | 4 +- OpenRA.Platforms.Default/FreeTypeFont.cs | 2 +- OpenRA.Platforms.Default/MultiTapDetection.cs | 4 +- OpenRA.Platforms.Default/OpenAlSoundEngine.cs | 4 +- OpenRA.Platforms.Default/OpenGL.cs | 8 +-- .../Sdl2PlatformWindow.cs | 2 +- OpenRA.Platforms.Default/Shader.cs | 8 +-- .../ThreadedGraphicsContext.cs | 10 ++-- 385 files changed, 790 insertions(+), 794 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5829347320..9c3da7f7aa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -169,7 +169,7 @@ dotnet_diagnostic.IDE0082.severity = warning # IDE0090 Simplify 'new' expression #csharp_style_implicit_object_creation_when_type_is_apparent = true -dotnet_diagnostic.IDE0090.severity = silent # Requires C# 9 - TODO Consider enabling +dotnet_diagnostic.IDE0090.severity = warning # IDE0180 Use tuple to swap values #csharp_style_prefer_tuple_swap = true diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 88762c1d49..c43e698778 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -84,21 +84,21 @@ namespace OpenRA class ConditionState { /// Delegates that have registered to be notified when this condition changes. - public readonly List Notifiers = new List(); + public readonly List Notifiers = new(); /// Unique integers identifying granted instances of the condition. - public readonly HashSet Tokens = new HashSet(); + public readonly HashSet Tokens = new(); } - readonly Dictionary conditionStates = new Dictionary(); + readonly Dictionary conditionStates = new(); /// Each granted condition receives a unique token that is used when revoking. - readonly Dictionary conditionTokens = new Dictionary(); + readonly Dictionary conditionTokens = new(); int nextConditionToken = 1; /// Cache of condition -> enabled state for quick evaluation of token counter conditions. - readonly Dictionary conditionCache = new Dictionary(); + readonly Dictionary conditionCache = new(); /// Read-only version of conditionCache that is passed to IConditionConsumers. readonly IReadOnlyDictionary readOnlyConditionCache; diff --git a/OpenRA.Game/CPos.cs b/OpenRA.Game/CPos.cs index 396c150810..3a2be3e763 100644 --- a/OpenRA.Game/CPos.cs +++ b/OpenRA.Game/CPos.cs @@ -41,7 +41,7 @@ namespace OpenRA Bits = (x & 0xFFF) << 20 | (y & 0xFFF) << 8 | layer; } - public static readonly CPos Zero = new CPos(0, 0, 0); + public static readonly CPos Zero = new(0, 0, 0); public static explicit operator CPos(int2 a) { return new CPos(a.X, a.Y); } diff --git a/OpenRA.Game/CVec.cs b/OpenRA.Game/CVec.cs index d4f13b5f04..e934870fd4 100644 --- a/OpenRA.Game/CVec.cs +++ b/OpenRA.Game/CVec.cs @@ -22,7 +22,7 @@ namespace OpenRA public readonly int X, Y; public CVec(int x, int y) { X = x; Y = y; } - public static readonly CVec Zero = new CVec(0, 0); + public static readonly CVec Zero = new(0, 0); public static CVec operator +(CVec a, CVec b) { return new CVec(a.X + b.X, a.Y + b.Y); } public static CVec operator -(CVec a, CVec b) { return new CVec(a.X - b.X, a.Y - b.Y); } diff --git a/OpenRA.Game/ExternalMods.cs b/OpenRA.Game/ExternalMods.cs index 6c8ecf1c15..8ef0b13c36 100644 --- a/OpenRA.Game/ExternalMods.cs +++ b/OpenRA.Game/ExternalMods.cs @@ -41,7 +41,7 @@ namespace OpenRA public class ExternalMods : IReadOnlyDictionary { - readonly Dictionary mods = new Dictionary(); + readonly Dictionary mods = new(); readonly SheetBuilder sheetBuilder; Sheet CreateSheet() diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 6b14cbdbaf..f7e68aebbb 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -62,14 +62,14 @@ namespace OpenRA throw new NotImplementedException($"FieldLoader: Missing field `{s}` on `{f.Name}`"); static readonly ConcurrentCache TypeLoadInfo = - new ConcurrentCache(BuildTypeLoadInfo); + new(BuildTypeLoadInfo); static readonly ConcurrentCache BooleanExpressionCache = - new ConcurrentCache(expression => new BooleanExpression(expression)); + new(expression => new BooleanExpression(expression)); static readonly ConcurrentCache IntegerExpressionCache = - new ConcurrentCache(expression => new IntegerExpression(expression)); + new(expression => new IntegerExpression(expression)); static readonly Dictionary> TypeParsers = - new Dictionary>() + new() { { typeof(int), ParseInt }, { typeof(ushort), ParseUShort }, @@ -103,7 +103,7 @@ namespace OpenRA }; static readonly Dictionary> GenericTypeParsers = - new Dictionary>() + new() { { typeof(HashSet<>), ParseHashSetOrList }, { typeof(List<>), ParseHashSetOrList }, @@ -749,7 +749,7 @@ namespace OpenRA [AttributeUsage(AttributeTargets.Field)] public class SerializeAttribute : Attribute { - public static readonly SerializeAttribute Default = new SerializeAttribute(true); + public static readonly SerializeAttribute Default = new(true); public bool IsDefault => this == Default; diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs index c91be945a8..ef69d7d2b9 100644 --- a/OpenRA.Game/FileFormats/Png.cs +++ b/OpenRA.Game/FileFormats/Png.cs @@ -31,7 +31,7 @@ namespace OpenRA.FileFormats public Color[] Palette { get; } public byte[] Data { get; } public SpriteFrameType Type { get; } - public Dictionary EmbeddedData = new Dictionary(); + public Dictionary EmbeddedData = new(); public int PixelStride => Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4; diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs index d08d13acfd..7ac45d0a8e 100644 --- a/OpenRA.Game/FileSystem/FileSystem.cs +++ b/OpenRA.Game/FileSystem/FileSystem.cs @@ -29,16 +29,16 @@ namespace OpenRA.FileSystem public class FileSystem : IReadOnlyFileSystem { public IEnumerable MountedPackages => mountedPackages.Keys; - readonly Dictionary mountedPackages = new Dictionary(); - readonly Dictionary explicitMounts = new Dictionary(); + readonly Dictionary mountedPackages = new(); + readonly Dictionary explicitMounts = new(); readonly string modID; // Mod packages that should not be disposed - readonly List modPackages = new List(); + readonly List modPackages = new(); readonly IReadOnlyDictionary installedMods; readonly IPackageLoader[] packageLoaders; - Cache> fileIndex = new Cache>(_ => new List()); + Cache> fileIndex = new(_ => new List()); public FileSystem(string modID, IReadOnlyDictionary installedMods, IPackageLoader[] packageLoaders) { diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index 60356b778c..cf6709f088 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -95,7 +95,7 @@ namespace OpenRA.FileSystem sealed class ReadWriteZipFile : ReadOnlyZipFile, IReadWritePackage { - readonly MemoryStream pkgStream = new MemoryStream(); + readonly MemoryStream pkgStream = new(); public ReadWriteZipFile(string filename, bool create = false) { diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 0f69d542f7..32a2d0b36d 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -48,7 +48,7 @@ namespace OpenRA internal static OrderManager OrderManager; static Server.Server server; - public static MersenneTwister CosmeticRandom = new MersenneTwister(); // not synced + public static MersenneTwister CosmeticRandom = new(); // not synced public static Renderer Renderer; public static Sound Sound; @@ -563,7 +563,7 @@ namespace OpenRA // Note: These delayed actions should only be used by widgets or disposing objects // - things that depend on a particular world should be queuing them on the world actor. - static volatile ActionQueue delayedActions = new ActionQueue(); + static volatile ActionQueue delayedActions = new(); public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); } public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); } diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index c41783eb3a..287deaa162 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -36,7 +36,7 @@ namespace OpenRA public TimeSpan Duration => EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero; public IList Players { get; } - public HashSet DisabledSpawnPoints = new HashSet(); + public HashSet DisabledSpawnPoints = new(); public MapPreview MapPreview => Game.ModData.MapCache[MapUid]; public IEnumerable HumanPlayers { get { return Players.Where(p => p.IsHuman); } } public bool IsSinglePlayer => HumanPlayers.Count() == 1; diff --git a/OpenRA.Game/GameRules/ActorInfo.cs b/OpenRA.Game/GameRules/ActorInfo.cs index 41d34fb36f..2a29f1a532 100644 --- a/OpenRA.Game/GameRules/ActorInfo.cs +++ b/OpenRA.Game/GameRules/ActorInfo.cs @@ -32,7 +32,7 @@ namespace OpenRA /// You can remove inherited traits by adding a - in front of them as in -TraitName: to inherit everything, but this trait. /// public readonly string Name; - readonly TypeDictionary traits = new TypeDictionary(); + readonly TypeDictionary traits = new(); List constructOrderCache = null; public ActorInfo(ObjectCreator creator, string name, MiniYaml node) diff --git a/OpenRA.Game/GameRules/SoundInfo.cs b/OpenRA.Game/GameRules/SoundInfo.cs index ae375f9bae..b42fd281f2 100644 --- a/OpenRA.Game/GameRules/SoundInfo.cs +++ b/OpenRA.Game/GameRules/SoundInfo.cs @@ -17,14 +17,14 @@ namespace OpenRA.GameRules { public class SoundInfo { - public readonly Dictionary Variants = new Dictionary(); - public readonly Dictionary Prefixes = new Dictionary(); - public readonly Dictionary Voices = new Dictionary(); - public readonly Dictionary Notifications = new Dictionary(); + public readonly Dictionary Variants = new(); + public readonly Dictionary Prefixes = new(); + public readonly Dictionary Voices = new(); + public readonly Dictionary Notifications = new(); public readonly string DefaultVariant = ".aud"; public readonly string DefaultPrefix = ""; - public readonly HashSet DisableVariants = new HashSet(); - public readonly HashSet DisablePrefixes = new HashSet(); + public readonly HashSet DisableVariants = new(); + public readonly HashSet DisablePrefixes = new(); public readonly Lazy> VoicePools; public readonly Lazy> NotificationsPools; @@ -69,7 +69,7 @@ namespace OpenRA.GameRules public readonly float VolumeModifier; public readonly InterruptType Type; readonly string[] clips; - readonly List liveclips = new List(); + readonly List liveclips = new(); public SoundPool(float volumeModifier, InterruptType interruptType, params string[] clips) { diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index cbbc97d071..5322c6de14 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -103,16 +103,16 @@ namespace OpenRA.GameRules public readonly bool CanTargetSelf = false; [Desc("What types of targets are affected.")] - public readonly BitSet ValidTargets = new BitSet("Ground", "Water"); + public readonly BitSet ValidTargets = new("Ground", "Water"); [Desc("What types of targets are unaffected.", "Overrules ValidTargets.")] public readonly BitSet InvalidTargets; - static readonly BitSet TargetTypeAir = new BitSet("Air"); + static readonly BitSet TargetTypeAir = new("Air"); [Desc("If weapon is not directly targeting an actor and targeted position is above this altitude,", "the weapon will ignore terrain target types and only check TargetTypeAir for validity.")] - public readonly WDist AirThreshold = new WDist(128); + public readonly WDist AirThreshold = new(128); [Desc("Delay in ticks between firing shots from the same ammo magazine. If one entry, it will be used for all bursts.", "If multiple entries, their number needs to match Burst - 1.")] @@ -128,7 +128,7 @@ namespace OpenRA.GameRules public readonly IProjectileInfo Projectile; [FieldLoader.LoadUsing(nameof(LoadWarheads))] - public readonly List Warheads = new List(); + public readonly List Warheads = new(); /// /// This constructor is used solely for documentation generation. diff --git a/OpenRA.Game/Graphics/ChromeProvider.cs b/OpenRA.Game/Graphics/ChromeProvider.cs index 8bb8a4a7e9..a4a132eb06 100644 --- a/OpenRA.Game/Graphics/ChromeProvider.cs +++ b/OpenRA.Game/Graphics/ChromeProvider.cs @@ -49,7 +49,7 @@ namespace OpenRA.Graphics public readonly int[] PanelRegion = null; public readonly PanelSides PanelSides = PanelSides.All; - public readonly Dictionary Regions = new Dictionary(); + public readonly Dictionary Regions = new(); } public static IReadOnlyDictionary Collections => collections; diff --git a/OpenRA.Game/Graphics/CursorManager.cs b/OpenRA.Game/Graphics/CursorManager.cs index 1976679204..425a2b33cf 100644 --- a/OpenRA.Game/Graphics/CursorManager.cs +++ b/OpenRA.Game/Graphics/CursorManager.cs @@ -28,7 +28,7 @@ namespace OpenRA.Graphics public IHardwareCursor[] Cursors; } - readonly Dictionary cursors = new Dictionary(); + readonly Dictionary cursors = new(); readonly SheetBuilder sheetBuilder; readonly GraphicSettings graphicSettings; diff --git a/OpenRA.Game/Graphics/HardwarePalette.cs b/OpenRA.Game/Graphics/HardwarePalette.cs index d39113edd9..b168258a19 100644 --- a/OpenRA.Game/Graphics/HardwarePalette.cs +++ b/OpenRA.Game/Graphics/HardwarePalette.cs @@ -21,9 +21,9 @@ namespace OpenRA.Graphics public ITexture ColorShifts { get; } public int Height { get; private set; } - readonly Dictionary palettes = new Dictionary(); - readonly Dictionary mutablePalettes = new Dictionary(); - readonly Dictionary indices = new Dictionary(); + readonly Dictionary palettes = new(); + readonly Dictionary mutablePalettes = new(); + readonly Dictionary indices = new(); byte[] buffer = Array.Empty(); float[] colorShiftBuffer = Array.Empty(); diff --git a/OpenRA.Game/Graphics/ModelRenderer.cs b/OpenRA.Game/Graphics/ModelRenderer.cs index 3d143e71b5..fd01ad8f5d 100644 --- a/OpenRA.Game/Graphics/ModelRenderer.cs +++ b/OpenRA.Game/Graphics/ModelRenderer.cs @@ -37,7 +37,7 @@ namespace OpenRA.Graphics // Static constants static readonly float[] ShadowDiffuse = new float[] { 0, 0, 0 }; static readonly float[] ShadowAmbient = new float[] { 1, 1, 1 }; - static readonly float2 SpritePadding = new float2(2, 2); + static readonly float2 SpritePadding = new(2, 2); static readonly float[] ZeroVector = new float[] { 0, 0, 0, 1 }; static readonly float[] ZVector = new float[] { 0, 0, 1, 1 }; static readonly float[] FlipMtx = Util.ScaleMatrix(1, -1, 1); @@ -47,9 +47,9 @@ namespace OpenRA.Graphics readonly Renderer renderer; readonly IShader shader; - readonly Dictionary mappedBuffers = new Dictionary(); - readonly Stack> unmappedBuffers = new Stack>(); - readonly List<(Sheet Sheet, Action Func)> doRender = new List<(Sheet, Action)>(); + readonly Dictionary mappedBuffers = new(); + readonly Stack> unmappedBuffers = new(); + readonly List<(Sheet Sheet, Action Func)> doRender = new(); SheetBuilder sheetBuilderForFrame; bool isInFrame; diff --git a/OpenRA.Game/Graphics/RgbaColorRenderer.cs b/OpenRA.Game/Graphics/RgbaColorRenderer.cs index 0b4c63d5d0..3c032e3ae2 100644 --- a/OpenRA.Game/Graphics/RgbaColorRenderer.cs +++ b/OpenRA.Game/Graphics/RgbaColorRenderer.cs @@ -18,7 +18,7 @@ namespace OpenRA.Graphics { public class RgbaColorRenderer { - static readonly float3 Offset = new float3(0.5f, 0.5f, 0f); + static readonly float3 Offset = new(0.5f, 0.5f, 0f); readonly SpriteRenderer parent; readonly Vertex[] vertices = new Vertex[6]; diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index 0c99b57cdc..c96bddaf0f 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -34,7 +34,7 @@ namespace OpenRA.Graphics public sealed class SheetBuilder : IDisposable { public readonly SheetType Type; - readonly List sheets = new List(); + readonly List sheets = new(); readonly Func allocateSheet; readonly int margin; int rowHeight = 0; diff --git a/OpenRA.Game/Graphics/SpriteCache.cs b/OpenRA.Game/Graphics/SpriteCache.cs index dc703d7458..bbe6bd3403 100644 --- a/OpenRA.Game/Graphics/SpriteCache.cs +++ b/OpenRA.Game/Graphics/SpriteCache.cs @@ -24,14 +24,14 @@ namespace OpenRA.Graphics readonly ISpriteLoader[] loaders; readonly IReadOnlyFileSystem fileSystem; - readonly Dictionary spriteReservations = new Dictionary(); - readonly Dictionary frameReservations = new Dictionary(); - readonly Dictionary> reservationsByFilename = new Dictionary>(); + readonly Dictionary spriteReservations = new(); + readonly Dictionary frameReservations = new(); + readonly Dictionary> reservationsByFilename = new(); - readonly Dictionary resolvedFrames = new Dictionary(); - readonly Dictionary resolvedSprites = new Dictionary(); + readonly Dictionary resolvedFrames = new(); + readonly Dictionary resolvedSprites = new(); - readonly Dictionary missingFiles = new Dictionary(); + readonly Dictionary missingFiles = new(); int nextReservationToken = 1; diff --git a/OpenRA.Game/Graphics/TerrainSpriteLayer.cs b/OpenRA.Game/Graphics/TerrainSpriteLayer.cs index 941285517e..29492f93d1 100644 --- a/OpenRA.Game/Graphics/TerrainSpriteLayer.cs +++ b/OpenRA.Game/Graphics/TerrainSpriteLayer.cs @@ -27,7 +27,7 @@ namespace OpenRA.Graphics readonly IVertexBuffer vertexBuffer; readonly Vertex[] vertices; readonly bool[] ignoreTint; - readonly HashSet dirtyRows = new HashSet(); + readonly HashSet dirtyRows = new(); readonly int rowStride; readonly bool restrictToBounds; diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index d51cc90671..f0787c1354 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -53,7 +53,7 @@ namespace OpenRA.Graphics public WPos CenterPosition => worldRenderer.ProjectedPosition(CenterLocation); - public Rectangle Rectangle => new Rectangle(TopLeft, new Size(viewportSize.X, viewportSize.Y)); + public Rectangle Rectangle => new(TopLeft, new Size(viewportSize.X, viewportSize.Y)); public int2 TopLeft => CenterLocation - viewportSize / 2; public int2 BottomRight => CenterLocation + viewportSize / 2; int2 viewportSize; diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index ae385670ee..a83b0ab1d1 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -31,19 +31,19 @@ namespace OpenRA.Graphics public event Action PaletteInvalidated = null; - readonly HashSet onScreenActors = new HashSet(); - readonly HardwarePalette palette = new HardwarePalette(); - readonly Dictionary palettes = new Dictionary(); + readonly HashSet onScreenActors = new(); + readonly HardwarePalette palette = new(); + readonly Dictionary palettes = new(); readonly IRenderTerrain terrainRenderer; readonly Lazy debugVis; readonly Func createPaletteReference; readonly bool enableDepthBuffer; - readonly List preparedRenderables = new List(); - readonly List preparedOverlayRenderables = new List(); - readonly List preparedAnnotationRenderables = new List(); + readonly List preparedRenderables = new(); + readonly List preparedOverlayRenderables = new(); + readonly List preparedAnnotationRenderables = new(); - readonly List renderablesBuffer = new List(); + readonly List renderablesBuffer = new(); internal WorldRenderer(ModData modData, World world) { diff --git a/OpenRA.Game/HotkeyDefinition.cs b/OpenRA.Game/HotkeyDefinition.cs index 974564a585..84eef05295 100644 --- a/OpenRA.Game/HotkeyDefinition.cs +++ b/OpenRA.Game/HotkeyDefinition.cs @@ -19,8 +19,8 @@ namespace OpenRA public readonly string Name; public readonly Hotkey Default = Hotkey.Invalid; public readonly string Description = ""; - public readonly HashSet Types = new HashSet(); - public readonly HashSet Contexts = new HashSet(); + public readonly HashSet Types = new(); + public readonly HashSet Contexts = new(); public readonly bool Readonly = false; public bool HasDuplicates { get; internal set; } diff --git a/OpenRA.Game/HotkeyManager.cs b/OpenRA.Game/HotkeyManager.cs index 770521b2c9..70ca85a545 100644 --- a/OpenRA.Game/HotkeyManager.cs +++ b/OpenRA.Game/HotkeyManager.cs @@ -18,8 +18,8 @@ namespace OpenRA public sealed class HotkeyManager { readonly Dictionary settings; - readonly Dictionary definitions = new Dictionary(); - readonly Dictionary keys = new Dictionary(); + readonly Dictionary definitions = new(); + readonly Dictionary keys = new(); public HotkeyManager(IReadOnlyFileSystem fileSystem, Dictionary settings, Manifest manifest) { @@ -102,7 +102,7 @@ namespace OpenRA return null; } - public HotkeyReference this[string name] => new HotkeyReference(GetHotkeyReference(name)); + public HotkeyReference this[string name] => new(GetHotkeyReference(name)); public IEnumerable Definitions => definitions.Values; } diff --git a/OpenRA.Game/IUtilityCommand.cs b/OpenRA.Game/IUtilityCommand.cs index 32667b98a9..6f46f37963 100644 --- a/OpenRA.Game/IUtilityCommand.cs +++ b/OpenRA.Game/IUtilityCommand.cs @@ -19,15 +19,13 @@ namespace OpenRA public class Utility { static readonly ConcurrentCache TypeFields = - new ConcurrentCache(type => type.GetFields()); + new(type => type.GetFields()); static readonly ConcurrentCache<(MemberInfo Member, Type AttributeType), bool> MemberHasAttribute = - new ConcurrentCache<(MemberInfo Member, Type AttributeType), bool>( - x => Attribute.IsDefined(x.Member, x.AttributeType)); + new(x => Attribute.IsDefined(x.Member, x.AttributeType)); static readonly ConcurrentCache<(MemberInfo Member, Type AttributeType, bool Inherit), object[]> MemberCustomAttributes = - new ConcurrentCache<(MemberInfo Member, Type AttributeType, bool Inherit), object[]>( - x => x.Member.GetCustomAttributes(x.AttributeType, x.Inherit)); + new(x => x.Member.GetCustomAttributes(x.AttributeType, x.Inherit)); public static FieldInfo[] GetFields(Type type) { diff --git a/OpenRA.Game/Input/Hotkey.cs b/OpenRA.Game/Input/Hotkey.cs index 995887847e..f7bf45b742 100644 --- a/OpenRA.Game/Input/Hotkey.cs +++ b/OpenRA.Game/Input/Hotkey.cs @@ -15,7 +15,7 @@ namespace OpenRA { public readonly struct Hotkey : IEquatable { - public static Hotkey Invalid = new Hotkey(Keycode.UNKNOWN, Modifiers.None); + public static Hotkey Invalid = new(Keycode.UNKNOWN, Modifiers.None); public bool IsValid() { return Key != Keycode.UNKNOWN; diff --git a/OpenRA.Game/Input/Keycode.cs b/OpenRA.Game/Input/Keycode.cs index db42098b1b..1ff8284492 100644 --- a/OpenRA.Game/Input/Keycode.cs +++ b/OpenRA.Game/Input/Keycode.cs @@ -256,7 +256,7 @@ namespace OpenRA public static class KeycodeExts { - static readonly Dictionary KeyNames = new Dictionary + static readonly Dictionary KeyNames = new() { { Keycode.UNKNOWN, "Undefined" }, { Keycode.RETURN, "Return" }, diff --git a/OpenRA.Game/MPos.cs b/OpenRA.Game/MPos.cs index 51f2701942..aa11754b72 100644 --- a/OpenRA.Game/MPos.cs +++ b/OpenRA.Game/MPos.cs @@ -19,7 +19,7 @@ namespace OpenRA public readonly int U, V; public MPos(int u, int v) { U = u; V = v; } - public static readonly MPos Zero = new MPos(0, 0); + public static readonly MPos Zero = new(0, 0); public static bool operator ==(MPos me, MPos other) { return me.U == other.U && me.V == other.V; } public static bool operator !=(MPos me, MPos other) { return !(me == other); } @@ -71,7 +71,7 @@ namespace OpenRA public readonly int U, V; public PPos(int u, int v) { U = u; V = v; } - public static readonly PPos Zero = new PPos(0, 0); + public static readonly PPos Zero = new(0, 0); public static bool operator ==(PPos me, PPos other) { return me.U == other.U && me.V == other.V; } public static bool operator !=(PPos me, PPos other) { return !(me == other); } diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index ae29309b29..01d8106164 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -95,7 +95,7 @@ namespace OpenRA "RequiresMods", "PackageFormats" }; - readonly TypeDictionary modules = new TypeDictionary(); + readonly TypeDictionary modules = new(); readonly Dictionary yaml; bool customDataLoaded; diff --git a/OpenRA.Game/Map/CellRegion.cs b/OpenRA.Game/Map/CellRegion.cs index 5d2433df78..0beeb5b811 100644 --- a/OpenRA.Game/Map/CellRegion.cs +++ b/OpenRA.Game/Map/CellRegion.cs @@ -102,7 +102,7 @@ namespace OpenRA return uv.U >= mapTopLeft.U && uv.U <= mapBottomRight.U && uv.V >= mapTopLeft.V && uv.V <= mapBottomRight.V; } - public MapCoordsRegion MapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight); + public MapCoordsRegion MapCoords => new(mapTopLeft, mapBottomRight); public CellRegionEnumerator GetEnumerator() { diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 7daedfec73..c25e7c108c 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -198,8 +198,8 @@ namespace OpenRA public int2 MapSize { get; private set; } // Player and actor yaml. Public for access by the map importers and lint checks. - public List PlayerDefinitions = new List(); - public List ActorDefinitions = new List(); + public List PlayerDefinitions = new(); + public List ActorDefinitions = new(); // Custom map yaml. Public for access by the map importers and lint checks public readonly MiniYaml RuleDefinitions; @@ -210,7 +210,7 @@ namespace OpenRA public readonly MiniYaml MusicDefinitions; public readonly MiniYaml NotificationDefinitions; - public readonly Dictionary ReplacedInvalidTerrainTiles = new Dictionary(); + public readonly Dictionary ReplacedInvalidTerrainTiles = new(); // Generated data public readonly MapGrid Grid; @@ -997,7 +997,7 @@ namespace OpenRA /// /// RectangularIsometric defines 1024 units along the diagonal axis, /// giving a half-tile height step of sqrt(2) * 512 - public WDist CellHeightStep => new WDist(Grid.Type == MapGridType.RectangularIsometric ? 724 : 512); + public WDist CellHeightStep => new(Grid.Type == MapGridType.RectangularIsometric ? 724 : 512); public CPos CellContaining(WPos pos) { diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 064cdfec1d..c76de9e229 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -25,9 +25,9 @@ namespace OpenRA { public sealed class MapCache : IEnumerable, IDisposable { - public static readonly MapPreview UnknownMap = new MapPreview(null, null, MapGridType.Rectangular, null); + public static readonly MapPreview UnknownMap = new(null, null, MapGridType.Rectangular, null); public IReadOnlyDictionary MapLocations => mapLocations; - readonly Dictionary mapLocations = new Dictionary(); + readonly Dictionary mapLocations = new(); public bool LoadPreviewImages = true; readonly Cache previews; @@ -35,18 +35,18 @@ namespace OpenRA readonly SheetBuilder sheetBuilder; Thread previewLoaderThread; bool previewLoaderThreadShutDown = true; - readonly object syncRoot = new object(); - readonly Queue generateMinimap = new Queue(); + readonly object syncRoot = new(); + readonly Queue generateMinimap = new(); public Dictionary StringPool { get; } = new Dictionary(); - readonly List mapDirectoryTrackers = new List(); + readonly List mapDirectoryTrackers = new(); /// /// The most recently modified or loaded map at runtime. /// public string LastModifiedMap { get; private set; } = null; - readonly Dictionary mapUpdates = new Dictionary(); + readonly Dictionary mapUpdates = new(); string lastLoadedLastModifiedMap; diff --git a/OpenRA.Game/Map/MapDirectoryTracker.cs b/OpenRA.Game/Map/MapDirectoryTracker.cs index 0137f1ed96..ea579960dc 100644 --- a/OpenRA.Game/Map/MapDirectoryTracker.cs +++ b/OpenRA.Game/Map/MapDirectoryTracker.cs @@ -25,7 +25,7 @@ namespace OpenRA readonly MapClassification classification; enum MapAction { Add, Delete, Update } - readonly Dictionary mapActionQueue = new Dictionary(); + readonly Dictionary mapActionQueue = new(); bool dirty = false; diff --git a/OpenRA.Game/Map/MapGrid.cs b/OpenRA.Game/Map/MapGrid.cs index 5af9ff279d..24e38090be 100644 --- a/OpenRA.Game/Map/MapGrid.cs +++ b/OpenRA.Game/Map/MapGrid.cs @@ -106,7 +106,7 @@ namespace OpenRA public class MapGrid : IGlobalModData { public readonly MapGridType Type = MapGridType.Rectangular; - public readonly Size TileSize = new Size(24, 24); + public readonly Size TileSize = new(24, 24); public readonly byte MaximumTerrainHeight = 0; public readonly SubCell DefaultSubCell = (SubCell)byte.MaxValue; diff --git a/OpenRA.Game/Map/ProjectedCellRegion.cs b/OpenRA.Game/Map/ProjectedCellRegion.cs index e484e4b984..8978fda7fe 100644 --- a/OpenRA.Game/Map/ProjectedCellRegion.cs +++ b/OpenRA.Game/Map/ProjectedCellRegion.cs @@ -59,7 +59,7 @@ namespace OpenRA /// this does not validate whether individual map cells are actually /// projected inside the region. /// - public MapCoordsRegion CandidateMapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight); + public MapCoordsRegion CandidateMapCoords => new(mapTopLeft, mapBottomRight); public ProjectedCellRegionEnumerator GetEnumerator() { diff --git a/OpenRA.Game/Map/TerrainInfo.cs b/OpenRA.Game/Map/TerrainInfo.cs index 3081e9a327..e1ccc343b6 100644 --- a/OpenRA.Game/Map/TerrainInfo.cs +++ b/OpenRA.Game/Map/TerrainInfo.cs @@ -60,7 +60,7 @@ namespace OpenRA { public readonly string Type; public readonly BitSet TargetTypes; - public readonly HashSet AcceptsSmudgeType = new HashSet(); + public readonly HashSet AcceptsSmudgeType = new(); public readonly Color Color; public readonly bool RestrictPlayerColor = false; diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index 67fc236955..d37429b346 100644 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -42,9 +42,9 @@ namespace OpenRA.Network public sealed class EchoConnection : IConnection { const int LocalClientId = 1; - readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sync = new Queue<(int, int, ulong)>(); - readonly Queue<(int Frame, OrderPacket Orders)> orders = new Queue<(int, OrderPacket)>(); - readonly Queue immediateOrders = new Queue(); + readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sync = new(); + readonly Queue<(int Frame, OrderPacket Orders)> orders = new(); + readonly Queue immediateOrders = new(); bool disposed; int IConnection.LocalClientId => LocalClientId; @@ -100,12 +100,12 @@ namespace OpenRA.Network { public readonly ConnectionTarget Target; internal ReplayRecorder Recorder { get; private set; } - readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sentSync = new Queue<(int, int, ulong)>(); - readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> queuedSyncPackets = new Queue<(int, int, ulong)>(); + readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sentSync = new(); + readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> queuedSyncPackets = new(); - readonly Queue<(int Frame, OrderPacket Orders)> sentOrders = new Queue<(int, OrderPacket)>(); - readonly Queue sentImmediateOrders = new Queue(); - readonly ConcurrentQueue<(int FromClient, byte[] Data)> receivedPackets = new ConcurrentQueue<(int, byte[])>(); + readonly Queue<(int Frame, OrderPacket Orders)> sentOrders = new(); + readonly Queue sentImmediateOrders = new(); + readonly ConcurrentQueue<(int FromClient, byte[] Data)> receivedPackets = new(); TcpClient tcp; volatile ConnectionState connectionState = ConnectionState.Connecting; volatile int clientId; diff --git a/OpenRA.Game/Network/GameSave.cs b/OpenRA.Game/Network/GameSave.cs index 6873052ee7..016cb91128 100644 --- a/OpenRA.Game/Network/GameSave.cs +++ b/OpenRA.Game/Network/GameSave.cs @@ -81,7 +81,7 @@ namespace OpenRA.Network public const int MetadataMarker = -1; public const int TraitDataMarker = -3; - readonly MemoryStream ordersStream = new MemoryStream(); + readonly MemoryStream ordersStream = new(); // Loaded from file and updated during gameplay public int LastOrdersFrame { get; private set; } @@ -92,7 +92,7 @@ namespace OpenRA.Network public Session.Global GlobalSettings { get; private set; } public Dictionary Slots { get; private set; } public Dictionary SlotClients { get; private set; } - public Dictionary TraitData = new Dictionary(); + public Dictionary TraitData = new(); // Set on game start int[] clientsBySlotIndex = Array.Empty(); diff --git a/OpenRA.Game/Network/Nat.cs b/OpenRA.Game/Network/Nat.cs index 610ba1eaf9..8358b05cc3 100644 --- a/OpenRA.Game/Network/Nat.cs +++ b/OpenRA.Game/Network/Nat.cs @@ -39,7 +39,7 @@ namespace OpenRA.Network initialized = true; } - static readonly SemaphoreSlim Locker = new SemaphoreSlim(1, 1); + static readonly SemaphoreSlim Locker = new(1, 1); static async void DeviceFound(object sender, DeviceEventArgs args) { diff --git a/OpenRA.Game/Network/OrderIO.cs b/OpenRA.Game/Network/OrderIO.cs index ac4ad7ca11..dee56ab733 100644 --- a/OpenRA.Game/Network/OrderIO.cs +++ b/OpenRA.Game/Network/OrderIO.cs @@ -78,7 +78,7 @@ namespace OpenRA.Network public static class OrderIO { - static readonly OrderPacket NoOrders = new OrderPacket(Array.Empty()); + static readonly OrderPacket NoOrders = new(Array.Empty()); public static byte[] SerializeSync((int Frame, int SyncHash, ulong DefeatState) data) { diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index aa7687f6e2..0bce45df07 100644 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -23,10 +23,10 @@ namespace OpenRA.Network const OrderPacket ClientDisconnected = null; readonly SyncReport syncReport; - readonly Dictionary> pendingOrders = new Dictionary>(); - readonly Dictionary syncForFrame = new Dictionary(); + readonly Dictionary> pendingOrders = new(); + readonly Dictionary syncForFrame = new(); - public Session LobbyInfo = new Session(); + public Session LobbyInfo = new(); /// Null when watching a replay. public Session.Client LocalClient => LobbyInfo.ClientWithIndex(Connection.LocalClientId); @@ -47,11 +47,11 @@ namespace OpenRA.Network internal int GameSaveLastFrame = -1; internal int GameSaveLastSyncFrame = -1; - readonly List localOrders = new List(); - readonly List localImmediateOrders = new List(); + readonly List localOrders = new(); + readonly List localImmediateOrders = new(); - readonly List processClientOrders = new List(); - readonly List processClientsToRemove = new List(); + readonly List processClientOrders = new(); + readonly List processClientsToRemove = new(); bool disposed; bool generateSyncReport = false; diff --git a/OpenRA.Game/Network/ReplayConnection.cs b/OpenRA.Game/Network/ReplayConnection.cs index 228323d592..38d0b20eb5 100644 --- a/OpenRA.Game/Network/ReplayConnection.cs +++ b/OpenRA.Game/Network/ReplayConnection.cs @@ -24,8 +24,8 @@ namespace OpenRA.Network public (int ClientId, byte[] Packet)[] Packets; } - readonly Queue chunks = new Queue(); - readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sync = new Queue<(int, int, ulong)>(); + readonly Queue chunks = new(); + readonly Queue<(int Frame, int SyncHash, ulong DefeatState)> sync = new(); readonly int orderLatency; public readonly int TickCount; diff --git a/OpenRA.Game/Network/ReplayRecorder.cs b/OpenRA.Game/Network/ReplayRecorder.cs index 5ab26daafb..b8949ea5cc 100644 --- a/OpenRA.Game/Network/ReplayRecorder.cs +++ b/OpenRA.Game/Network/ReplayRecorder.cs @@ -24,7 +24,7 @@ namespace OpenRA.Network public ReplayMetadata Metadata; BinaryWriter writer; readonly Func chooseFilename; - MemoryStream preStartBuffer = new MemoryStream(); + MemoryStream preStartBuffer = new(); static bool IsGameStart(byte[] data) { diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index 551b1c91b9..8e30a6b265 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -20,14 +20,14 @@ namespace OpenRA.Network { public class Session { - public List Clients = new List(); + public List Clients = new(); // Keyed by the PlayerReference id that the slot corresponds to - public Dictionary Slots = new Dictionary(); + public Dictionary Slots = new(); - public HashSet DisabledSpawnPoints = new HashSet(); + public HashSet DisabledSpawnPoints = new(); - public Global GlobalSettings = new Global(); + public Global GlobalSettings = new(); public static string AnonymizeIP(IPAddress ip) { @@ -221,7 +221,7 @@ namespace OpenRA.Network public int NetFrameInterval = 3; [FieldLoader.Ignore] - public Dictionary LobbyOptions = new Dictionary(); + public Dictionary LobbyOptions = new(); public static Global Deserialize(MiniYaml data) { diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index eb7be5f125..4f0520fdcb 100644 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -22,7 +22,7 @@ namespace OpenRA.Network class SyncReport { const int NumSyncReports = 7; - static readonly Cache TypeInfoCache = new Cache(t => new TypeInfo(t)); + static readonly Cache TypeInfoCache = new(t => new TypeInfo(t)); readonly OrderManager orderManager; @@ -166,9 +166,9 @@ namespace OpenRA.Network public int Frame; public int SyncedRandom; public int TotalCount; - public readonly List Traits = new List(); - public readonly List Effects = new List(); - public readonly List Orders = new List(); + public readonly List Traits = new(); + public readonly List Effects = new(); + public readonly List Orders = new(); } struct TraitReport @@ -278,7 +278,7 @@ namespace OpenRA.Network /// struct Values { - static readonly object Sentinel = new object(); + static readonly object Sentinel = new(); object item1OrArray; object item2OrSentinel; diff --git a/OpenRA.Game/ObjectCreator.cs b/OpenRA.Game/ObjectCreator.cs index 9c7d4e3d56..a4d9ef2124 100644 --- a/OpenRA.Game/ObjectCreator.cs +++ b/OpenRA.Game/ObjectCreator.cs @@ -22,7 +22,7 @@ namespace OpenRA { // .NET does not support unloading assemblies, so mod libraries will leak across mod changes. // This tracks the assemblies that have been loaded since game start so that we don't load multiple copies - static readonly Dictionary ResolvedAssemblies = new Dictionary(); + static readonly Dictionary ResolvedAssemblies = new(); readonly Cache typeCache; readonly Cache ctorCache; diff --git a/OpenRA.Game/Primitives/ActionQueue.cs b/OpenRA.Game/Primitives/ActionQueue.cs index 5778c9cc6e..2f9337de49 100644 --- a/OpenRA.Game/Primitives/ActionQueue.cs +++ b/OpenRA.Game/Primitives/ActionQueue.cs @@ -19,7 +19,7 @@ namespace OpenRA.Primitives /// public class ActionQueue { - readonly List actions = new List(); + readonly List actions = new(); public void Add(Action a, long desiredTime) { diff --git a/OpenRA.Game/Primitives/BitSet.cs b/OpenRA.Game/Primitives/BitSet.cs index 2be8a97b17..bd7d2ff77e 100644 --- a/OpenRA.Game/Primitives/BitSet.cs +++ b/OpenRA.Game/Primitives/BitSet.cs @@ -18,7 +18,7 @@ namespace OpenRA.Primitives { static class BitSetAllocator where T : class { - static readonly Cache Bits = new Cache(Allocate); + static readonly Cache Bits = new(Allocate); static BitSetIndex nextBits = 1; static BitSetIndex Allocate(string value) diff --git a/OpenRA.Game/Primitives/LongBitSet.cs b/OpenRA.Game/Primitives/LongBitSet.cs index a1fe2a55b7..8395c1bb40 100644 --- a/OpenRA.Game/Primitives/LongBitSet.cs +++ b/OpenRA.Game/Primitives/LongBitSet.cs @@ -17,7 +17,7 @@ namespace OpenRA.Primitives { static class LongBitSetAllocator where T : class { - static readonly Cache Bits = new Cache(Allocate); + static readonly Cache Bits = new(Allocate); static long nextBits = 1; static long Allocate(string value) diff --git a/OpenRA.Game/Primitives/Polygon.cs b/OpenRA.Game/Primitives/Polygon.cs index fc39d889fe..9a370c1994 100644 --- a/OpenRA.Game/Primitives/Polygon.cs +++ b/OpenRA.Game/Primitives/Polygon.cs @@ -16,7 +16,7 @@ namespace OpenRA.Primitives { public readonly struct Polygon { - public static readonly Polygon Empty = new Polygon(Rectangle.Empty); + public static readonly Polygon Empty = new(Rectangle.Empty); public readonly Rectangle BoundingRect; public readonly int2[] Vertices; diff --git a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs index 85144f6eaa..c8f2f39817 100644 --- a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs +++ b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs @@ -21,7 +21,7 @@ namespace OpenRA.Primitives /// public abstract class ReadOnlyAdapterStream : Stream { - readonly Queue data = new Queue(1024); + readonly Queue data = new(1024); readonly Stream baseStream; bool baseStreamEmpty; diff --git a/OpenRA.Game/Primitives/Rectangle.cs b/OpenRA.Game/Primitives/Rectangle.cs index 37eec0e5bf..884c6eb69b 100644 --- a/OpenRA.Game/Primitives/Rectangle.cs +++ b/OpenRA.Game/Primitives/Rectangle.cs @@ -63,13 +63,13 @@ namespace OpenRA.Primitives public int Top => Y; public int Bottom => Y + Height; public bool IsEmpty => X == 0 && Y == 0 && Width == 0 && Height == 0; - public int2 Location => new int2(X, Y); - public Size Size => new Size(Width, Height); + public int2 Location => new(X, Y); + public Size Size => new(Width, Height); public int2 TopLeft => Location; - public int2 TopRight => new int2(X + Width, Y); - public int2 BottomLeft => new int2(X, Y + Height); - public int2 BottomRight => new int2(X + Width, Y + Height); + public int2 TopRight => new(X + Width, Y); + public int2 BottomLeft => new(X, Y + Height); + public int2 BottomRight => new(X + Width, Y + Height); public bool Contains(int x, int y) { diff --git a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs index 92a17a05d2..6c414da5ed 100644 --- a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs +++ b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs @@ -18,7 +18,7 @@ namespace OpenRA.Primitives { readonly int rows, cols, binSize; readonly Dictionary[] itemBoundsBins; - readonly Dictionary itemBounds = new Dictionary(); + readonly Dictionary itemBounds = new(); readonly Action, T, Rectangle> addItem = (bin, actor, bounds) => bin.Add(actor, bounds); readonly Action, T, Rectangle> removeItem = (bin, actor, bounds) => bin.Remove(actor); diff --git a/OpenRA.Game/Primitives/TypeDictionary.cs b/OpenRA.Game/Primitives/TypeDictionary.cs index b7e62d2f1a..f200fc45b9 100644 --- a/OpenRA.Game/Primitives/TypeDictionary.cs +++ b/OpenRA.Game/Primitives/TypeDictionary.cs @@ -19,7 +19,7 @@ namespace OpenRA.Primitives public class TypeDictionary : IEnumerable { static readonly Func> CreateList = type => new List(); - readonly Dictionary> data = new Dictionary>(); + readonly Dictionary> data = new(); public void Add(object val) { diff --git a/OpenRA.Game/Primitives/float2.cs b/OpenRA.Game/Primitives/float2.cs index edaa0f45e5..1a26d9be6f 100644 --- a/OpenRA.Game/Primitives/float2.cs +++ b/OpenRA.Game/Primitives/float2.cs @@ -76,7 +76,7 @@ namespace OpenRA public override string ToString() { return X + "," + Y; } - public static readonly float2 Zero = new float2(0, 0); + public static readonly float2 Zero = new(0, 0); public static bool WithinEpsilon(float2 a, float2 b, float e) { diff --git a/OpenRA.Game/Primitives/float3.cs b/OpenRA.Game/Primitives/float3.cs index ef329076b5..184c42fe19 100644 --- a/OpenRA.Game/Primitives/float3.cs +++ b/OpenRA.Game/Primitives/float3.cs @@ -20,7 +20,7 @@ namespace OpenRA public readonly struct float3 : IEquatable { public readonly float X, Y, Z; - public float2 XY => new float2(X, Y); + public float2 XY => new(X, Y); public float3(float x, float y, float z) { X = x; Y = y; Z = z; } public float3(float2 xy, float z) { X = xy.X; Y = xy.Y; Z = z; } @@ -60,7 +60,7 @@ namespace OpenRA public override string ToString() { return $"{X},{Y},{Z}"; } - public static readonly float3 Zero = new float3(0, 0, 0); - public static readonly float3 Ones = new float3(1, 1, 1); + public static readonly float3 Zero = new(0, 0, 0); + public static readonly float3 Ones = new(1, 1, 1); } } diff --git a/OpenRA.Game/Primitives/int2.cs b/OpenRA.Game/Primitives/int2.cs index e1f86655c1..716f341036 100644 --- a/OpenRA.Game/Primitives/int2.cs +++ b/OpenRA.Game/Primitives/int2.cs @@ -59,7 +59,7 @@ namespace OpenRA public static int2 Max(int2 a, int2 b) { return new int2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y)); } public static int2 Min(int2 a, int2 b) { return new int2(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y)); } - public static readonly int2 Zero = new int2(0, 0); + public static readonly int2 Zero = new(0, 0); public float2 ToFloat2() { return new float2(X, Y); } // Change endianness of a uint32 diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 35e16e3eec..1ebacc8898 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -44,7 +44,7 @@ namespace OpenRA internal int TempBufferSize { get; } readonly IVertexBuffer tempBuffer; - readonly Stack scissorState = new Stack(); + readonly Stack scissorState = new(); IFrameBuffer screenBuffer; Sprite screenSprite; @@ -63,7 +63,7 @@ namespace OpenRA float depthMargin; - Size lastBufferSize = new Size(-1, -1); + Size lastBufferSize = new(-1, -1); Rectangle lastWorldViewport = Rectangle.Empty; ITexture currentPaletteTexture; diff --git a/OpenRA.Game/Scripting/ScriptMemberExts.cs b/OpenRA.Game/Scripting/ScriptMemberExts.cs index bed06d1fc1..44f8a9bcda 100644 --- a/OpenRA.Game/Scripting/ScriptMemberExts.cs +++ b/OpenRA.Game/Scripting/ScriptMemberExts.cs @@ -18,7 +18,7 @@ namespace OpenRA.Scripting { public static class ScriptMemberExts { - static readonly Dictionary LuaTypeNameReplacements = new Dictionary() + static readonly Dictionary LuaTypeNameReplacements = new() { { "Void", "void" }, { "Int32", "int" }, diff --git a/OpenRA.Game/Scripting/ScriptObjectWrapper.cs b/OpenRA.Game/Scripting/ScriptObjectWrapper.cs index 52573cc1f5..4b1153c504 100644 --- a/OpenRA.Game/Scripting/ScriptObjectWrapper.cs +++ b/OpenRA.Game/Scripting/ScriptObjectWrapper.cs @@ -22,7 +22,7 @@ namespace OpenRA.Scripting protected abstract string MemberNotFoundError(string memberName); protected readonly ScriptContext Context; - readonly Dictionary members = new Dictionary(); + readonly Dictionary members = new(); #if !NET5_0_OR_GREATER readonly List membersToRemove = new List(); diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index 8f34d63f08..f6d052cd4a 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -41,8 +41,8 @@ namespace OpenRA.Server long lastReceivedTime = 0; - readonly BlockingCollection sendQueue = new BlockingCollection(); - readonly Queue pingHistory = new Queue(); + readonly BlockingCollection sendQueue = new(); + readonly Queue pingHistory = new(); public Connection(Server server, Socket socket, string authToken) { diff --git a/OpenRA.Game/Server/MapStatusCache.cs b/OpenRA.Game/Server/MapStatusCache.cs index b49aa92aaf..ea93cc492e 100644 --- a/OpenRA.Game/Server/MapStatusCache.cs +++ b/OpenRA.Game/Server/MapStatusCache.cs @@ -20,7 +20,7 @@ namespace OpenRA.Server public class MapStatusCache { - readonly Dictionary cache = new Dictionary(); + readonly Dictionary cache = new(); readonly Action onStatusChanged; readonly bool enableRemoteLinting; readonly ModData modData; diff --git a/OpenRA.Game/Server/OrderBuffer.cs b/OpenRA.Game/Server/OrderBuffer.cs index 5d86994f79..068a27dc2b 100644 --- a/OpenRA.Game/Server/OrderBuffer.cs +++ b/OpenRA.Game/Server/OrderBuffer.cs @@ -31,8 +31,8 @@ namespace OpenRA.Server Stopwatch gameTimer; long nextUpdate = 0; - readonly ConcurrentDictionary timestamps = new ConcurrentDictionary(); - readonly ConcurrentDictionary> deltas = new ConcurrentDictionary>(); + readonly ConcurrentDictionary timestamps = new(); + readonly ConcurrentDictionary> deltas = new(); int timestep; int ticksPerInterval; diff --git a/OpenRA.Game/Server/PlayerMessageTracker.cs b/OpenRA.Game/Server/PlayerMessageTracker.cs index 2014cc1c15..309955aa07 100644 --- a/OpenRA.Game/Server/PlayerMessageTracker.cs +++ b/OpenRA.Game/Server/PlayerMessageTracker.cs @@ -19,7 +19,7 @@ namespace OpenRA.Server [TranslationReference("remaining")] const string ChatTemporaryDisabled = "notification-chat-temp-disabled"; - readonly Dictionary> messageTracker = new Dictionary>(); + readonly Dictionary> messageTracker = new(); readonly Server server; readonly Action dispatchOrdersToClient; readonly Action> sendLocalizedMessageTo; diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 2694b2ee67..71cfb5ab3b 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -115,15 +115,15 @@ namespace OpenRA.Server [TranslationReference] const string GameStarted = "notification-game-started"; - public readonly MersenneTwister Random = new MersenneTwister(); + public readonly MersenneTwister Random = new(); public readonly ServerType Type; - public readonly List Conns = new List(); + public readonly List Conns = new(); public Session LobbyInfo; public ServerSettings Settings; public ModData ModData; - public List TempBans = new List(); + public List TempBans = new(); // Managed by LobbyCommands public MapPreview Map; @@ -134,19 +134,19 @@ namespace OpenRA.Server public int OrderLatency = 1; readonly int randomSeed; - readonly List listeners = new List(); - readonly TypeDictionary serverTraits = new TypeDictionary(); + readonly List listeners = new(); + readonly TypeDictionary serverTraits = new(); readonly PlayerDatabase playerDatabase; OrderBuffer orderBuffer; volatile ServerState internalState = ServerState.WaitingPlayers; - readonly BlockingCollection events = new BlockingCollection(); + readonly BlockingCollection events = new(); ReplayRecorder recorder; GameInformation gameInfo; - readonly List worldPlayers = new List(); + readonly List worldPlayers = new(); readonly Stopwatch pingUpdated = Stopwatch.StartNew(); readonly PlayerMessageTracker playerMessageTracker; @@ -802,7 +802,7 @@ namespace OpenRA.Server recorder = null; } - readonly Dictionary syncForFrame = new Dictionary(); + readonly Dictionary syncForFrame = new(); int lastDefeatStateFrame; ulong lastDefeatState; diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index 87948fea30..4abdcb7335 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -177,10 +177,10 @@ namespace OpenRA public bool VSync = true; [Desc("Screen resolution in fullscreen mode.")] - public int2 FullscreenSize = new int2(0, 0); + public int2 FullscreenSize = new(0, 0); [Desc("Screen resolution in windowed mode.")] - public int2 WindowedSize = new int2(1024, 768); + public int2 WindowedSize = new(1024, 768); public bool CursorDouble = false; public WorldViewport ViewportDistance = WorldViewport.Medium; @@ -253,7 +253,7 @@ namespace OpenRA public bool LockMouseWindow = false; public MouseScrollType MouseScroll = MouseScrollType.Joystick; - public MouseButtonPreference MouseButtonPreference = new MouseButtonPreference(); + public MouseButtonPreference MouseButtonPreference = new(); public float ViewportEdgeScrollStep = 30f; public float UIScrollSpeed = 50f; public float ZoomSpeed = 0.04f; @@ -295,20 +295,20 @@ namespace OpenRA { readonly string settingsFile; - public readonly PlayerSettings Player = new PlayerSettings(); - public readonly GameSettings Game = new GameSettings(); - public readonly SoundSettings Sound = new SoundSettings(); - public readonly GraphicSettings Graphics = new GraphicSettings(); - public readonly ServerSettings Server = new ServerSettings(); - public readonly DebugSettings Debug = new DebugSettings(); - internal Dictionary Keys = new Dictionary(); + public readonly PlayerSettings Player = new(); + public readonly GameSettings Game = new(); + public readonly SoundSettings Sound = new(); + public readonly GraphicSettings Graphics = new(); + public readonly ServerSettings Server = new(); + public readonly DebugSettings Debug = new(); + internal Dictionary Keys = new(); public readonly Dictionary Sections; // A direct clone of the file loaded from disk. // Any changed settings will be merged over this on save, // allowing us to persist any unknown configuration keys - readonly List yamlCache = new List(); + readonly List yamlCache = new(); public Settings(string file, Arguments args) { diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 0ee4fbff09..53a0ff52d1 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -43,8 +43,8 @@ namespace OpenRA ISoundSource videoSource; ISound music; ISound video; - readonly Dictionary currentSounds = new Dictionary(); - readonly Dictionary currentNotifications = new Dictionary(); + readonly Dictionary currentSounds = new(); + readonly Dictionary currentNotifications = new(); public bool DummyEngine { get; } public Sound(IPlatform platform, SoundSettings soundSettings) diff --git a/OpenRA.Game/Support/Arguments.cs b/OpenRA.Game/Support/Arguments.cs index 0dc486175b..a72cd2f2d5 100644 --- a/OpenRA.Game/Support/Arguments.cs +++ b/OpenRA.Game/Support/Arguments.cs @@ -16,9 +16,9 @@ namespace OpenRA { public class Arguments { - readonly Dictionary args = new Dictionary(); + readonly Dictionary args = new(); - public static Arguments Empty => new Arguments(); + public static Arguments Empty => new(); public Arguments(params string[] src) { diff --git a/OpenRA.Game/Support/AssemblyLoader.cs b/OpenRA.Game/Support/AssemblyLoader.cs index 08a8b2fbd4..d876b2ec87 100644 --- a/OpenRA.Game/Support/AssemblyLoader.cs +++ b/OpenRA.Game/Support/AssemblyLoader.cs @@ -53,8 +53,8 @@ namespace OpenRA.Support public class AssemblyLoadContextBuilder { - readonly Dictionary managedLibraries = new Dictionary(StringComparer.Ordinal); - readonly Dictionary nativeLibraries = new Dictionary(StringComparer.Ordinal); + readonly Dictionary managedLibraries = new(StringComparer.Ordinal); + readonly Dictionary nativeLibraries = new(StringComparer.Ordinal); string basePath; public AssemblyLoadContext Build() diff --git a/OpenRA.Game/Support/Benchmark.cs b/OpenRA.Game/Support/Benchmark.cs index 6620ea0de4..ad23ea1636 100644 --- a/OpenRA.Game/Support/Benchmark.cs +++ b/OpenRA.Game/Support/Benchmark.cs @@ -16,7 +16,7 @@ namespace OpenRA.Support class Benchmark { readonly string prefix; - readonly Dictionary> samples = new Dictionary>(); + readonly Dictionary> samples = new(); public Benchmark(string prefix) { diff --git a/OpenRA.Game/Support/Evaluator.cs b/OpenRA.Game/Support/Evaluator.cs index af5c159d9d..cd4143a667 100644 --- a/OpenRA.Game/Support/Evaluator.cs +++ b/OpenRA.Game/Support/Evaluator.cs @@ -80,7 +80,7 @@ namespace OpenRA.Support } static readonly Dictionary Prec - = new Dictionary { { "+", 0 }, { "-", 0 }, { "*", 1 }, { "/", 1 }, { "(", -1 } }; + = new() { { "+", 0 }, { "-", 0 }, { "*", 1 }, { "/", 1 }, { "(", -1 } }; static IEnumerable Tokens(string expr, string ops) { diff --git a/OpenRA.Game/Support/HttpClientFactory.cs b/OpenRA.Game/Support/HttpClientFactory.cs index a2444cdc3a..d947d7ad34 100644 --- a/OpenRA.Game/Support/HttpClientFactory.cs +++ b/OpenRA.Game/Support/HttpClientFactory.cs @@ -21,7 +21,7 @@ namespace OpenRA.Support static readonly TimeSpan ConnectionLifeTime = TimeSpan.FromMinutes(1); #endif - static readonly Lazy Handler = new Lazy(GetHandler); + static readonly Lazy Handler = new(GetHandler); public static HttpClient Create() { diff --git a/OpenRA.Game/Support/HttpQueryBuilder.cs b/OpenRA.Game/Support/HttpQueryBuilder.cs index b921c41f61..8c1016fb3d 100644 --- a/OpenRA.Game/Support/HttpQueryBuilder.cs +++ b/OpenRA.Game/Support/HttpQueryBuilder.cs @@ -19,7 +19,7 @@ namespace OpenRA.Support public class HttpQueryBuilder : IEnumerable { readonly string url; - readonly List parameters = new List(); + readonly List parameters = new(); public HttpQueryBuilder(string url) { diff --git a/OpenRA.Game/Support/Log.cs b/OpenRA.Game/Support/Log.cs index c58997eebb..3e99807e5c 100644 --- a/OpenRA.Game/Support/Log.cs +++ b/OpenRA.Game/Support/Log.cs @@ -41,10 +41,10 @@ namespace OpenRA { const int CreateLogFileMaxRetryCount = 128; - static readonly ConcurrentDictionary Channels = new ConcurrentDictionary(); + static readonly ConcurrentDictionary Channels = new(); static readonly Channel Channel; static readonly ChannelWriter ChannelWriter; - static readonly CancellationTokenSource CancellationToken = new CancellationTokenSource(); + static readonly CancellationTokenSource CancellationToken = new(); static readonly TimeSpan FlushInterval = TimeSpan.FromSeconds(5); static readonly Timer Timer; diff --git a/OpenRA.Game/Support/PerfHistory.cs b/OpenRA.Game/Support/PerfHistory.cs index e2cc0bd0e3..0d6a774e69 100644 --- a/OpenRA.Game/Support/PerfHistory.cs +++ b/OpenRA.Game/Support/PerfHistory.cs @@ -28,7 +28,7 @@ namespace OpenRA.Support static int nextColor; - public static Cache Items = new Cache( + public static Cache Items = new( s => { var x = new PerfItem(s, Colors[nextColor++]); diff --git a/OpenRA.Game/Support/PerfTimer.cs b/OpenRA.Game/Support/PerfTimer.cs index ddaaeccbe8..29351370fa 100644 --- a/OpenRA.Game/Support/PerfTimer.cs +++ b/OpenRA.Game/Support/PerfTimer.cs @@ -31,7 +31,7 @@ namespace OpenRA.Support List children; long ticks; - static readonly ThreadLocal ParentThreadLocal = new ThreadLocal(); + static readonly ThreadLocal ParentThreadLocal = new(); public PerfTimer(string name, float thresholdMs = 0) { diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index 77db5a97ea..ec2065db16 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -24,7 +24,7 @@ namespace OpenRA.Support public static readonly IReadOnlyDictionary NoVariables = new ReadOnlyDictionary(new Dictionary()); public readonly string Expression; - readonly HashSet variables = new HashSet(); + readonly HashSet variables = new(); public IEnumerable Variables => variables; enum CharClass { Whitespace, Operator, Mixed, Id, Digit } @@ -716,8 +716,8 @@ namespace OpenRA.Support class AstStack { - readonly List expressions = new List(); - readonly List types = new List(); + readonly List expressions = new(); + readonly List types = new(); public ExpressionType PeekType() { return types[^1]; } @@ -774,7 +774,7 @@ namespace OpenRA.Support class Compiler { - readonly AstStack ast = new AstStack(); + readonly AstStack ast = new(); public Expression Build(Token[] postfix, ExpressionType resultType) { diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs index a0fd64b930..4d9dd8bd6f 100644 --- a/OpenRA.Game/Sync.cs +++ b/OpenRA.Game/Sync.cs @@ -28,7 +28,7 @@ namespace OpenRA public static class Sync { static readonly ConcurrentCache> HashFunctions = - new ConcurrentCache>(GenerateHashFunc); + new(GenerateHashFunc); internal static Func GetHashFunction(ISync sync) { @@ -40,7 +40,7 @@ namespace OpenRA return GetHashFunction(sync)(sync); } - static readonly Dictionary CustomHashFunctions = new Dictionary() + static readonly Dictionary CustomHashFunctions = new() { { typeof(int2), ((Func)HashInt2).Method }, { typeof(CPos), ((Func)HashCPos).Method }, diff --git a/OpenRA.Game/TextNotificationsManager.cs b/OpenRA.Game/TextNotificationsManager.cs index bfbb6e2e2d..192c813c88 100644 --- a/OpenRA.Game/TextNotificationsManager.cs +++ b/OpenRA.Game/TextNotificationsManager.cs @@ -21,9 +21,9 @@ namespace OpenRA static readonly string SystemMessageLabel; public static long ChatDisabledUntil { get; internal set; } - public static readonly Dictionary MutedPlayers = new Dictionary(); + public static readonly Dictionary MutedPlayers = new(); - static readonly List NotificationsCache = new List(); + static readonly List NotificationsCache = new(); public static IReadOnlyList Notifications => NotificationsCache; static TextNotificationsManager() diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index d84bba5472..137e615bb5 100644 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -44,7 +44,7 @@ namespace OpenRA static readonly Func CreateTraitContainer = t => (ITraitContainer)typeof(TraitContainer<>).MakeGenericType(t).GetConstructor(Type.EmptyTypes).Invoke(null); - readonly Dictionary traits = new Dictionary(); + readonly Dictionary traits = new(); ITraitContainer InnerGet(Type t) { @@ -143,9 +143,9 @@ namespace OpenRA class TraitContainer : ITraitContainer { - readonly List actors = new List(); - readonly List traits = new List(); - readonly PerfTickLogger perfLogger = new PerfTickLogger(); + readonly List actors = new(); + readonly List traits = new(); + readonly PerfTickLogger perfLogger = new(); public int Queries { get; private set; } @@ -277,7 +277,7 @@ namespace OpenRA public void Reset() { index = -1; } public bool MoveNext() { return ++index < actors.Count; } - public TraitPair Current => new TraitPair(actors[index], traits[index]); + public TraitPair Current => new(actors[index], traits[index]); object System.Collections.IEnumerator.Current => Current; public void Dispose() { } } diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index 6c3b1358a2..e9cdc99367 100644 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -39,7 +39,7 @@ namespace OpenRA.Traits readonly Actor actor; readonly ICreatesFrozenActors frozenTrait; readonly Shroud shroud; - readonly List targetablePositions = new List(); + readonly List targetablePositions = new(); public Player Viewer { get; } public Player Owner { get; private set; } @@ -253,7 +253,7 @@ namespace OpenRA.Traits readonly Player owner; readonly Dictionary frozenActorsById; readonly SpatiallyPartitioned partitionedFrozenActorIds; - readonly HashSet dirtyFrozenActorIds = new HashSet(); + readonly HashSet dirtyFrozenActorIds = new(); public FrozenActorLayer(Actor self, FrozenActorLayerInfo info) { diff --git a/OpenRA.Game/Traits/Player/Shroud.cs b/OpenRA.Game/Traits/Player/Shroud.cs index e4fed9614f..0936f9d764 100644 --- a/OpenRA.Game/Traits/Player/Shroud.cs +++ b/OpenRA.Game/Traits/Player/Shroud.cs @@ -98,7 +98,7 @@ namespace OpenRA.Traits readonly Map map; // Individual shroud modifier sources (type and area) - readonly Dictionary sources = new Dictionary(); + readonly Dictionary sources = new(); // Per-cell count of each source type, used to resolve the final cell type readonly ProjectedCellLayer passiveVisibleCount; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index c80bae7af7..accc30818b 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -563,7 +563,7 @@ namespace OpenRA.Traits public class LobbyBooleanOption : LobbyOption { - static readonly Dictionary BoolValues = new Dictionary() + static readonly Dictionary BoolValues = new() { { true.ToString(), "Enabled" }, { false.ToString(), "Disabled" } diff --git a/OpenRA.Game/Traits/World/Faction.cs b/OpenRA.Game/Traits/World/Faction.cs index 9a7cb01a53..950985d1d4 100644 --- a/OpenRA.Game/Traits/World/Faction.cs +++ b/OpenRA.Game/Traits/World/Faction.cs @@ -24,7 +24,7 @@ namespace OpenRA.Traits public readonly string InternalName = null; [Desc("Pick a random faction as the player's faction out of this list.")] - public readonly HashSet RandomFactionMembers = new HashSet(); + public readonly HashSet RandomFactionMembers = new(); [Desc("The side that the faction belongs to. For example, England belongs to the 'Allies' side.")] public readonly string Side = null; diff --git a/OpenRA.Game/Traits/World/ScreenMap.cs b/OpenRA.Game/Traits/World/ScreenMap.cs index 52852354ce..34a445846f 100644 --- a/OpenRA.Game/Traits/World/ScreenMap.cs +++ b/OpenRA.Game/Traits/World/ScreenMap.cs @@ -47,15 +47,15 @@ namespace OpenRA.Traits readonly Func selectActorAndBounds; readonly Cache> partitionedMouseFrozenActors; readonly SpatiallyPartitioned partitionedMouseActors; - readonly Dictionary partitionedMouseActorBounds = new Dictionary(); + readonly Dictionary partitionedMouseActorBounds = new(); readonly Cache> partitionedRenderableFrozenActors; readonly SpatiallyPartitioned partitionedRenderableActors; readonly SpatiallyPartitioned partitionedRenderableEffects; // Updates are done in one pass to ensure all bound changes have been applied - readonly HashSet addOrUpdateActors = new HashSet(); - readonly HashSet removeActors = new HashSet(); + readonly HashSet addOrUpdateActors = new(); + readonly HashSet removeActors = new(); readonly Cache> addOrUpdateFrozenActors; readonly Cache> removeFrozenActors; diff --git a/OpenRA.Game/Traits/World/ScreenShaker.cs b/OpenRA.Game/Traits/World/ScreenShaker.cs index 5e7d2e6f19..9b17b36911 100644 --- a/OpenRA.Game/Traits/World/ScreenShaker.cs +++ b/OpenRA.Game/Traits/World/ScreenShaker.cs @@ -19,8 +19,8 @@ namespace OpenRA.Traits [TraitLocation(SystemActors.World)] public class ScreenShakerInfo : TraitInfo { - public readonly float2 MinMultiplier = new float2(-3, -3); - public readonly float2 MaxMultiplier = new float2(3, 3); + public readonly float2 MinMultiplier = new(-3, -3); + public readonly float2 MaxMultiplier = new(3, 3); public override object Create(ActorInitializer init) { return new ScreenShaker(this); } } @@ -29,7 +29,7 @@ namespace OpenRA.Traits { readonly ScreenShakerInfo info; WorldRenderer worldRenderer; - readonly List shakeEffects = new List(); + readonly List shakeEffects = new(); int ticks = 0; public ScreenShaker(ScreenShakerInfo info) diff --git a/OpenRA.Game/WAngle.cs b/OpenRA.Game/WAngle.cs index f9c9105c11..b284852251 100644 --- a/OpenRA.Game/WAngle.cs +++ b/OpenRA.Game/WAngle.cs @@ -31,7 +31,7 @@ namespace OpenRA Angle += 1024; } - public static readonly WAngle Zero = new WAngle(0); + public static readonly WAngle Zero = new(0); public static WAngle FromFacing(int facing) { return new WAngle(facing * 4); } public static WAngle FromDegrees(int degrees) { return new WAngle(degrees * 1024 / 360); } public static WAngle operator +(WAngle a, WAngle b) { return new WAngle(a.Angle + b.Angle); } diff --git a/OpenRA.Game/WDist.cs b/OpenRA.Game/WDist.cs index 8156c006ff..845c60a490 100644 --- a/OpenRA.Game/WDist.cs +++ b/OpenRA.Game/WDist.cs @@ -27,8 +27,8 @@ namespace OpenRA public long LengthSquared => (long)Length * Length; public WDist(int r) { Length = r; } - public static readonly WDist Zero = new WDist(0); - public static readonly WDist MaxValue = new WDist(int.MaxValue); + public static readonly WDist Zero = new(0); + public static readonly WDist MaxValue = new(int.MaxValue); public static WDist FromCells(int cells) { return new WDist(1024 * cells); } public static WDist operator +(WDist a, WDist b) { return new WDist(a.Length + b.Length); } diff --git a/OpenRA.Game/WPos.cs b/OpenRA.Game/WPos.cs index 1464e608fc..d96b4d182b 100644 --- a/OpenRA.Game/WPos.cs +++ b/OpenRA.Game/WPos.cs @@ -25,7 +25,7 @@ namespace OpenRA public WPos(int x, int y, int z) { X = x; Y = y; Z = z; } public WPos(WDist x, WDist y, WDist z) { X = x.Length; Y = y.Length; Z = z.Length; } - public static readonly WPos Zero = new WPos(0, 0, 0); + public static readonly WPos Zero = new(0, 0, 0); public static explicit operator WVec(in WPos a) { return new WVec(a.X, a.Y, a.Z); } diff --git a/OpenRA.Game/WRot.cs b/OpenRA.Game/WRot.cs index 113a21fd39..338196e2ea 100644 --- a/OpenRA.Game/WRot.cs +++ b/OpenRA.Game/WRot.cs @@ -105,7 +105,7 @@ namespace OpenRA Yaw = yaw; } - public static readonly WRot None = new WRot(WAngle.Zero, WAngle.Zero, WAngle.Zero); + public static readonly WRot None = new(WAngle.Zero, WAngle.Zero, WAngle.Zero); public static WRot FromFacing(int facing) { return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)); } public static WRot FromYaw(WAngle yaw) { return new WRot(WAngle.Zero, WAngle.Zero, yaw); } diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs index 7e0006bdf8..ab9de7152d 100644 --- a/OpenRA.Game/WVec.cs +++ b/OpenRA.Game/WVec.cs @@ -24,7 +24,7 @@ namespace OpenRA public WVec(int x, int y, int z) { X = x; Y = y; Z = z; } public WVec(WDist x, WDist y, WDist z) { X = x.Length; Y = y.Length; Z = z.Length; } - public static readonly WVec Zero = new WVec(0, 0, 0); + public static readonly WVec Zero = new(0, 0, 0); public static WVec operator +(in WVec a, in WVec b) { return new WVec(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } public static WVec operator -(in WVec a, in WVec b) { return new WVec(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } diff --git a/OpenRA.Game/Widgets/ChromeMetrics.cs b/OpenRA.Game/Widgets/ChromeMetrics.cs index b218566857..9770b4eb0c 100644 --- a/OpenRA.Game/Widgets/ChromeMetrics.cs +++ b/OpenRA.Game/Widgets/ChromeMetrics.cs @@ -16,7 +16,7 @@ namespace OpenRA.Widgets { public static class ChromeMetrics { - static Dictionary data = new Dictionary(); + static Dictionary data = new(); public static void Initialize(ModData modData) { diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 1c9fafefcd..60f41a0eb1 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -25,15 +25,15 @@ namespace OpenRA.Widgets public static Widget Root = new ContainerWidget(); - public static TickTime LastTickTime = new TickTime(() => Timestep, Game.RunTime); + public static TickTime LastTickTime = new(() => Timestep, Game.RunTime); - static readonly Stack WindowList = new Stack(); + static readonly Stack WindowList = new(); public static Widget MouseFocusWidget; public static Widget KeyboardFocusWidget; public static Widget MouseOverWidget; - static readonly Mediator Mediator = new Mediator(); + static readonly Mediator Mediator = new(); public static void CloseWindow() { @@ -185,7 +185,7 @@ namespace OpenRA.Widgets { string defaultCursor = null; - public readonly List Children = new List(); + public readonly List Children = new(); // Info defined in YAML public string Id = null; @@ -644,7 +644,7 @@ namespace OpenRA.Widgets public sealed class Mediator { - readonly TypeDictionary types = new TypeDictionary(); + readonly TypeDictionary types = new(); public void Subscribe(T instance) { diff --git a/OpenRA.Game/Widgets/WidgetLoader.cs b/OpenRA.Game/Widgets/WidgetLoader.cs index 3222b3e76d..af402b5363 100644 --- a/OpenRA.Game/Widgets/WidgetLoader.cs +++ b/OpenRA.Game/Widgets/WidgetLoader.cs @@ -18,7 +18,7 @@ namespace OpenRA { public class WidgetLoader { - readonly Dictionary widgets = new Dictionary(); + readonly Dictionary widgets = new(); readonly ModData modData; public WidgetLoader(ModData modData) diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 6e184a5328..0661ab31a7 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -28,15 +28,15 @@ namespace OpenRA public sealed class World : IDisposable { - internal readonly TraitDictionary TraitDict = new TraitDictionary(); - readonly SortedDictionary actors = new SortedDictionary(); - readonly List effects = new List(); - readonly List unpartitionedEffects = new List(); - readonly List syncedEffects = new List(); + internal readonly TraitDictionary TraitDict = new(); + readonly SortedDictionary actors = new(); + readonly List effects = new(); + readonly List unpartitionedEffects = new(); + readonly List syncedEffects = new(); readonly GameSettings gameSettings; readonly ModData modData; - readonly Queue> frameEndActions = new Queue>(); + readonly Queue> frameEndActions = new(); public readonly GameSpeed GameSpeed; @@ -390,7 +390,7 @@ namespace OpenRA public int WorldTick { get; private set; } - readonly Dictionary gameSaveTraitData = new Dictionary(); + readonly Dictionary gameSaveTraitData = new(); internal void AddGameSaveTraitData(int traitIndex, MiniYaml yaml) { gameSaveTraitData[traitIndex] = yaml; diff --git a/OpenRA.Game/WorldViewportSizes.cs b/OpenRA.Game/WorldViewportSizes.cs index b998223a29..2922dda1d9 100644 --- a/OpenRA.Game/WorldViewportSizes.cs +++ b/OpenRA.Game/WorldViewportSizes.cs @@ -15,16 +15,16 @@ namespace OpenRA { public class WorldViewportSizes : IGlobalModData { - public readonly int2 CloseWindowHeights = new int2(480, 600); - public readonly int2 MediumWindowHeights = new int2(600, 900); - public readonly int2 FarWindowHeights = new int2(900, 1300); + public readonly int2 CloseWindowHeights = new(480, 600); + public readonly int2 MediumWindowHeights = new(600, 900); + public readonly int2 FarWindowHeights = new(900, 1300); public readonly float DefaultScale = 1.0f; public readonly float MaxZoomScale = 2.0f; public readonly int MaxZoomWindowHeight = 240; public readonly bool AllowNativeZoom = true; - public readonly Size MinEffectiveResolution = new Size(1024, 720); + public readonly Size MinEffectiveResolution = new(1024, 720); public int2 GetSizeRange(WorldViewport distance) { diff --git a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs index 6fabcc9449..9bb84795be 100644 --- a/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs +++ b/OpenRA.Mods.Cnc/FileFormats/BlowfishKeyProvider.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.FileFormats public uint Len; } - readonly PublicKey pubkey = new PublicKey(); + readonly PublicKey pubkey = new(); readonly uint[] globOne = new uint[64]; uint globOneBitLen, globOneLenXTwo; diff --git a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs index 87ff94dc38..21f6550826 100644 --- a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.FileSystem public string Name { get; } public IEnumerable Contents => index.Keys; - readonly Dictionary index = new Dictionary(); + readonly Dictionary index = new(); readonly Stream s; public BigFile(Stream s, string filename) diff --git a/OpenRA.Mods.Cnc/FileSystem/MegFile.cs b/OpenRA.Mods.Cnc/FileSystem/MegFile.cs index 3519023458..2f444a05aa 100644 --- a/OpenRA.Mods.Cnc/FileSystem/MegFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/MegFile.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.FileSystem { readonly Stream s; - readonly Dictionary contents = new Dictionary(); + readonly Dictionary contents = new(); public MegFile(Stream s, string filename) { diff --git a/OpenRA.Mods.Cnc/FileSystem/PackageEntry.cs b/OpenRA.Mods.Cnc/FileSystem/PackageEntry.cs index b40645c9d5..7a64139a74 100644 --- a/OpenRA.Mods.Cnc/FileSystem/PackageEntry.cs +++ b/OpenRA.Mods.Cnc/FileSystem/PackageEntry.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Cnc.FileSystem } } - static readonly Dictionary Names = new Dictionary(); + static readonly Dictionary Names = new(); public static void AddStandardName(string s) { diff --git a/OpenRA.Mods.Cnc/FileSystem/Pak.cs b/OpenRA.Mods.Cnc/FileSystem/Pak.cs index f6eac7312e..2c2bc0ef8a 100644 --- a/OpenRA.Mods.Cnc/FileSystem/Pak.cs +++ b/OpenRA.Mods.Cnc/FileSystem/Pak.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.FileSystem public string Name { get; } public IEnumerable Contents => index.Keys; - readonly Dictionary index = new Dictionary(); + readonly Dictionary index = new(); readonly Stream stream; public PakFile(Stream stream, string filename) diff --git a/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs b/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs index a80ccae5b4..2117a3b777 100644 --- a/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs +++ b/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Graphics public class ClassicSpriteSequence : DefaultSpriteSequence { [Desc("Incorporate a compensation factor for the rotational distortion present in the first-generation Westwood games.")] - static readonly SpriteSequenceField UseClassicFacings = new SpriteSequenceField(nameof(UseClassicFacings), false); + static readonly SpriteSequenceField UseClassicFacings = new(nameof(UseClassicFacings), false); readonly bool useClassicFacings; public ClassicSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults) diff --git a/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs b/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs index b29e0d8671..b0ed9dcc0d 100644 --- a/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs +++ b/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Graphics public class ClassicTilesetSpecificSpriteSequence : ClassicSpriteSequence { [Desc("Dictionary of : filename to override the Filename key.")] - static readonly SpriteSequenceField> TilesetFilenames = new SpriteSequenceField>(nameof(TilesetFilenames), null); + static readonly SpriteSequenceField> TilesetFilenames = new(nameof(TilesetFilenames), null); public ClassicTilesetSpecificSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults) : base(cache, loader, image, sequence, data, defaults) { } diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs index 3f2f6739a8..52ad36a8b6 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Graphics { static readonly float[] ChannelSelect = { 0.75f, 0.25f, -0.25f, -0.75f }; - readonly List vertices = new List(); + readonly List vertices = new(); readonly Cache<(string, string), Voxel> voxels; readonly IReadOnlyFileSystem fileSystem; IVertexBuffer vertexBuffer; diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs index 98969d16f5..e128d579e7 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.Graphics public class VoxelModelCache : IModelCache { readonly VoxelLoader loader; - readonly Dictionary> models = new Dictionary>(); + readonly Dictionary> models = new(); public VoxelModelCache(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs index 648942bd32..3a0cda88e7 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs @@ -48,8 +48,8 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders public class ShpRemasteredSprite { - static readonly Regex FilenameRegex = new Regex(@"^(?.+?[\-_])(?\d{4})\.tga$"); - static readonly Regex MetaRegex = new Regex(@"^\{""size"":\[(?\d+),(?\d+)\],""crop"":\[(?\d+),(?\d+),(?\d+),(?\d+)\]\}$"); + static readonly Regex FilenameRegex = new(@"^(?.+?[\-_])(?\d{4})\.tga$"); + static readonly Regex MetaRegex = new(@"^\{""size"":\[(?\d+),(?\d+)\],""crop"":\[(?\d+),(?\d+),(?\d+),(?\d+)\]\}$"); int ParseGroup(Match match, string group) { diff --git a/OpenRA.Mods.Cnc/Traits/Attack/AttackLeap.cs b/OpenRA.Mods.Cnc/Traits/Attack/AttackLeap.cs index 473edafd0a..d47df07bc2 100644 --- a/OpenRA.Mods.Cnc/Traits/Attack/AttackLeap.cs +++ b/OpenRA.Mods.Cnc/Traits/Attack/AttackLeap.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc.Traits public class AttackLeapInfo : AttackFrontalInfo, Requires { [Desc("Leap speed (in WDist units/tick).")] - public readonly WDist Speed = new WDist(426); + public readonly WDist Speed = new(426); [Desc("Conditions that last from start of the leap until the attack.")] [GrantedConditionReference] diff --git a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs index 5054730aee..6629e347ab 100644 --- a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs +++ b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string OriginalActor = "mcv"; [Desc("Facing of the returned actor.")] - public readonly WAngle Facing = new WAngle(384); + public readonly WAngle Facing = new(384); public readonly string ChronoshiftSound = "chrono2.aud"; diff --git a/OpenRA.Mods.Cnc/Traits/Disguise.cs b/OpenRA.Mods.Cnc/Traits/Disguise.cs index 5081a0a709..0c9c03cbd1 100644 --- a/OpenRA.Mods.Cnc/Traits/Disguise.cs +++ b/OpenRA.Mods.Cnc/Traits/Disguise.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy; [Desc("Target types of actors that this actor disguise as.")] - public readonly BitSet TargetTypes = new BitSet("Disguise"); + public readonly BitSet TargetTypes = new("Disguise"); [Desc("Triggers which cause the actor to drop it's disguise. Possible values: None, Attack, Damaged,", "Unload, Infiltrate, Demolish, Move.")] @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Cnc.Traits [ActorReference(dictionaryReference: LintDictionaryReference.Keys)] [Desc("Conditions to grant when disguised as specified actor.", "A dictionary of [actor id]: [condition].")] - public readonly Dictionary DisguisedAsConditions = new Dictionary(); + public readonly Dictionary DisguisedAsConditions = new(); [CursorReference] [Desc("Cursor to display when hovering over a valid actor to disguise as.")] diff --git a/OpenRA.Mods.Cnc/Traits/GpsWatcher.cs b/OpenRA.Mods.Cnc/Traits/GpsWatcher.cs index 76e230e9b1..cee03e271c 100644 --- a/OpenRA.Mods.Cnc/Traits/GpsWatcher.cs +++ b/OpenRA.Mods.Cnc/Traits/GpsWatcher.cs @@ -42,8 +42,8 @@ namespace OpenRA.Mods.Cnc.Traits readonly Player owner; - readonly List actors = new List(); - readonly HashSet> notifyOnRefresh = new HashSet>(); + readonly List actors = new(); + readonly HashSet> notifyOnRefresh = new(); public GpsWatcher(Player owner) { diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs index 8ba0409d1a..a94731c539 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForDecoration : WithDecoration, INotifyInfiltrated { - readonly HashSet infiltrators = new HashSet(); + readonly HashSet infiltrators = new(); readonly InfiltrateForDecorationInfo info; public InfiltrateForDecoration(Actor self, InfiltrateForDecorationInfo info) diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index d7351fd2e6..342b8876f7 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string AmmoPoolName = "primary"; - public readonly WDist MinefieldDepth = new WDist(1536); + public readonly WDist MinefieldDepth = new(1536); [VoiceReference] [Desc("Voice to use when ordered to lay a minefield.")] @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string TileUnknownName = "build-unknown"; [Desc("Only allow laying mines on listed terrain types. Leave empty to allow all terrain types.")] - public readonly HashSet TerrainTypes = new HashSet(); + public readonly HashSet TerrainTypes = new(); [CursorReference] [Desc("Cursor to display when able to lay a mine.")] diff --git a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs index 0853a8c958..7eb330c5a8 100644 --- a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs +++ b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Traits class LightPaletteRotatorInfo : TraitInfo { [Desc("Palettes this effect should not apply to.")] - public readonly HashSet ExcludePalettes = new HashSet(); + public readonly HashSet ExcludePalettes = new(); [Desc("'Speed' at which the effect cycles through palette indices.")] public readonly float TimeStep = .5f; diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithBuildingBib.cs b/OpenRA.Mods.Cnc/Traits/Render/WithBuildingBib.cs index 645e0bcb51..a6bc7aa642 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithBuildingBib.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithBuildingBib.cs @@ -84,7 +84,7 @@ namespace OpenRA.Mods.Cnc.Traits readonly WithBuildingBibInfo info; readonly RenderSprites rs; readonly BuildingInfo bi; - readonly List anims = new List(); + readonly List anims = new(); public WithBuildingBib(Actor self, WithBuildingBibInfo info) { diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs index 7207ed48a2..8c744cd65f 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithCargo.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render public readonly WVec[] LocalOffset = { WVec.Zero }; [Desc("Passenger CargoType to display.")] - public readonly HashSet DisplayTypes = new HashSet(); + public readonly HashSet DisplayTypes = new(); public override object Create(ActorInitializer init) { return new WithCargo(init.Self, this); } } @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render readonly IFacing facing; WAngle cachedFacing; - readonly Dictionary previews = new Dictionary(); + readonly Dictionary previews = new(); public WithCargo(Actor self, WithCargoInfo info) { diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithLandingCraftAnimation.cs b/OpenRA.Mods.Cnc/Traits/Render/WithLandingCraftAnimation.cs index 53385062cf..bf08b199b0 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithLandingCraftAnimation.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithLandingCraftAnimation.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render { public class WithLandingCraftAnimationInfo : TraitInfo, Requires, Requires, Requires { - public readonly HashSet OpenTerrainTypes = new HashSet { "Clear" }; + public readonly HashSet OpenTerrainTypes = new() { "Clear" }; [SequenceReference] public readonly string OpenSequence = "open"; diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs index d0892af80a..ccaffe3ed7 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs @@ -28,10 +28,10 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string[] UnitTypes = null; [Desc("Number of drop pods spawned.")] - public readonly int2 Drops = new int2(5, 8); + public readonly int2 Drops = new(5, 8); [Desc("Sets the approach direction.")] - public readonly WAngle PodFacing = new WAngle(128); + public readonly WAngle PodFacing = new(128); [Desc("Maximum offset from targetLocation")] public readonly int PodScatter = 3; diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index fbc4b2b58e..71447e470c 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -24,10 +24,10 @@ namespace OpenRA.Mods.Cnc.Traits public readonly int Speed = 28; [Desc("Facing to use when actor spawns. Only 256 and 768 supported.")] - public readonly WAngle InitialFacing = new WAngle(256); + public readonly WAngle InitialFacing = new(256); [Desc("Facing to use for actor previews (map editor, color picker, etc). Only 256 and 768 supported.")] - public readonly WAngle PreviewFacing = new WAngle(256); + public readonly WAngle PreviewFacing = new(256); public override object Create(ActorInitializer init) { return new TDGunboat(init, this); } @@ -58,8 +58,8 @@ namespace OpenRA.Mods.Cnc.Traits { public readonly TDGunboatInfo Info; readonly Actor self; - static readonly WAngle Left = new WAngle(256); - static readonly WAngle Right = new WAngle(768); + static readonly WAngle Left = new(256); + static readonly WAngle Right = new(768); IEnumerable speedModifiers; INotifyCenterPositionChanged[] notifyCenterPositionChanged; diff --git a/OpenRA.Mods.Cnc/Traits/World/JumpjetActorLayer.cs b/OpenRA.Mods.Cnc/Traits/World/JumpjetActorLayer.cs index 123dd465d7..47f418ae9b 100644 --- a/OpenRA.Mods.Cnc/Traits/World/JumpjetActorLayer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/JumpjetActorLayer.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string TerrainType = "Jumpjet"; [Desc("Height offset relative to the smoothed terrain for movement.")] - public readonly WDist HeightOffset = new WDist(3992); + public readonly WDist HeightOffset = new(3992); [Desc("Cell radius for smoothing adjacent cell heights.")] public readonly int SmoothingRadius = 2; diff --git a/OpenRA.Mods.Cnc/Traits/World/JumpjetLocomotor.cs b/OpenRA.Mods.Cnc/Traits/World/JumpjetLocomotor.cs index 63e87e89a3..35c2713c8d 100644 --- a/OpenRA.Mods.Cnc/Traits/World/JumpjetLocomotor.cs +++ b/OpenRA.Mods.Cnc/Traits/World/JumpjetLocomotor.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly short JumpjetTransitionCost = 0; [Desc("The terrain types that this actor can transition on. Leave empty to allow any.")] - public readonly HashSet JumpjetTransitionTerrainTypes = new HashSet(); + public readonly HashSet JumpjetTransitionTerrainTypes = new(); [Desc("Can this actor transition on slopes?")] public readonly bool JumpjetTransitionOnRamps = true; diff --git a/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs b/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs index 4c80e9ee74..55db70c3c9 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSEditorResourceLayer.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits [ActorReference] [Desc("Actor types that should be treated as veins for adjacency.")] - public readonly HashSet VeinholeActors = new HashSet { }; + public readonly HashSet VeinholeActors = new() { }; public override object Create(ActorInitializer init) { return new TSEditorResourceLayer(init.Self, this); } } diff --git a/OpenRA.Mods.Cnc/Traits/World/TSResourceLayer.cs b/OpenRA.Mods.Cnc/Traits/World/TSResourceLayer.cs index 7218ee14e2..626357004f 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSResourceLayer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSResourceLayer.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Traits [ActorReference] [Desc("Actor types that should be treated as veins for adjacency.")] - public readonly HashSet VeinholeActors = new HashSet { }; + public readonly HashSet VeinholeActors = new() { }; public override object Create(ActorInitializer init) { return new TSResourceLayer(init.Self, this); } } @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits class TSResourceLayer : ResourceLayer, INotifyActorDisposing { readonly TSResourceLayerInfo info; - readonly HashSet veinholeCells = new HashSet(); + readonly HashSet veinholeCells = new(); public TSResourceLayer(Actor self, TSResourceLayerInfo info) : base(self, info) diff --git a/OpenRA.Mods.Cnc/Traits/World/TSTiberiumRenderer.cs b/OpenRA.Mods.Cnc/Traits/World/TSTiberiumRenderer.cs index f4cf619ec3..25d041623d 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSTiberiumRenderer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSTiberiumRenderer.cs @@ -22,16 +22,16 @@ namespace OpenRA.Mods.Cnc.Traits public class TSTiberiumRendererInfo : ResourceRendererInfo { [Desc("Sequences to use for ramp type 1.", "Dictionary of [resource type]: [list of sequences].")] - public readonly Dictionary Ramp1Sequences = new Dictionary(); + public readonly Dictionary Ramp1Sequences = new(); [Desc("Sequences to use for ramp type 2.", "Dictionary of [resource type]: [list of sequences].")] - public readonly Dictionary Ramp2Sequences = new Dictionary(); + public readonly Dictionary Ramp2Sequences = new(); [Desc("Sequences to use for ramp type 3.", "Dictionary of [resource type]: [list of sequences].")] - public readonly Dictionary Ramp3Sequences = new Dictionary(); + public readonly Dictionary Ramp3Sequences = new(); [Desc("Sequences to use for ramp type 4.", "Dictionary of [resource type]: [list of sequences].")] - public readonly Dictionary Ramp4Sequences = new Dictionary(); + public readonly Dictionary Ramp4Sequences = new(); public override object Create(ActorInitializer init) { return new TSTiberiumRenderer(init.Self, this); } } @@ -40,10 +40,10 @@ namespace OpenRA.Mods.Cnc.Traits { readonly TSTiberiumRendererInfo info; readonly World world; - readonly Dictionary> ramp1Variants = new Dictionary>(); - readonly Dictionary> ramp2Variants = new Dictionary>(); - readonly Dictionary> ramp3Variants = new Dictionary>(); - readonly Dictionary> ramp4Variants = new Dictionary>(); + readonly Dictionary> ramp1Variants = new(); + readonly Dictionary> ramp2Variants = new(); + readonly Dictionary> ramp3Variants = new(); + readonly Dictionary> ramp4Variants = new(); public TSTiberiumRenderer(Actor self, TSTiberiumRendererInfo info) : base(self, info) diff --git a/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs b/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs index 5bac585b41..1aa0e7e5dc 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Traits [ActorReference] [Desc("Actor types that should be treated as veins for adjacency.")] - public readonly HashSet VeinholeActors = new HashSet { }; + public readonly HashSet VeinholeActors = new() { }; void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer) { @@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc.Traits PlusY = 0x8, } - static readonly Dictionary BorderIndices = new Dictionary() + static readonly Dictionary BorderIndices = new() { { Adjacency.MinusY, new[] { 3, 4, 5 } }, { Adjacency.PlusX, new[] { 6, 7, 8 } }, @@ -151,9 +151,9 @@ namespace OpenRA.Mods.Cnc.Traits readonly IResourceLayer resourceLayer; readonly CellLayer renderIndices; readonly CellLayer borders; - readonly HashSet dirty = new HashSet(); - readonly Queue cleanDirty = new Queue(); - readonly HashSet veinholeCells = new HashSet(); + readonly HashSet dirty = new(); + readonly Queue cleanDirty = new(); + readonly HashSet veinholeCells = new(); readonly int maxDensity; readonly Color veinRadarColor; diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs index e8eda8ab33..8e283a2bba 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands "fpls", "wcrate", "scrate", "barb", "sbag", }; - static readonly Dictionary OverlayResourceMapping = new Dictionary() + static readonly Dictionary OverlayResourceMapping = new() { // RA ore & crystals { "gold01", (1, 0) }, diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs index 6de15b5ee2..af8ed60398 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands string IUtilityCommand.Name => "--import-ts-map"; bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2; } - static readonly Dictionary OverlayToActor = new Dictionary() + static readonly Dictionary OverlayToActor = new() { { 0x00, "gasand" }, { 0x01, "gasand" }, @@ -127,7 +127,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { 0xB3, "crate" } }; - static readonly Dictionary OverlayShapes = new Dictionary() + static readonly Dictionary OverlayShapes = new() { { 0x4A, new Size(1, 3) }, { 0x4B, new Size(1, 3) }, @@ -163,7 +163,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { 0x7D, new Size(3, 1) }, }; - static readonly Dictionary OverlayToHealth = new Dictionary() + static readonly Dictionary OverlayToHealth = new() { // 1,3 bridge tiles { 0x4A, DamageState.Undamaged }, @@ -208,7 +208,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { 0x65, DamageState.Undamaged }, }; - static readonly Dictionary ResourceFromOverlay = new Dictionary() + static readonly Dictionary ResourceFromOverlay = new() { // "tib" - Regular Tiberium { @@ -239,7 +239,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { 0x03, new byte[] { 0x7E } } }; - static readonly Dictionary DeployableActors = new Dictionary() + static readonly Dictionary DeployableActors = new() { { "gadpsa", "lpst" }, { "gatick", "ttnk" } diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs index eb77730ad0..29f8238d3c 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands } } - static readonly Dictionary OverlayResourceMapping = new Dictionary() + static readonly Dictionary OverlayResourceMapping = new() { // Tiberium { "ti1", (1, 0) }, diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs index 5cf71511e7..87d444761d 100644 --- a/OpenRA.Mods.Common/Activities/Air/Fly.cs +++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Activities Target target; Target lastVisibleTarget; bool useLastVisibleTarget; - readonly List positionBuffer = new List(); + readonly List positionBuffer = new(); public Fly(Actor self, in Target t, WDist nearEnough, WPos? initialTargetPosition = null, Color? targetLineColor = null) : this(self, t, initialTargetPosition, targetLineColor) diff --git a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs index 4e055ed1f9..0f548a3319 100644 --- a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs +++ b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Activities return TickChild(self); } - readonly List searchCells = new List(); + readonly List searchCells = new(); int searchCellsTick = -1; List CalculatePathToTarget(Actor self, BlockedByActor check) diff --git a/OpenRA.Mods.Common/Activities/Transform.cs b/OpenRA.Mods.Common/Activities/Transform.cs index 7f6461d7d3..b6aaca59d9 100644 --- a/OpenRA.Mods.Common/Activities/Transform.cs +++ b/OpenRA.Mods.Common/Activities/Transform.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities { public readonly string ToActor; public CVec Offset = CVec.Zero; - public WAngle Facing = new WAngle(384); + public WAngle Facing = new(384); public string[] Sounds = Array.Empty(); public string Notification = null; public string TextNotification = null; diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs index 65d19018b7..cf4a1f1ed4 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs @@ -187,9 +187,9 @@ namespace OpenRA.Mods.Common.Widgets readonly CellLayer mapHeight; readonly CellLayer mapResources; - readonly Queue undoCopyPastes = new Queue(); - readonly Queue removedActors = new Queue(); - readonly Queue addedActorPreviews = new Queue(); + readonly Queue undoCopyPastes = new(); + readonly Queue removedActors = new(); + readonly Queue addedActorPreviews = new(); public CopyPasteEditorAction(MapCopyFilters copyFilters, Map map, Dictionary tiles, Dictionary previews, diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs index deeeba2122..917e7ea059 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs @@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets readonly IResourceLayer resourceLayer; readonly string resourceType; - readonly List cellResources = new List(); + readonly List cellResources = new(); public AddResourcesEditorAction(string resourceType, IResourceLayer resourceLayer) { diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index 721bc6bbae..616079ebc6 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -161,7 +161,7 @@ namespace OpenRA.Mods.Common.Widgets readonly Map map; readonly CPos cell; - readonly Queue undoTiles = new Queue(); + readonly Queue undoTiles = new(); readonly TerrainTemplateInfo terrainTemplate; public PaintTileEditorAction(ushort template, Map map, CPos cell) @@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Widgets readonly Map map; readonly CPos cell; - readonly Queue undoTiles = new Queue(); + readonly Queue undoTiles = new(); readonly TerrainTemplateInfo terrainTemplate; public FloodFillEditorAction(ushort template, Map map, CPos cell) diff --git a/OpenRA.Mods.Common/Effects/FloatingText.cs b/OpenRA.Mods.Common/Effects/FloatingText.cs index 4daf9f6448..05fbf69ecb 100644 --- a/OpenRA.Mods.Common/Effects/FloatingText.cs +++ b/OpenRA.Mods.Common/Effects/FloatingText.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Effects { public class FloatingText : IEffect, IEffectAnnotation { - static readonly WVec Velocity = new WVec(0, 0, 86); + static readonly WVec Velocity = new(0, 0, 86); readonly SpriteFont font; readonly string text; diff --git a/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs b/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs index bfaa80303c..6c591afd3c 100644 --- a/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs +++ b/OpenRA.Mods.Common/Effects/RallyPointIndicator.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Effects readonly Animation flag; readonly Animation circles; - readonly List targetLineNodes = new List { }; + readonly List targetLineNodes = new() { }; List cachedLocations; public RallyPointIndicator(Actor building, RallyPoint rp) diff --git a/OpenRA.Mods.Common/FileFormats/Blast.cs b/OpenRA.Mods.Common/FileFormats/Blast.cs index b05ed0793f..59e3be8df4 100644 --- a/OpenRA.Mods.Common/FileFormats/Blast.cs +++ b/OpenRA.Mods.Common/FileFormats/Blast.cs @@ -59,9 +59,9 @@ namespace OpenRA.Mods.Common.FileFormats 3, 4, 5, 6, 7, 8 }; - static readonly Huffman LitCode = new Huffman(LitLen, 256); - static readonly Huffman LenCode = new Huffman(LenLen, 16); - static readonly Huffman DistCode = new Huffman(DistLen, 64); + static readonly Huffman LitCode = new(LitLen, 256); + static readonly Huffman LenCode = new(LenLen, 16); + static readonly Huffman DistCode = new(DistLen, 64); /// PKWare Compression Library stream. /// Compressed input stream. diff --git a/OpenRA.Mods.Common/FileFormats/IniFile.cs b/OpenRA.Mods.Common/FileFormats/IniFile.cs index b854479826..34393ee693 100644 --- a/OpenRA.Mods.Common/FileFormats/IniFile.cs +++ b/OpenRA.Mods.Common/FileFormats/IniFile.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.FileFormats { public class IniFile { - readonly Dictionary sections = new Dictionary(); + readonly Dictionary sections = new(); public IniFile(Stream s) { @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.FileFormats } } - readonly Regex sectionPattern = new Regex(@"^\[([^]]*)\]"); + readonly Regex sectionPattern = new(@"^\[([^]]*)\]"); IniSection ProcessSection(string line) { @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.FileFormats public class IniSection : IEnumerable> { public string Name { get; } - readonly Dictionary values = new Dictionary(); + readonly Dictionary values = new(); public IniSection(string name) { diff --git a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs index 2088319330..5f5e684568 100644 --- a/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs +++ b/OpenRA.Mods.Common/FileFormats/InstallShieldCABCompression.cs @@ -372,7 +372,7 @@ namespace OpenRA.Mods.Common.FileFormats } } - readonly Dictionary index = new Dictionary(); + readonly Dictionary index = new(); readonly Dictionary volumes; readonly uint version; diff --git a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs index 9b3955a282..99b4e032d8 100644 --- a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs +++ b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.FileSystem public string Name { get; } public IEnumerable Contents => index.Keys; - readonly Dictionary index = new Dictionary(); + readonly Dictionary index = new(); readonly Stream s; readonly long dataStart = 255; diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 31fecb9d1e..015b65279c 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Graphics public readonly int BgraSheetSize = 2048; public readonly int IndexedSheetSize = 2048; - static readonly MiniYaml NoData = new MiniYaml(null); + static readonly MiniYaml NoData = new(null); public DefaultSpriteSequenceLoader(ModData modData) { @@ -118,91 +118,91 @@ namespace OpenRA.Mods.Common.Graphics } [Desc("File name of the sprite to use for this sequence.")] - protected static readonly SpriteSequenceField Filename = new SpriteSequenceField(nameof(Filename), null); + protected static readonly SpriteSequenceField Filename = new(nameof(Filename), null); [Desc("Frame index to start from.")] - protected static readonly SpriteSequenceField Start = new SpriteSequenceField(nameof(Start), 0); + protected static readonly SpriteSequenceField Start = new(nameof(Start), 0); [Desc("Number of frames to use. Does not have to be the total amount the sprite sheet has.")] - protected static readonly SpriteSequenceField Length = new SpriteSequenceField(nameof(Length), 1); + protected static readonly SpriteSequenceField Length = new(nameof(Length), 1); [Desc("Overrides Length if a different number of frames is defined between facings.")] - protected static readonly SpriteSequenceField Stride = new SpriteSequenceField(nameof(Stride), -1); + protected static readonly SpriteSequenceField Stride = new(nameof(Stride), -1); [Desc("The number of facings that are provided by sprite frames. Use negative values to rotate counter-clockwise.")] - protected static readonly SpriteSequenceField Facings = new SpriteSequenceField(nameof(Facings), 1); + protected static readonly SpriteSequenceField Facings = new(nameof(Facings), 1); [Desc("The total number of facings for the sequence. If >Facings, the closest facing sprite will be rotated to match. Use negative values to rotate counter-clockwise.")] - protected static readonly SpriteSequenceField InterpolatedFacings = new SpriteSequenceField(nameof(InterpolatedFacings), null); + protected static readonly SpriteSequenceField InterpolatedFacings = new(nameof(InterpolatedFacings), null); [Desc("Time (in milliseconds at default game speed) to wait until playing the next frame in the animation.")] - protected static readonly SpriteSequenceField Tick = new SpriteSequenceField(nameof(Tick), 40); + protected static readonly SpriteSequenceField Tick = new(nameof(Tick), 40); [Desc("Value controlling the Z-order. A higher values means rendering on top of other sprites at the same position. " + "Use power of 2 values to avoid glitches.")] - protected static readonly SpriteSequenceField ZOffset = new SpriteSequenceField(nameof(ZOffset), WDist.Zero); + protected static readonly SpriteSequenceField ZOffset = new(nameof(ZOffset), WDist.Zero); [Desc("Additional sprite depth Z offset to apply as a function of sprite Y (0: vertical, 1: flat on terrain)")] - protected static readonly SpriteSequenceField ZRamp = new SpriteSequenceField(nameof(ZRamp), 0); + protected static readonly SpriteSequenceField ZRamp = new(nameof(ZRamp), 0); [Desc("If the shadow is not part of the sprite, but baked into the same sprite sheet at a fixed offset, " + "set this to the frame index where it starts.")] - protected static readonly SpriteSequenceField ShadowStart = new SpriteSequenceField(nameof(ShadowStart), -1); + protected static readonly SpriteSequenceField ShadowStart = new(nameof(ShadowStart), -1); [Desc("Set Z-Offset for the separate shadow. Used by the later Westwood 2.5D titles.")] - protected static readonly SpriteSequenceField ShadowZOffset = new SpriteSequenceField(nameof(ShadowZOffset), new WDist(-5)); + protected static readonly SpriteSequenceField ShadowZOffset = new(nameof(ShadowZOffset), new WDist(-5)); [Desc("The individual frames to play instead of going through them sequentially from the `Start`.")] - protected static readonly SpriteSequenceField Frames = new SpriteSequenceField(nameof(Frames), null); + protected static readonly SpriteSequenceField Frames = new(nameof(Frames), null); [Desc("Don't apply terrain lighting or colored overlays.")] - protected static readonly SpriteSequenceField IgnoreWorldTint = new SpriteSequenceField(nameof(IgnoreWorldTint), false); + protected static readonly SpriteSequenceField IgnoreWorldTint = new(nameof(IgnoreWorldTint), false); [Desc("Adjusts the rendered size of the sprite")] - protected static readonly SpriteSequenceField Scale = new SpriteSequenceField(nameof(Scale), 1); + protected static readonly SpriteSequenceField Scale = new(nameof(Scale), 1); [Desc("Play the sprite sequence back and forth.")] - protected static readonly SpriteSequenceField Reverses = new SpriteSequenceField(nameof(Reverses), false); + protected static readonly SpriteSequenceField Reverses = new(nameof(Reverses), false); [Desc("Support a frame order where each animation step is split per each direction.")] - protected static readonly SpriteSequenceField Transpose = new SpriteSequenceField(nameof(Transpose), false); + protected static readonly SpriteSequenceField Transpose = new(nameof(Transpose), false); [Desc("Mirror on the X axis.")] - protected static readonly SpriteSequenceField FlipX = new SpriteSequenceField(nameof(FlipX), false); + protected static readonly SpriteSequenceField FlipX = new(nameof(FlipX), false); [Desc("Mirror on the Y axis.")] - protected static readonly SpriteSequenceField FlipY = new SpriteSequenceField(nameof(FlipY), false); + protected static readonly SpriteSequenceField FlipY = new(nameof(FlipY), false); [Desc("Change the position in-game on X, Y, Z.")] - protected static readonly SpriteSequenceField Offset = new SpriteSequenceField(nameof(Offset), float3.Zero); + protected static readonly SpriteSequenceField Offset = new(nameof(Offset), float3.Zero); [Desc("Apply an OpenGL/Photoshop inspired blend mode.")] - protected static readonly SpriteSequenceField BlendMode = new SpriteSequenceField(nameof(BlendMode), OpenRA.BlendMode.Alpha); + protected static readonly SpriteSequenceField BlendMode = new(nameof(BlendMode), OpenRA.BlendMode.Alpha); [Desc("Create a virtual sprite file by concatenating one or more frames from multiple files, with optional transformations applied. " + "All defined frames will be loaded into memory, even if unused, so use this property with care.")] - protected static readonly SpriteSequenceField Combine = new SpriteSequenceField(nameof(Combine), null); + protected static readonly SpriteSequenceField Combine = new(nameof(Combine), null); [Desc("Sets transparency - use one value to set for all frames or provide a value for each frame.")] - protected static readonly SpriteSequenceField Alpha = new SpriteSequenceField(nameof(Alpha), null); + protected static readonly SpriteSequenceField Alpha = new(nameof(Alpha), null); [Desc("Fade the animation from fully opaque on the first frame to fully transparent after the last frame.")] - protected static readonly SpriteSequenceField AlphaFade = new SpriteSequenceField(nameof(AlphaFade), false); + protected static readonly SpriteSequenceField AlphaFade = new(nameof(AlphaFade), false); [Desc("Name of the file containing the depth data sprite.")] - protected static readonly SpriteSequenceField DepthSprite = new SpriteSequenceField(nameof(DepthSprite), null); + protected static readonly SpriteSequenceField DepthSprite = new(nameof(DepthSprite), null); [Desc("Frame index containing the depth data.")] - protected static readonly SpriteSequenceField DepthSpriteFrame = new SpriteSequenceField(nameof(DepthSpriteFrame), 0); + protected static readonly SpriteSequenceField DepthSpriteFrame = new(nameof(DepthSpriteFrame), 0); [Desc("X, Y offset to apply to the depth sprite.")] - protected static readonly SpriteSequenceField DepthSpriteOffset = new SpriteSequenceField(nameof(DepthSpriteOffset), float2.Zero); + protected static readonly SpriteSequenceField DepthSpriteOffset = new(nameof(DepthSpriteOffset), float2.Zero); - protected static readonly MiniYaml NoData = new MiniYaml(null); + protected static readonly MiniYaml NoData = new(null); protected readonly ISpriteSequenceLoader Loader; protected string image; - protected List spritesToLoad = new List(); + protected List spritesToLoad = new(); protected Sprite[] sprites; protected Sprite[] shadowSprites; protected bool reverseFacings; diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs index 58213d8378..41082e8bb1 100644 --- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs @@ -17,9 +17,9 @@ namespace OpenRA.Mods.Common.Graphics { public class IsometricSelectionBoxAnnotationRenderable : IRenderable, IFinalizedRenderable { - static readonly float2 TLOffset = new float2(-12, -6); - static readonly float2 TROffset = new float2(12, -6); - static readonly float2 TOffset = new float2(0, -13); + static readonly float2 TLOffset = new(-12, -6); + static readonly float2 TROffset = new(12, -6); + static readonly float2 TOffset = new(0, -13); static readonly float2[] Offsets = { -TROffset, -TLOffset, -TOffset, diff --git a/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs index 9eebad4496..d1f3b49b35 100644 --- a/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics public class TilesetSpecificSpriteSequence : DefaultSpriteSequence { [Desc("Dictionary of : filename to override the Filename key.")] - static readonly SpriteSequenceField> TilesetFilenames = new SpriteSequenceField>(nameof(TilesetFilenames), null); + static readonly SpriteSequenceField> TilesetFilenames = new(nameof(TilesetFilenames), null); public TilesetSpecificSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults) : base(cache, loader, image, sequence, data, defaults) { } diff --git a/OpenRA.Mods.Common/HitShapes/Capsule.cs b/OpenRA.Mods.Common/HitShapes/Capsule.cs index 4283896be8..677e2791a0 100644 --- a/OpenRA.Mods.Common/HitShapes/Capsule.cs +++ b/OpenRA.Mods.Common/HitShapes/Capsule.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.HitShapes [FieldLoader.Require] public readonly int2 PointB; - public readonly WDist Radius = new WDist(426); + public readonly WDist Radius = new(426); [Desc("Defines the top offset relative to the actor's center.")] public readonly int VerticalTopOffset = 0; diff --git a/OpenRA.Mods.Common/HitShapes/Circle.cs b/OpenRA.Mods.Common/HitShapes/Circle.cs index be0e44c817..012a4fba24 100644 --- a/OpenRA.Mods.Common/HitShapes/Circle.cs +++ b/OpenRA.Mods.Common/HitShapes/Circle.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.HitShapes public WDist OuterRadius => Radius; [FieldLoader.Require] - public readonly WDist Radius = new WDist(426); + public readonly WDist Radius = new(426); [Desc("Defines the top offset relative to the actor's center.")] public readonly int VerticalTopOffset = 0; diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index 470cc81f42..678d82b469 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -24,9 +24,9 @@ namespace OpenRA.Mods.Common.Lint { const BindingFlags Binding = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; - readonly List referencedKeys = new List(); - readonly Dictionary referencedVariablesPerKey = new Dictionary(); - readonly List variableReferences = new List(); + readonly List referencedKeys = new(); + readonly Dictionary referencedVariablesPerKey = new(); + readonly List variableReferences = new(); void ILintPass.Run(Action emitError, Action emitWarning, ModData modData) { diff --git a/OpenRA.Mods.Common/ModContent.cs b/OpenRA.Mods.Common/ModContent.cs index 1fda933bf9..2c845588c2 100644 --- a/OpenRA.Mods.Common/ModContent.cs +++ b/OpenRA.Mods.Common/ModContent.cs @@ -105,7 +105,7 @@ namespace OpenRA public readonly string ContentInstallerMod = "modcontent"; [FieldLoader.LoadUsing(nameof(LoadPackages))] - public readonly Dictionary Packages = new Dictionary(); + public readonly Dictionary Packages = new(); static object LoadPackages(MiniYaml yaml) { diff --git a/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs b/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs index 3559ed751b..89451bde1d 100644 --- a/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs +++ b/OpenRA.Mods.Common/Pathfinder/CellInfoLayerPool.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Pathfinder sealed class CellInfoLayerPool { const int MaxPoolSize = 4; - readonly Stack> pool = new Stack>(MaxPoolSize); + readonly Stack> pool = new(MaxPoolSize); readonly Map map; public CellInfoLayerPool(Map map) @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Pathfinder public class PooledCellInfoLayer : IDisposable { CellInfoLayerPool layerPool; - List> layers = new List>(); + List> layers = new(); public PooledCellInfoLayer(CellInfoLayerPool layerPool) { diff --git a/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs b/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs index 29f2c4ba70..71e18f55c1 100644 --- a/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs +++ b/OpenRA.Mods.Common/Pathfinder/HierarchicalPathFinder.cs @@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Pathfinder readonly Locomotor locomotor; readonly IActorMap actorMap; readonly Func costEstimator; - readonly HashSet dirtyGridIndexes = new HashSet(); + readonly HashSet dirtyGridIndexes = new(); readonly HashSet cellsWithBlockingActor; Grid mapBounds; int gridXs; diff --git a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs index 33f60fab2f..dd0a97f937 100644 --- a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Pathfinder // PERF: Maintain a pool of layers used for paths searches for each world. These searches are performed often // so we wish to avoid the high cost of initializing a new search space every time by reusing the old ones. - static readonly ConditionalWeakTable LayerPoolTable = new ConditionalWeakTable(); + static readonly ConditionalWeakTable LayerPoolTable = new(); static readonly ConditionalWeakTable.CreateValueCallback CreateLayerPool = world => new CellInfoLayerPool(world.Map); static CellInfoLayerPool LayerPoolForWorld(World world) diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index d2d5d18567..3576b7f9cb 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -34,13 +34,13 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int DamageInterval = 3; [Desc("The width of the beam.")] - public readonly WDist Width = new WDist(512); + public readonly WDist Width = new(512); [Desc("The shape of the beam. Accepts values Cylindrical or Flat.")] public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical; [Desc("How far beyond the target the projectile keeps on travelling.")] - public readonly WDist BeyondTargetRange = new WDist(0); + public readonly WDist BeyondTargetRange = new(0); [Desc("The minimum distance the beam travels.")] public readonly WDist MinDistance = WDist.Zero; diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index 648a969fa5..cdfb0f425b 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly bool Blockable = true; [Desc("Width of projectile (used for finding blocking actors).")] - public readonly WDist Width = new WDist(1); + public readonly WDist Width = new(1); [Desc("Arc in WAngles, two values indicate variable arc.")] public readonly WAngle[] LaunchAngle = { WAngle.Zero }; @@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly string BounceSound = null; [Desc("Terrain where the projectile explodes instead of bouncing.")] - public readonly HashSet InvalidBounceTerrain = new HashSet(); + public readonly HashSet InvalidBounceTerrain = new(); [Desc("Trigger the explosion if the projectile touches an actor thats owner has these player relationships.")] public readonly PlayerRelationship ValidBounceBlockerRelationships = PlayerRelationship.Enemy | PlayerRelationship.Neutral; @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int ContrailZOffset = 2047; [Desc("Thickness of the emitted line.")] - public readonly WDist ContrailWidth = new WDist(64); + public readonly WDist ContrailWidth = new(64); [Desc("RGB color at the contrail start.")] public readonly Color ContrailStartColor = Color.White; diff --git a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs index af7aac7e6c..c6086a93a3 100644 --- a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly WVec Velocity = WVec.Zero; [Desc("Value added to Velocity every tick.")] - public readonly WVec Acceleration = new WVec(0, 0, -15); + public readonly WVec Acceleration = new(0, 0, -15); public IProjectile Create(ProjectileArgs args) { return new GravityBomb(this, args); } } diff --git a/OpenRA.Mods.Common/Projectiles/InstantHit.cs b/OpenRA.Mods.Common/Projectiles/InstantHit.cs index fb91a8ea6a..e8030c5b2d 100644 --- a/OpenRA.Mods.Common/Projectiles/InstantHit.cs +++ b/OpenRA.Mods.Common/Projectiles/InstantHit.cs @@ -31,11 +31,11 @@ namespace OpenRA.Mods.Common.Projectiles public readonly bool Blockable = false; [Desc("The width of the projectile.")] - public readonly WDist Width = new WDist(1); + public readonly WDist Width = new(1); [Desc("Scan radius for actors with projectile-blocking trait. If set to a negative value (default), it will automatically scale", "to the blocker with the largest health shape. Only set custom values if you know what you're doing.")] - public readonly WDist BlockerScanRadius = new WDist(-1); + public readonly WDist BlockerScanRadius = new(-1); public IProjectile Create(ProjectileArgs args) { return new InstantHit(this, args); } } diff --git a/OpenRA.Mods.Common/Projectiles/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs index ec2fb95344..01d32ea4fc 100644 --- a/OpenRA.Mods.Common/Projectiles/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Projectiles public class LaserZapInfo : IProjectileInfo { [Desc("The width of the zap.")] - public readonly WDist Width = new WDist(86); + public readonly WDist Width = new(86); [Desc("The shape of the beam. Accepts values Cylindrical or Flat.")] public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical; @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly bool SecondaryBeam = false; [Desc("The width of the zap.")] - public readonly WDist SecondaryBeamWidth = new WDist(86); + public readonly WDist SecondaryBeamWidth = new(86); [Desc("The shape of the beam. Accepts values Cylindrical or Flat.")] public readonly BeamRenderableShape SecondaryBeamShape = BeamRenderableShape.Cylindrical; diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 897be9b123..a1d9f90904 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -45,22 +45,22 @@ namespace OpenRA.Mods.Common.Projectiles public readonly Color ShadowColor = Color.FromArgb(140, 0, 0, 0); [Desc("Minimum vertical launch angle (pitch).")] - public readonly WAngle MinimumLaunchAngle = new WAngle(-64); + public readonly WAngle MinimumLaunchAngle = new(-64); [Desc("Maximum vertical launch angle (pitch).")] - public readonly WAngle MaximumLaunchAngle = new WAngle(128); + public readonly WAngle MaximumLaunchAngle = new(128); [Desc("Minimum launch speed in WDist / tick. Defaults to Speed if -1.")] - public readonly WDist MinimumLaunchSpeed = new WDist(-1); + public readonly WDist MinimumLaunchSpeed = new(-1); [Desc("Maximum launch speed in WDist / tick. Defaults to Speed if -1.")] - public readonly WDist MaximumLaunchSpeed = new WDist(-1); + public readonly WDist MaximumLaunchSpeed = new(-1); [Desc("Maximum projectile speed in WDist / tick")] - public readonly WDist Speed = new WDist(384); + public readonly WDist Speed = new(384); [Desc("Projectile acceleration when propulsion activated.")] - public readonly WDist Acceleration = new WDist(5); + public readonly WDist Acceleration = new(5); [Desc("How many ticks before this missile is armed and can explode.")] public readonly int Arm = 0; @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly bool TerrainHeightAware = false; [Desc("Width of projectile (used for finding blocking actors).")] - public readonly WDist Width = new WDist(1); + public readonly WDist Width = new(1); [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; @@ -81,16 +81,16 @@ namespace OpenRA.Mods.Common.Projectiles public readonly InaccuracyType InaccuracyType = InaccuracyType.Absolute; [Desc("Inaccuracy override when successfully locked onto target. Defaults to Inaccuracy if negative.")] - public readonly WDist LockOnInaccuracy = new WDist(-1); + public readonly WDist LockOnInaccuracy = new(-1); [Desc("Probability of locking onto and following target.")] public readonly int LockOnProbability = 100; [Desc("Horizontal rate of turn.")] - public readonly WAngle HorizontalRateOfTurn = new WAngle(20); + public readonly WAngle HorizontalRateOfTurn = new(20); [Desc("Vertical rate of turn.")] - public readonly WAngle VerticalRateOfTurn = new WAngle(24); + public readonly WAngle VerticalRateOfTurn = new(24); [Desc("Gravity applied while in free fall.")] public readonly int Gravity = 10; @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly WDist AirburstAltitude = WDist.Zero; [Desc("Cruise altitude. Zero means no cruise altitude used.")] - public readonly WDist CruiseAltitude = new WDist(512); + public readonly WDist CruiseAltitude = new(512); [Desc("Activate homing mechanism after this many ticks.")] public readonly int HomingActivationDelay = 0; @@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int ContrailZOffset = 2047; [Desc("Thickness of the emitted line.")] - public readonly WDist ContrailWidth = new WDist(64); + public readonly WDist ContrailWidth = new(64); [Desc("RGB color at the contrail start.")] public readonly Color ContrailStartColor = Color.White; @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Explodes when inside this proximity radius to target.", "Note: If this value is lower than the missile speed, this check might", "not trigger fast enough, causing the missile to fly past the target.")] - public readonly WDist CloseEnough = new WDist(298); + public readonly WDist CloseEnough = new(298); public IProjectile Create(ProjectileArgs args) { return new Missile(this, args); } } diff --git a/OpenRA.Mods.Common/Projectiles/Railgun.cs b/OpenRA.Mods.Common/Projectiles/Railgun.cs index ededf27718..b172b58205 100644 --- a/OpenRA.Mods.Common/Projectiles/Railgun.cs +++ b/OpenRA.Mods.Common/Projectiles/Railgun.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int ZOffset = 0; [Desc("The width of the main trajectory. (\"beam\").")] - public readonly WDist BeamWidth = new WDist(86); + public readonly WDist BeamWidth = new(86); [Desc("The shape of the beam. Accepts values Cylindrical or Flat.")] public readonly BeamRenderableShape BeamShape = BeamRenderableShape.Cylindrical; @@ -57,13 +57,13 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int BeamAlphaDeltaPerTick = -8; [Desc("Thickness of the helix")] - public readonly WDist HelixThickness = new WDist(32); + public readonly WDist HelixThickness = new(32); [Desc("The radius of the spiral effect. (WDist)")] - public readonly WDist HelixRadius = new WDist(64); + public readonly WDist HelixRadius = new(64); [Desc("Height of one complete helix turn, measured parallel to the axis of the helix (WDist)")] - public readonly WDist HelixPitch = new WDist(512); + public readonly WDist HelixPitch = new(512); [Desc("Helix radius gets + this value per tick during drawing")] public readonly int HelixRadiusDeltaPerTick = 8; @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int HelixAlphaDeltaPerTick = -8; [Desc("Helix spins by this much over time each tick.")] - public readonly WAngle HelixAngleDeltaPerTick = new WAngle(16); + public readonly WAngle HelixAngleDeltaPerTick = new(16); [Desc("Draw each cycle of helix with this many quantization steps")] public readonly int QuantizationCount = 16; diff --git a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs index 3d975c490e..8b50493849 100644 --- a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs @@ -20,13 +20,13 @@ namespace OpenRA.Mods.Common.Scripting.Global : base(context) { } public WAngle North => WAngle.Zero; - public WAngle NorthWest => new WAngle(128); - public WAngle West => new WAngle(256); - public WAngle SouthWest => new WAngle(384); - public WAngle South => new WAngle(512); - public WAngle SouthEast => new WAngle(640); - public WAngle East => new WAngle(768); - public WAngle NorthEast => new WAngle(896); + public WAngle NorthWest => new(128); + public WAngle West => new(256); + public WAngle SouthWest => new(384); + public WAngle South => new(512); + public WAngle SouthEast => new(640); + public WAngle East => new(768); + public WAngle NorthEast => new(896); [Desc("Create an arbitrary angle.")] public WAngle New(int a) { return new WAngle(a); } diff --git a/OpenRA.Mods.Common/Scripting/LuaScript.cs b/OpenRA.Mods.Common/Scripting/LuaScript.cs index 02b689cdcd..24158208db 100644 --- a/OpenRA.Mods.Common/Scripting/LuaScript.cs +++ b/OpenRA.Mods.Common/Scripting/LuaScript.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Part of the new Lua API.")] public class LuaScriptInfo : TraitInfo, Requires { - public readonly HashSet Scripts = new HashSet(); + public readonly HashSet Scripts = new(); public override object Create(ActorInitializer init) { return new LuaScript(this); } } diff --git a/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs b/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs index 490ed87537..89ec89bbf0 100644 --- a/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs +++ b/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Server const string GameOffline = "notification-game-offline"; static readonly Beacon LanGameBeacon; - static readonly Dictionary MasterServerErrors = new Dictionary() + static readonly Dictionary MasterServerErrors = new() { { 1, NoPortForward }, { 2, BlacklistedTitle } @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Server bool isInitialPing = true; volatile bool isBusy; - readonly Queue masterServerMessages = new Queue(); + readonly Queue masterServerMessages = new(); static MasterServerPinger() { diff --git a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs index c7aa1ff0f6..1a6d54927b 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Terrain [FieldLoader.Ignore] public readonly TerrainTypeInfo[] TerrainInfo; - readonly Dictionary terrainIndexByType = new Dictionary(); + readonly Dictionary terrainIndexByType = new(); readonly byte defaultWalkableTerrainIndex; public DefaultTerrain(IReadOnlyFileSystem fileSystem, string filepath) @@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Terrain IEnumerable ITerrainInfo.RestrictedPlayerColors { get { return TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color); } } float ITerrainInfo.MinHeightColorBrightness => MinHeightColorBrightness; float ITerrainInfo.MaxHeightColorBrightness => MaxHeightColorBrightness; - TerrainTile ITerrainInfo.DefaultTerrainTile => new TerrainTile(Templates.First().Key, 0); + TerrainTile ITerrainInfo.DefaultTerrainTile => new(Templates.First().Key, 0); string[] ITemplatedTerrainInfo.EditorTemplateOrder => EditorTemplateOrder; IReadOnlyDictionary ITemplatedTerrainInfo.Templates => Templates; diff --git a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs index 24cd07d03c..68398577bb 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Terrain public sealed class DefaultTileCache : IDisposable { - readonly Dictionary templates = new Dictionary(); + readonly Dictionary templates = new(); readonly Cache sheetBuilders; readonly MersenneTwister random; diff --git a/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs b/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs index f3aa1473d6..8ae136b087 100644 --- a/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs +++ b/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits public class AcceptsDeliveredCashInfo : TraitInfo { [Desc("Accepted `DeliversCash` types. Leave empty to accept all types.")] - public readonly HashSet ValidTypes = new HashSet(); + public readonly HashSet ValidTypes = new(); [Desc("Player relationships the owner of the delivering actor needs.")] public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally; diff --git a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs index e789ea6422..366978946e 100644 --- a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs +++ b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class AcceptsDeliveredExperienceInfo : TraitInfo, Requires { [Desc("Accepted `DeliversExperience` types. Leave empty to accept all types.")] - public readonly HashSet ValidTypes = new HashSet(); + public readonly HashSet ValidTypes = new(); [Desc("Player relationships the owner of the delivering actor needs.")] public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally; diff --git a/OpenRA.Mods.Common/Traits/ActorSpawner.cs b/OpenRA.Mods.Common/Traits/ActorSpawner.cs index 0fe4c254cb..33eaea3ca3 100644 --- a/OpenRA.Mods.Common/Traits/ActorSpawner.cs +++ b/OpenRA.Mods.Common/Traits/ActorSpawner.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits public class ActorSpawnerInfo : ConditionalTraitInfo { [Desc("Type of ActorSpawner with which it connects.")] - public readonly HashSet Types = new HashSet() { }; + public readonly HashSet Types = new() { }; public override object Create(ActorInitializer init) { return new ActorSpawner(this); } } diff --git a/OpenRA.Mods.Common/Traits/AffectsShroud.cs b/OpenRA.Mods.Common/Traits/AffectsShroud.cs index aba804c781..fd07c9d1cd 100644 --- a/OpenRA.Mods.Common/Traits/AffectsShroud.cs +++ b/OpenRA.Mods.Common/Traits/AffectsShroud.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int MaxHeightDelta = -1; [Desc("If > 0, force visibility to be recalculated if the unit moves within a cell by more than this distance.")] - public readonly WDist MoveRecalculationThreshold = new WDist(256); + public readonly WDist MoveRecalculationThreshold = new(256); [Desc("Possible values are CenterPosition (measure range from the center) and ", "Footprint (measure range from the footprint)")] diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 393f07540e..3665f435f4 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -37,13 +37,13 @@ namespace OpenRA.Mods.Common.Traits "'Land' will behave like 'None' (hover or circle) if a suitable landing site is not available.")] public readonly IdleBehaviorType IdleBehavior = IdleBehaviorType.None; - public readonly WDist CruiseAltitude = new WDist(1280); + public readonly WDist CruiseAltitude = new(1280); [Desc("Whether the aircraft can be repulsed.")] public readonly bool Repulsable = true; [Desc("The distance it tries to maintain from other aircraft if repulsable.")] - public readonly WDist IdealSeparation = new WDist(1706); + public readonly WDist IdealSeparation = new(1706); [Desc("The speed at which the aircraft is repulsed from other aircraft. Specify -1 for normal movement speed.")] public readonly int RepulsionSpeed = -1; @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WAngle InitialFacing = WAngle.Zero; [Desc("Speed at which the actor turns.")] - public readonly WAngle TurnSpeed = new WAngle(512); + public readonly WAngle TurnSpeed = new(512); [Desc("Turn speed to apply when aircraft flies in circles while idle. Defaults to TurnSpeed if undefined.")] public readonly WAngle? IdleTurnSpeed = null; @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Minimum altitude where this aircraft is considered airborne.")] public readonly int MinAirborneAltitude = 1; - public readonly HashSet LandableTerrainTypes = new HashSet(); + public readonly HashSet LandableTerrainTypes = new(); [Desc("Can the actor be ordered to move in to shroud?")] public readonly bool MoveIntoShroud = true; @@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WAngle MaximumPitch = WAngle.FromDegrees(10); [Desc("How fast this actor ascends or descends when moving vertically only (vertical take off/landing or hovering towards CruiseAltitude).")] - public readonly WDist AltitudeVelocity = new WDist(43); + public readonly WDist AltitudeVelocity = new(43); [Desc("Sounds to play when the actor is taking off.")] public readonly string[] TakeoffSounds = Array.Empty(); @@ -145,13 +145,13 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] LandingSounds = Array.Empty(); [Desc("The distance of the resupply base that the aircraft will wait for its turn.")] - public readonly WDist WaitDistanceFromResupplyBase = new WDist(3072); + public readonly WDist WaitDistanceFromResupplyBase = new(3072); [Desc("The number of ticks that a airplane will wait to make a new search for an available airport.")] public readonly int NumberOfTicksToVerifyAvailableAirport = 150; [Desc("Facing to use for actor previews (map editor, color picker, etc)")] - public readonly WAngle PreviewFacing = new WAngle(384); + public readonly WAngle PreviewFacing = new(384); [Desc("Display order for the facing slider in the map editor")] public readonly int EditorFacingDisplayOrder = 3; diff --git a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs index b8140dea24..16442b5b2b 100644 --- a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs +++ b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool Moves = false; [Desc("Velocity (per tick) at which aircraft falls to ground.")] - public readonly WDist Velocity = new WDist(43); + public readonly WDist Velocity = new(43); public WeaponInfo ExplosionWeapon { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs index 5956daf54e..415274d551 100644 --- a/OpenRA.Mods.Common/Traits/AmmoPool.cs +++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public class AmmoPool : INotifyCreated, INotifyAttack, ISync { public readonly AmmoPoolInfo Info; - readonly Stack tokens = new Stack(); + readonly Stack tokens = new(); // HACK: Temporarily needed until Rearm activity is gone for good [Sync] diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index a65c70a075..cdc33bcc1a 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WDist Recoil = WDist.Zero; [Desc("Recoil recovery per-frame")] - public readonly WDist RecoilRecovery = new WDist(9); + public readonly WDist RecoilRecovery = new(9); [SequenceReference] [Desc("Muzzle flash sequence to render")] @@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits int currentBarrel; readonly int barrelCount; - readonly List<(int Ticks, int Burst, Action Func)> delayedActions = new List<(int, int, Action)>(); + readonly List<(int Ticks, int Burst, Action Func)> delayedActions = new(); public WDist Recoil; public int FireDelay { get; protected set; } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index 13e80e2fe5..75af478d3a 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Voice = "Action"; [Desc("Tolerance for attack angle. Range [0, 512], 512 covers 360 degrees.")] - public readonly WAngle FacingTolerance = new WAngle(512); + public readonly WAngle FacingTolerance = new(512); public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index 00c2f67798..d00526e158 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string AttackAnythingCondition = null; [FieldLoader.Ignore] - public readonly Dictionary ConditionByStance = new Dictionary(); + public readonly Dictionary ConditionByStance = new(); [Desc("Allow the player to change the unit stance.")] public readonly bool EnableStances = true; diff --git a/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs b/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs index b37ab6b2dc..fb2f33884c 100644 --- a/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs +++ b/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class AutoTargetPriorityInfo : ConditionalTraitInfo, Requires { [Desc("Target types that can be AutoTargeted.")] - public readonly BitSet ValidTargets = new BitSet("Ground", "Water", "Air"); + public readonly BitSet ValidTargets = new("Ground", "Water", "Air"); [Desc("Target types that can't be AutoTargeted.", "Overrules ValidTargets.")] public readonly BitSet InvalidTargets; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index b43cfa7c86..eca8bb50c1 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -19,37 +19,37 @@ namespace OpenRA.Mods.Common.Traits public class BaseBuilderBotModuleInfo : ConditionalTraitInfo { [Desc("Tells the AI what building types are considered construction yards.")] - public readonly HashSet ConstructionYardTypes = new HashSet(); + public readonly HashSet ConstructionYardTypes = new(); [Desc("Tells the AI what building types are considered vehicle production facilities.")] - public readonly HashSet VehiclesFactoryTypes = new HashSet(); + public readonly HashSet VehiclesFactoryTypes = new(); [Desc("Tells the AI what building types are considered refineries.")] - public readonly HashSet RefineryTypes = new HashSet(); + public readonly HashSet RefineryTypes = new(); [Desc("Tells the AI what building types are considered power plants.")] - public readonly HashSet PowerTypes = new HashSet(); + public readonly HashSet PowerTypes = new(); [Desc("Tells the AI what building types are considered infantry production facilities.")] - public readonly HashSet BarracksTypes = new HashSet(); + public readonly HashSet BarracksTypes = new(); [Desc("Tells the AI what building types are considered production facilities.")] - public readonly HashSet ProductionTypes = new HashSet(); + public readonly HashSet ProductionTypes = new(); [Desc("Tells the AI what building types are considered naval production facilities.")] - public readonly HashSet NavalProductionTypes = new HashSet(); + public readonly HashSet NavalProductionTypes = new(); [Desc("Tells the AI what building types are considered silos (resource storage).")] - public readonly HashSet SiloTypes = new HashSet(); + public readonly HashSet SiloTypes = new(); [Desc("Tells the AI what building types are considered defenses.")] - public readonly HashSet DefenseTypes = new HashSet(); + public readonly HashSet DefenseTypes = new(); [Desc("Production queues AI uses for buildings.")] - public readonly HashSet BuildingQueues = new HashSet { "Building" }; + public readonly HashSet BuildingQueues = new() { "Building" }; [Desc("Production queues AI uses for defenses.")] - public readonly HashSet DefenseQueues = new HashSet { "Defense" }; + public readonly HashSet DefenseQueues = new() { "Defense" }; [Desc("Minimum distance in cells from center of the base when checking for building placement.")] public readonly int MinBaseRadius = 2; @@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int CheckForWaterRadius = 8; [Desc("Terrain types which are considered water for base building purposes.")] - public readonly HashSet WaterTerrainTypes = new HashSet { "Water" }; + public readonly HashSet WaterTerrainTypes = new() { "Water" }; [Desc("What buildings to the AI should build.", "What integer percentage of the total base must be this type of building.")] public readonly Dictionary BuildingFractions = null; @@ -155,7 +155,7 @@ namespace OpenRA.Mods.Common.Traits IResourceLayer resourceLayer; IBotPositionsUpdated[] positionsUpdatedModules; CPos initialBaseCenter; - readonly List builders = new List(); + readonly List builders = new(); public BaseBuilderBotModule(Actor self, BaseBuilderBotModuleInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs index dffd6925ff..0ecfb5f5eb 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits [FieldLoader.LoadUsing(nameof(LoadConsiderations))] [Desc("The decisions associated with this power")] - public readonly List Considerations = new List(); + public readonly List Considerations = new(); [Desc("Minimum ticks to wait until next Decision scan attempt.")] public readonly int MinimumScanTimeInterval = 250; @@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Traits public readonly PlayerRelationship Against = PlayerRelationship.Enemy; [Desc("What types should the desired targets of this power be?")] - public readonly BitSet Types = new BitSet("Air", "Ground", "Water"); + public readonly BitSet Types = new("Air", "Ground", "Water"); [Desc("How attractive are these types of targets?")] public readonly int Attractiveness = 100; diff --git a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs index 991dc7ebdd..b43fdd35d4 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs @@ -21,11 +21,11 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Actor types that can capture other actors (via `Captures`).", "Leave this empty to disable capturing.")] - public readonly HashSet CapturingActorTypes = new HashSet(); + public readonly HashSet CapturingActorTypes = new(); [Desc("Actor types that can be targeted for capturing.", "Leave this empty to include all actors.")] - public readonly HashSet CapturableActorTypes = new HashSet(); + public readonly HashSet CapturableActorTypes = new(); [Desc("Minimum delay (in ticks) between trying to capture with CapturingActorTypes.")] public readonly int MinimumCaptureDelay = 375; @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits int minCaptureDelayTicks; // Units that the bot already knows about and has given a capture order. Any unit not on this list needs to be given a new order. - readonly List activeCapturers = new List(); + readonly List activeCapturers = new(); public CaptureManagerBotModule(Actor self, CaptureManagerBotModuleInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs index 4aee505138..ecf8107f4d 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs @@ -22,10 +22,10 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Actor types that are considered harvesters. If harvester count drops below RefineryTypes count, a new harvester is built.", "Leave empty to disable harvester replacement. Currently only needed by harvester replacement system.")] - public readonly HashSet HarvesterTypes = new HashSet(); + public readonly HashSet HarvesterTypes = new(); [Desc("Actor types that are counted as refineries. Currently only needed by harvester replacement system.")] - public readonly HashSet RefineryTypes = new HashSet(); + public readonly HashSet RefineryTypes = new(); [Desc("Interval (in ticks) between giving out orders to idle harvesters.")] public readonly int ScanForIdleHarvestersInterval = 50; @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits readonly World world; readonly Player player; readonly Func unitCannotBeOrdered; - readonly Dictionary harvesters = new Dictionary(); + readonly Dictionary harvesters = new(); IResourceLayer resourceLayer; ResourceClaimLayer claimLayer; diff --git a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs index 2c609e17bf..8c4f4c225d 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs @@ -19,13 +19,13 @@ namespace OpenRA.Mods.Common.Traits public class McvManagerBotModuleInfo : ConditionalTraitInfo { [Desc("Actor types that are considered MCVs (deploy into base builders).")] - public readonly HashSet McvTypes = new HashSet(); + public readonly HashSet McvTypes = new(); [Desc("Actor types that are considered construction yards (base builders).")] - public readonly HashSet ConstructionYardTypes = new HashSet(); + public readonly HashSet ConstructionYardTypes = new(); [Desc("Actor types that are able to produce MCVs.")] - public readonly HashSet McvFactoryTypes = new HashSet(); + public readonly HashSet McvFactoryTypes = new(); [Desc("Try to maintain at least this many ConstructionYardTypes, build an MCV if number is below this.")] public readonly int MinimumConstructionYardCount = 1; diff --git a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs index 010521fcf2..855a4c6d99 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs @@ -23,27 +23,27 @@ namespace OpenRA.Mods.Common.Traits { [ActorReference] [Desc("Actor types that are valid for naval squads.")] - public readonly HashSet NavalUnitsTypes = new HashSet(); + public readonly HashSet NavalUnitsTypes = new(); [ActorReference] [Desc("Actor types that are excluded from ground attacks.")] - public readonly HashSet AirUnitsTypes = new HashSet(); + public readonly HashSet AirUnitsTypes = new(); [ActorReference] [Desc("Actor types that should generally be excluded from attack squads.")] - public readonly HashSet ExcludeFromSquadsTypes = new HashSet(); + public readonly HashSet ExcludeFromSquadsTypes = new(); [ActorReference] [Desc("Actor types that are considered construction yards (base builders).")] - public readonly HashSet ConstructionYardTypes = new HashSet(); + public readonly HashSet ConstructionYardTypes = new(); [ActorReference] [Desc("Enemy building types around which to scan for targets for naval squads.")] - public readonly HashSet NavalProductionTypes = new HashSet(); + public readonly HashSet NavalProductionTypes = new(); [ActorReference] [Desc("Own actor types that are prioritized when defending.")] - public readonly HashSet ProtectionTypes = new HashSet(); + public readonly HashSet ProtectionTypes = new(); [Desc("Minimum number of units AI must have before attacking.")] public readonly int SquadSize = 8; @@ -114,12 +114,12 @@ namespace OpenRA.Mods.Common.Traits public readonly Player Player; readonly Predicate unitCannotBeOrdered; - readonly List unitsHangingAroundTheBase = new List(); + readonly List unitsHangingAroundTheBase = new(); // Units that the bot already knows about. Any unit not on this list needs to be given a role. - readonly List activeUnits = new List(); + readonly List activeUnits = new(); - public List Squads = new List(); + public List Squads = new(); IBot bot; IBotPositionsUpdated[] notifyPositionsUpdated; diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/AttackOrFleeFuzzy.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/AttackOrFleeFuzzy.cs index d57b81c618..51fd55de6b 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/AttackOrFleeFuzzy.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/AttackOrFleeFuzzy.cs @@ -95,8 +95,8 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads "then AttackOrFlee is Flee" }; - public static readonly AttackOrFleeFuzzy Default = new AttackOrFleeFuzzy(null, null, null); - public static readonly AttackOrFleeFuzzy Rush = new AttackOrFleeFuzzy(new[] + public static readonly AttackOrFleeFuzzy Default = new(null, null, null); + public static readonly AttackOrFleeFuzzy Rush = new(new[] { "if ((OwnHealth is Normal) " + "and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " + @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads "then AttackOrFlee is Flee" }, null, null); - readonly MamdaniFuzzySystem fuzzyEngine = new MamdaniFuzzySystem(); + readonly MamdaniFuzzySystem fuzzyEngine = new(); public AttackOrFleeFuzzy( IEnumerable rulesForNormalOwnHealth, diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs index dd23dba15f..d6ec65fed7 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads public class Squad { - public List Units = new List(); + public List Units = new(); public SquadType Type; internal IBot Bot; diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs index 4c6d578af5..c264c25ddc 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/States/AirStates.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads { abstract class AirStateBase : StateBase { - static readonly BitSet AirTargetTypes = new BitSet("Air"); + static readonly BitSet AirTargetTypes = new("Air"); protected const int MissileUnitMultiplier = 3; diff --git a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs index 1851e7869a..0b8cccfcdd 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Tells the AI how to use its support powers.")] [FieldLoader.LoadUsing(nameof(LoadDecisions))] - public readonly List Decisions = new List(); + public readonly List Decisions = new(); static object LoadDecisions(MiniYaml yaml) { @@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Traits { readonly World world; readonly Player player; - readonly Dictionary waitingPowers = new Dictionary(); - readonly Dictionary powerDecisions = new Dictionary(); - readonly List stalePowers = new List(); + readonly Dictionary waitingPowers = new(); + readonly Dictionary powerDecisions = new(); + readonly List stalePowers = new(); SupportPowerManager supportPowerManager; public SupportPowerBotModule(Actor self, SupportPowerBotModuleInfo info) diff --git a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs index 52d56a5279..a7b7152152 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int IdleBaseUnitsMaximum = 12; [Desc("Production queues AI uses for producing units.")] - public readonly HashSet UnitQueues = new HashSet { "Vehicle", "Infantry", "Plane", "Ship", "Aircraft" }; + public readonly HashSet UnitQueues = new() { "Vehicle", "Infantry", "Plane", "Ship", "Aircraft" }; [Desc("What units to the AI should build.", "What relative share of the total army must be this type of unit.")] public readonly Dictionary UnitsToBuild = null; @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits readonly World world; readonly Player player; - readonly List queuedBuildRequests = new List(); + readonly List queuedBuildRequests = new(); IBotRequestPauseUnitProduction[] requestPause; int idleUnitCount; diff --git a/OpenRA.Mods.Common/Traits/Buildable.cs b/OpenRA.Mods.Common/Traits/Buildable.cs index 5bc665d24f..8c0042d806 100644 --- a/OpenRA.Mods.Common/Traits/Buildable.cs +++ b/OpenRA.Mods.Common/Traits/Buildable.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] Prerequisites = Array.Empty(); [Desc("Production queue(s) that can produce this.")] - public readonly HashSet Queue = new HashSet(); + public readonly HashSet Queue = new(); [Desc("Override the production structure type (from the Production Produces list) that this unit should be built at.")] public readonly string BuildAtProductionType = null; diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs index b4cecb0ae1..8e98725f02 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs @@ -47,11 +47,11 @@ namespace OpenRA.Mods.Common.Traits readonly BridgeLayer bridgeLayer; // Fixed at map load - readonly List segmentLocations = new List(); + readonly List segmentLocations = new(); // Changes as segments are killed and repaired - readonly Dictionary segments = new Dictionary(); - readonly HashSet dirtyLocations = new HashSet(); + readonly Dictionary segments = new(); + readonly HashSet dirtyLocations = new(); // Enabled during a repair action int repairStep; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 84a994c13d..ab14327a67 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -29,14 +29,14 @@ namespace OpenRA.Mods.Common.Traits public class BuildingInfo : TraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo { [Desc("Where you are allowed to place the building (Water, Clear, ...)")] - public readonly HashSet TerrainTypes = new HashSet(); + public readonly HashSet TerrainTypes = new(); [Desc("x means cell is blocked, capital X means blocked but not counting as targetable, ", "= means part of the footprint but passable, _ means completely empty.")] [FieldLoader.LoadUsing(nameof(LoadFootprint))] public readonly Dictionary Footprint; - public readonly CVec Dimensions = new CVec(1, 1); + public readonly CVec Dimensions = new(1, 1); [Desc("Shift center of the actor by this offset.")] public readonly WVec LocalCenterOffset = WVec.Zero; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs index a821a5e0e1..0352dab7f4 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WAngle? Facing = null; [Desc("Type tags on this exit.")] - public readonly HashSet ProductionTypes = new HashSet(); + public readonly HashSet ProductionTypes = new(); [Desc("Number of ticks to wait before moving into the world.")] public readonly int ExitDelay = 0; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs index 255d6b5cdb..0569cb354f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int TransitionDelay = 33; [Desc("Blocks bullets scaled to open value.")] - public readonly WDist BlocksProjectilesHeight = new WDist(640); + public readonly WDist BlocksProjectilesHeight = new(640); [Desc("Determines what projectiles to block based on their allegiance to the gate owner.")] public readonly PlayerRelationship BlocksProjectilesValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy; @@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self)); } - WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition); + WDist IBlocksProjectiles.BlockingHeight => new(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition); PlayerRelationship IBlocksProjectiles.ValidRelationships => Info.BlocksProjectilesValidRelationships; } diff --git a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs index d308fb405d..b979c4bc52 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("Types of buildable area this actor gives.")] - public readonly HashSet AreaTypes = new HashSet(); + public readonly HashSet AreaTypes = new(); public override object Create(ActorInitializer init) { return new GivesBuildableArea(this); } } @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public GivesBuildableArea(GivesBuildableAreaInfo info) : base(info) { } - readonly HashSet noAreaTypes = new HashSet(); + readonly HashSet noAreaTypes = new(); public HashSet AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } diff --git a/OpenRA.Mods.Common/Traits/Buildings/LineBuild.cs b/OpenRA.Mods.Common/Traits/Buildings/LineBuild.cs index e26e356681..26b5858821 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/LineBuild.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/LineBuild.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Range = 5; [Desc("LineBuildNode 'Types' to attach to.")] - public readonly HashSet NodeTypes = new HashSet { "wall" }; + public readonly HashSet NodeTypes = new() { "wall" }; [ActorReference(typeof(LineBuildInfo))] [Desc("Actor type for line-built segments (defaults to same actor).")] diff --git a/OpenRA.Mods.Common/Traits/Buildings/LineBuildNode.cs b/OpenRA.Mods.Common/Traits/Buildings/LineBuildNode.cs index 5568d4300a..64684df026 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/LineBuildNode.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/LineBuildNode.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class LineBuildNodeInfo : TraitInfo { [Desc("This actor is of LineBuild 'NodeType'...")] - public readonly HashSet Types = new HashSet { "wall" }; + public readonly HashSet Types = new() { "wall" }; [Desc("Cells (outside the footprint) that contain cells that can connect to this actor.")] public readonly CVec[] Connections = new[] { new CVec(1, 0), new CVec(0, 1), new CVec(-1, 0), new CVec(0, -1) }; diff --git a/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs index 57785e6231..b41f6cb8fc 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool BaselineSpawn = false; [Desc("Direction the aircraft should face to land.")] - public readonly WAngle Facing = new WAngle(256); + public readonly WAngle Facing = new(256); public override object Create(ActorInitializer init) { return new ProductionAirdrop(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 3c3cf81d60..b678ecfbd0 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -67,10 +67,10 @@ namespace OpenRA.Mods.Common.Traits { readonly IHealth health; readonly Predicate isNotActiveAlly; - readonly Stack repairTokens = new Stack(); + readonly Stack repairTokens = new(); int remainingTicks; - public readonly List Repairers = new List(); + public readonly List Repairers = new(); public bool RepairActive { get; private set; } public RepairableBuilding(Actor self, RepairableBuildingInfo info) diff --git a/OpenRA.Mods.Common/Traits/Buildings/RequiresBuildableArea.cs b/OpenRA.Mods.Common/Traits/Buildings/RequiresBuildableArea.cs index 90d0ed5154..29f1530013 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RequiresBuildableArea.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RequiresBuildableArea.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("Types of buildable are this actor requires.")] - public readonly HashSet AreaTypes = new HashSet(); + public readonly HashSet AreaTypes = new(); [Desc("Maximum range from the actor with 'GivesBuildableArea' this can be placed at.")] public readonly int Adjacent = 2; diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs index 7cc9a699e0..42d47eed16 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference] [FieldLoader.Require] - public readonly HashSet DockActors = new HashSet { }; + public readonly HashSet DockActors = new() { }; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs index bf3da0b2f1..f04127695e 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits [CursorReference(dictionaryReference: LintDictionaryReference.Values)] [Desc("Cursor overrides to display for specific terrain types.", "A dictionary of [terrain type]: [cursor name].")] - public readonly Dictionary TerrainCursors = new Dictionary(); + public readonly Dictionary TerrainCursors = new(); [CursorReference] [Desc("Cursor to display when a move order cannot be issued at target location.")] diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoRepairable.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoRepairable.cs index 3c5db035d3..1435cd0554 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoRepairable.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoRepairable.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits { [ActorReference] [FieldLoader.Require] - public readonly HashSet RepairActors = new HashSet { }; + public readonly HashSet RepairActors = new() { }; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs index 4b265c651d..2e79979c6d 100644 --- a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits class CapturableProgressBar : ConditionalTrait, ISelectionBar, ICaptureProgressWatcher { - readonly Dictionary progress = new Dictionary(); + readonly Dictionary progress = new(); public CapturableProgressBar(CapturableProgressBarInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBlink.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBlink.cs index 7a7154a688..fccfcb5a49 100644 --- a/OpenRA.Mods.Common/Traits/CapturableProgressBlink.cs +++ b/OpenRA.Mods.Common/Traits/CapturableProgressBlink.cs @@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits class CapturableProgressBlink : ConditionalTrait, ITick, ICaptureProgressWatcher { - readonly List captorOwners = new List(); - readonly HashSet captors = new HashSet(); + readonly List captorOwners = new(); + readonly HashSet captors = new(); int tick = 0; public CapturableProgressBlink(CapturableProgressBlinkInfo info) diff --git a/OpenRA.Mods.Common/Traits/CaptureManager.cs b/OpenRA.Mods.Common/Traits/CaptureManager.cs index 6643bce77b..624226a8eb 100644 --- a/OpenRA.Mods.Common/Traits/CaptureManager.cs +++ b/OpenRA.Mods.Common/Traits/CaptureManager.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits int beingCapturedToken = Actor.InvalidConditionToken; bool enteringCurrentTarget; - readonly HashSet currentCaptors = new HashSet(); + readonly HashSet currentCaptors = new(); public bool BeingCaptured { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 10eeee6263..aecccaa67c 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int MaxWeight = 0; [Desc("`Passenger.CargoType`s that can be loaded into this actor.")] - public readonly HashSet Types = new HashSet(); + public readonly HashSet Types = new(); [Desc("A list of actor types that are initially spawned into this actor.")] public readonly string[] InitialUnits = Array.Empty(); @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool EjectOnDeath = false; [Desc("Terrain types that this actor is allowed to eject actors onto. Leave empty for all terrain types.")] - public readonly HashSet UnloadTerrainTypes = new HashSet(); + public readonly HashSet UnloadTerrainTypes = new(); [VoiceReference] [Desc("Voice to play when ordered to unload the passengers.")] @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WDist LoadRange = WDist.FromCells(5); [Desc("Which direction the passenger will face (relative to the transport) when unloading.")] - public readonly WAngle PassengerFacing = new WAngle(512); + public readonly WAngle PassengerFacing = new(512); [Desc("Delay (in ticks) before continuing after loading a passenger.")] public readonly int AfterLoadDelay = 8; @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(dictionaryReference: LintDictionaryReference.Keys)] [Desc("Conditions to grant when specified actors are loaded inside the transport.", "A dictionary of [actor name]: [condition].")] - public readonly Dictionary PassengerConditions = new Dictionary(); + public readonly Dictionary PassengerConditions = new(); [GrantedConditionReference] public IEnumerable LinterPassengerConditions => PassengerConditions.Values; @@ -94,9 +94,9 @@ namespace OpenRA.Mods.Common.Traits { public readonly CargoInfo Info; readonly Actor self; - readonly List cargo = new List(); - readonly HashSet reserves = new HashSet(); - readonly Dictionary> passengerTokens = new Dictionary>(); + readonly List cargo = new(); + readonly HashSet reserves = new(); + readonly Dictionary> passengerTokens = new(); readonly Lazy facing; readonly bool checkTerrainType; @@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits int reservedWeight = 0; Aircraft aircraft; int loadingToken = Actor.InvalidConditionToken; - readonly Stack loadedTokens = new Stack(); + readonly Stack loadedTokens = new(); bool takeOffAfterLoad; bool initialised; diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs index 85ce2677ca..17d0cbd36b 100644 --- a/OpenRA.Mods.Common/Traits/Carryall.cs +++ b/OpenRA.Mods.Common/Traits/Carryall.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(dictionaryReference: LintDictionaryReference.Keys)] [Desc("Conditions to grant when a specified actor is being carried.", "A dictionary of [actor name]: [condition].")] - public readonly Dictionary CarryableConditions = new Dictionary(); + public readonly Dictionary CarryableConditions = new(); [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 0f8cb84161..1567b1e7f6 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Palette = "cloak"; public readonly bool IsPlayerPalette = false; - public readonly BitSet DetectionTypes = new BitSet("Cloak"); + public readonly BitSet DetectionTypes = new("Cloak"); [GrantedConditionReference] [Desc("The condition to grant to self while cloaked.")] diff --git a/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs index 54ab2554f8..da293509fa 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ExternalCondition.cs @@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Traits } public readonly ExternalConditionInfo Info; - readonly Dictionary> permanentTokens = new Dictionary>(); + readonly Dictionary> permanentTokens = new(); // Tokens are sorted on insert/remove by ascending expiry time - readonly List timedTokens = new List(); + readonly List timedTokens = new(); IConditionTimerWatcher[] watchers; int duration; int expires; diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs index d1e24091db..3eb301ecc7 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnAttack.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Condition = null; [Desc("Name of the armaments that grant this condition.")] - public readonly HashSet ArmamentNames = new HashSet() { "primary" }; + public readonly HashSet ArmamentNames = new() { "primary" }; [Desc("Shots required to apply an instance of the condition. If there are more instances of the condition granted than values listed,", "the last value is used for all following instances beyond the defined range.")] @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnAttack : PausableConditionalTrait, INotifyCreated, ITick, INotifyAttack { - readonly Stack tokens = new Stack(); + readonly Stack tokens = new(); int cooldown = 0; int shotsFired = 0; diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index e657e9a7c4..9a42a7073a 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string DeployedCondition = null; [Desc("The terrain types that this actor can deploy on. Leave empty to allow any.")] - public readonly HashSet AllowedTerrainTypes = new HashSet(); + public readonly HashSet AllowedTerrainTypes = new(); [Desc("Can this actor deploy on slopes?")] public readonly bool CanDeployOnRamps = false; diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnFaction.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnFaction.cs index 1c6985acdf..742bfd7e07 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnFaction.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnFaction.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Condition = null; [Desc("Only grant this condition for certain factions.")] - public readonly HashSet Factions = new HashSet(); + public readonly HashSet Factions = new(); [Desc("Should it recheck everything when it is captured?")] public readonly bool ResetOnOwnerChange = false; diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs index f9b532639f..c587da20f2 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference] [Desc("The actors to grant condition for. If empty condition will be granted for all actors.")] - public readonly HashSet Actors = new HashSet(); + public readonly HashSet Actors = new(); [Desc("How long condition is applies for. Use -1 for infinite.")] public readonly int Duration = -1; diff --git a/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs index a5ef0ca228..448be153c1 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/LineBuildSegmentExternalCondition.cs @@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits public class LineBuildSegmentExternalCondition : ConditionalTrait, INotifyLineBuildSegmentsChanged { - readonly HashSet segments = new HashSet(); - readonly Dictionary tokens = new Dictionary(); + readonly HashSet segments = new(); + readonly Dictionary tokens = new(); public LineBuildSegmentExternalCondition(LineBuildSegmentExternalConditionInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs index 5f1413c7b7..7d1b6410a5 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; - readonly Dictionary tokens = new Dictionary(); + readonly Dictionary tokens = new(); int proximityTrigger; WPos cachedPosition; diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 4f467322ac..481194f577 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Duration = 0; [Desc("Allowed to land on.")] - public readonly HashSet TerrainTypes = new HashSet(); + public readonly HashSet TerrainTypes = new(); [Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")] public readonly string CrushClass = "crate"; diff --git a/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs index c3ce74e84c..fb812bd371 100644 --- a/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/DuplicateUnitCrateAction.cs @@ -33,10 +33,10 @@ namespace OpenRA.Mods.Common.Traits public readonly int MaxRadius = 4; [Desc("The list of unit target types we are allowed to duplicate.")] - public readonly BitSet ValidTargets = new BitSet("Ground", "Water"); + public readonly BitSet ValidTargets = new("Ground", "Water"); [Desc("Which factions this crate action can occur for.")] - public readonly HashSet ValidFactions = new HashSet(); + public readonly HashSet ValidFactions = new(); [Desc("Is the new duplicates given to a specific owner, regardless of whom collected it?")] public readonly string Owner = null; diff --git a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs index 6884f0b6b2..ee184a3711 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] Units = Array.Empty(); [Desc("Factions that are allowed to trigger this action.")] - public readonly HashSet ValidFactions = new HashSet(); + public readonly HashSet ValidFactions = new(); [Desc("Override the owner of the newly spawned unit: e.g. Creeps or Neutral")] public readonly string Owner = null; @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; readonly GiveUnitCrateActionInfo info; - readonly List usedCells = new List(); + readonly List usedCells = new(); public GiveUnitCrateAction(Actor self, GiveUnitCrateActionInfo info) : base(self, info) diff --git a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs index 5f67eb5fa7..7663c12703 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GrantExternalConditionCrateAction.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Duration = 0; [Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")] - public readonly WDist Range = new WDist(3); + public readonly WDist Range = new(3); [Desc("The maximum number of extra collectors to grant the crate action to.", "-1 = no limit")] public readonly int MaxExtraCollectors = 4; diff --git a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs index 0437dab230..3d1c7861be 100644 --- a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Levels = 1; [Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")] - public readonly WDist Range = new WDist(3); + public readonly WDist Range = new(3); [Desc("The maximum number of extra collectors to grant the crate action to.")] public readonly int MaxExtraCollectors = 4; diff --git a/OpenRA.Mods.Common/Traits/Crushable.cs b/OpenRA.Mods.Common/Traits/Crushable.cs index 5227aa75a4..58b4f9ba13 100644 --- a/OpenRA.Mods.Common/Traits/Crushable.cs +++ b/OpenRA.Mods.Common/Traits/Crushable.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Sound to play when being crushed.")] public readonly string CrushSound = null; [Desc("Which crush classes does this actor belong to.")] - public readonly BitSet CrushClasses = new BitSet("infantry"); + public readonly BitSet CrushClasses = new("infantry"); [Desc("Probability of mobile actors noticing and evading a crush attempt.")] public readonly int WarnProbability = 75; [Desc("Will friendly units just crush me instead of pathing around.")] diff --git a/OpenRA.Mods.Common/Traits/Demolishable.cs b/OpenRA.Mods.Common/Traits/Demolishable.cs index 0ec2ecd67b..57c04dd8b4 100644 --- a/OpenRA.Mods.Common/Traits/Demolishable.cs +++ b/OpenRA.Mods.Common/Traits/Demolishable.cs @@ -46,8 +46,8 @@ namespace OpenRA.Mods.Common.Traits } } - readonly List actions = new List(); - readonly List removeActions = new List(); + readonly List actions = new(); + readonly List removeActions = new(); IDamageModifier[] damageModifiers; public Demolishable(DemolishableInfo info) diff --git a/OpenRA.Mods.Common/Traits/DetectCloaked.cs b/OpenRA.Mods.Common/Traits/DetectCloaked.cs index 8052a59fb7..dfe0482ebe 100644 --- a/OpenRA.Mods.Common/Traits/DetectCloaked.cs +++ b/OpenRA.Mods.Common/Traits/DetectCloaked.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class DetectCloakedInfo : ConditionalTraitInfo { [Desc("Specific cloak classifications I can reveal.")] - public readonly BitSet DetectionTypes = new BitSet("Cloak"); + public readonly BitSet DetectionTypes = new("Cloak"); public readonly WDist Range = WDist.FromCells(5); diff --git a/OpenRA.Mods.Common/Traits/Encyclopedia.cs b/OpenRA.Mods.Common/Traits/Encyclopedia.cs index 4439210403..e978764c42 100644 --- a/OpenRA.Mods.Common/Traits/Encyclopedia.cs +++ b/OpenRA.Mods.Common/Traits/Encyclopedia.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits public class Encyclopedia { - public static readonly Encyclopedia Instance = new Encyclopedia(); + public static readonly Encyclopedia Instance = new(); Encyclopedia() { } } } diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index 85c0582709..d071cef699 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits readonly GainsExperienceInfo info; readonly int initialExperience; - readonly List<(int RequiredExperience, string Condition)> nextLevel = new List<(int, string)>(); + readonly List<(int RequiredExperience, string Condition)> nextLevel = new(); // Stored as a percentage of our value [Sync] diff --git a/OpenRA.Mods.Common/Traits/GivesBounty.cs b/OpenRA.Mods.Common/Traits/GivesBounty.cs index c85fe94d10..560da701ed 100644 --- a/OpenRA.Mods.Common/Traits/GivesBounty.cs +++ b/OpenRA.Mods.Common/Traits/GivesBounty.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits class GivesBounty : ConditionalTrait, INotifyKilled, INotifyPassengerEntered, INotifyPassengerExited { - readonly Dictionary passengerBounties = new Dictionary(); + readonly Dictionary passengerBounties = new(); public GivesBounty(GivesBountyInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index bb180bc247..8914f7f997 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -22,13 +22,13 @@ namespace OpenRA.Mods.Common.Traits { public class HarvesterInfo : ConditionalTraitInfo, Requires { - public readonly HashSet DeliveryBuildings = new HashSet(); + public readonly HashSet DeliveryBuildings = new(); [Desc("How long (in ticks) to wait until (re-)checking for a nearby available DeliveryBuilding if not yet linked to one.")] public readonly int SearchForDeliveryBuildingDelay = 125; [Desc("Cell to move to when automatically unblocking DeliveryBuilding.")] - public readonly CVec UnblockCell = new CVec(0, 4); + public readonly CVec UnblockCell = new(0, 4); [Desc("How much resources it can carry.")] public readonly int Capacity = 28; @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int HarvestFacings = 0; [Desc("Which resources it can harvest.")] - public readonly HashSet Resources = new HashSet(); + public readonly HashSet Resources = new(); [Desc("Percentage of maximum speed when fully loaded.")] public readonly int FullyLoadedSpeed = 85; @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits readonly Mobile mobile; readonly IResourceLayer resourceLayer; readonly ResourceClaimLayer claimLayer; - readonly Dictionary contents = new Dictionary(); + readonly Dictionary contents = new(); int conditionToken = Actor.InvalidConditionToken; [Sync] diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index 4afee74f84..c9db6ef105 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -20,10 +20,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("Spawns remains of a husk actor with the correct facing.")] public class HuskInfo : TraitInfo, IPositionableInfo, IFacingInfo, IActorPreviewInitInfo { - public readonly HashSet AllowedTerrain = new HashSet(); + public readonly HashSet AllowedTerrain = new(); [Desc("Facing to use for actor previews (map editor, color picker, etc)")] - public readonly WAngle PreviewFacing = new WAngle(384); + public readonly WAngle PreviewFacing = new(384); IEnumerable IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type) { diff --git a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs index 0e066deb6a..e8e70a2e10 100644 --- a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs +++ b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int AttackPanicChance = 20; [Desc("The terrain types that this actor should avoid running on to while panicking.")] - public readonly HashSet AvoidTerrainTypes = new HashSet(); + public readonly HashSet AvoidTerrainTypes = new(); [SequenceReference(prefix: true)] public readonly string PanicSequencePrefix = "panic-"; diff --git a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs index df122a4c68..e05c9e20d5 100644 --- a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs +++ b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs @@ -31,10 +31,10 @@ namespace OpenRA.Mods.Common.Traits public readonly BitSet DamageTriggers = default; [Desc("Damage modifiers for each damage type (defined on the warheads) while the unit is prone.")] - public readonly Dictionary DamageModifiers = new Dictionary(); + public readonly Dictionary DamageModifiers = new(); [Desc("Muzzle offset modifier to apply while prone.")] - public readonly WVec ProneOffset = new WVec(500, 0, 0); + public readonly WVec ProneOffset = new(500, 0, 0); [SequenceReference(prefix: true)] [Desc("Sequence prefix to apply while prone.")] diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 1fd743539f..b91a89ae11 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WAngle InitialFacing = WAngle.Zero; [Desc("Speed at which the actor turns.")] - public readonly WAngle TurnSpeed = new WAngle(512); + public readonly WAngle TurnSpeed = new(512); public readonly int Speed = 1; @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits [CursorReference(dictionaryReference: LintDictionaryReference.Values)] [Desc("Cursor overrides to display for specific terrain types.", "A dictionary of [terrain type]: [cursor name].")] - public readonly Dictionary TerrainCursors = new Dictionary(); + public readonly Dictionary TerrainCursors = new(); [CursorReference] [Desc("Cursor to display when a move order cannot be issued at target location.")] @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Color TargetLineColor = Color.Green; [Desc("Facing to use for actor previews (map editor, color picker, etc)")] - public readonly WAngle PreviewFacing = new WAngle(384); + public readonly WAngle PreviewFacing = new(384); [Desc("Display order for the facing slider in the map editor")] public readonly int EditorFacingDisplayOrder = 3; @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("The distance from the edge of a cell over which the actor will adjust its tilt when moving between cells with different ramp types.", "-1 means that the actor does not tilt on slopes.")] - public readonly WDist TerrainOrientationAdjustmentMargin = new WDist(-1); + public readonly WDist TerrainOrientationAdjustmentMargin = new(-1); IEnumerable IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type) { diff --git a/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs index 625230d5f1..60f8606e34 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/ProductionCostMultiplier.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] Prerequisites = Array.Empty(); [Desc("Queues that this cost will apply.")] - public readonly HashSet Queue = new HashSet(); + public readonly HashSet Queue = new(); int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue) { diff --git a/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs b/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs index 5dd04b659b..597f0703fa 100644 --- a/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs +++ b/OpenRA.Mods.Common/Traits/Multipliers/ProductionTimeMultiplier.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] Prerequisites = Array.Empty(); [Desc("Queues that this time will apply.")] - public readonly HashSet Queue = new HashSet(); + public readonly HashSet Queue = new(); int IProductionTimeModifierInfo.GetProductionTimeModifier(TechTree techTree, string queue) { diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/FlashPaletteEffect.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/FlashPaletteEffect.cs index 7f84b8020b..489031d0df 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/FlashPaletteEffect.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/FlashPaletteEffect.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Used for bursted one-colored whole screen effects. Add this to the world actor.")] public class FlashPaletteEffectInfo : TraitInfo { - public readonly HashSet ExcludePalettes = new HashSet { "cursor", "chrome", "colorpicker", "fog", "shroud" }; + public readonly HashSet ExcludePalettes = new() { "cursor", "chrome", "colorpicker", "fog", "shroud" }; [Desc("Measured in ticks.")] public readonly int Length = 20; diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/GlobalLightingPaletteEffect.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/GlobalLightingPaletteEffect.cs index ea1951f2ca..fc9831d038 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/GlobalLightingPaletteEffect.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/GlobalLightingPaletteEffect.cs @@ -21,10 +21,10 @@ namespace OpenRA.Mods.Common.Traits public class GlobalLightingPaletteEffectInfo : TraitInfo, ILobbyCustomRulesIgnore { [Desc("Do not modify graphics that use any palette in this list.")] - public readonly HashSet ExcludePalettes = new HashSet { "cursor", "chrome", "colorpicker", "fog", "shroud", "alpha" }; + public readonly HashSet ExcludePalettes = new() { "cursor", "chrome", "colorpicker", "fog", "shroud", "alpha" }; [Desc("Do not modify graphics that start with these letters.")] - public readonly HashSet ExcludePalettePrefixes = new HashSet(); + public readonly HashSet ExcludePalettePrefixes = new(); public readonly float Red = 1f; public readonly float Green = 1f; diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs index 80e48e450e..fe37eb20e0 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs @@ -21,17 +21,17 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Defines to which palettes this effect should be applied to.", "If none specified, it applies to all palettes not explicitly excluded.")] - public readonly HashSet Palettes = new HashSet(); + public readonly HashSet Palettes = new(); [Desc("Defines for which tileset IDs this effect should be loaded.", "If none specified, it applies to all tileset IDs not explicitly excluded.")] - public readonly HashSet Tilesets = new HashSet(); + public readonly HashSet Tilesets = new(); [Desc("Defines which palettes should be excluded from this effect.")] - public readonly HashSet ExcludePalettes = new HashSet(); + public readonly HashSet ExcludePalettes = new(); [Desc("Don't apply the effect for these tileset IDs.")] - public readonly HashSet ExcludeTilesets = new HashSet(); + public readonly HashSet ExcludeTilesets = new(); [Desc("Palette index of first RotationRange color.")] public readonly int RotationBase = 0x60; diff --git a/OpenRA.Mods.Common/Traits/Palettes/IndexedPalette.cs b/OpenRA.Mods.Common/Traits/Palettes/IndexedPalette.cs index 84c4cfea0a..19b6e9f84c 100644 --- a/OpenRA.Mods.Common/Traits/Palettes/IndexedPalette.cs +++ b/OpenRA.Mods.Common/Traits/Palettes/IndexedPalette.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits public class IndexedColorRemap : IPaletteRemap { - readonly Dictionary replacements = new Dictionary(); + readonly Dictionary replacements = new(); readonly IPalette basePalette; public IndexedColorRemap(IPalette basePalette, int[] ramp, int[] remap) diff --git a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs index 4a23897dc2..9ed6852543 100644 --- a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs +++ b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGimpOrJascFile.cs @@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("Defines for which tileset IDs this palette should be loaded.", "If none specified, it applies to all tileset IDs not explicitly excluded.")] - public readonly HashSet Tilesets = new HashSet(); + public readonly HashSet Tilesets = new(); [Desc("Don't load palette for these tileset IDs.")] - public readonly HashSet ExcludeTilesets = new HashSet(); + public readonly HashSet ExcludeTilesets = new(); [FieldLoader.Require] [Desc("Name of the file to load.")] diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 19635118dd..922358d062 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string WaterCorpsePalette = "effect"; [Desc("Terrain types on which to display WaterCorpseSequence.")] - public readonly HashSet WaterTerrainTypes = new HashSet { "Water" }; + public readonly HashSet WaterTerrainTypes = new() { "Water" }; public readonly string WaterImpactSound = null; diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs index a2bf0e3241..f0a10e1ea7 100644 --- a/OpenRA.Mods.Common/Traits/Passenger.cs +++ b/OpenRA.Mods.Common/Traits/Passenger.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(dictionaryReference: LintDictionaryReference.Keys)] [Desc("Conditions to grant when this actor is loaded inside specified transport.", "A dictionary of [actor name]: [condition].")] - public readonly Dictionary CargoConditions = new Dictionary(); + public readonly Dictionary CargoConditions = new(); [GrantedConditionReference] public IEnumerable LinterCargoConditions => CargoConditions.Values; diff --git a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs index c1f43db358..ea25a689b2 100644 --- a/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs +++ b/OpenRA.Mods.Common/Traits/Player/GrantConditionOnPrerequisiteManager.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public class GrantConditionOnPrerequisiteManager : ITechTreeElement { readonly Actor self; - readonly Dictionary> upgradables = new Dictionary>(); + readonly Dictionary> upgradables = new(); readonly TechTree techTree; public GrantConditionOnPrerequisiteManager(ActorInitializer init) diff --git a/OpenRA.Mods.Common/Traits/Player/LobbyPrerequisiteCheckbox.cs b/OpenRA.Mods.Common/Traits/Player/LobbyPrerequisiteCheckbox.cs index 924270067c..2c6c73ca6b 100644 --- a/OpenRA.Mods.Common/Traits/Player/LobbyPrerequisiteCheckbox.cs +++ b/OpenRA.Mods.Common/Traits/Player/LobbyPrerequisiteCheckbox.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits [FieldLoader.Require] [Desc("Prerequisites to grant when this checkbox is enabled.")] - public readonly HashSet Prerequisites = new HashSet(); + public readonly HashSet Prerequisites = new(); IEnumerable ITechTreePrerequisiteInfo.Prerequisites(ActorInfo info) { return Prerequisites; } @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits public class LobbyPrerequisiteCheckbox : INotifyCreated, ITechTreePrerequisite { readonly LobbyPrerequisiteCheckboxInfo info; - HashSet prerequisites = new HashSet(); + HashSet prerequisites = new(); public LobbyPrerequisiteCheckbox(LobbyPrerequisiteCheckboxInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs index 469f5a45be..4464e734ca 100644 --- a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs +++ b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits public class MissionObjectives : INotifyWinStateChanged, ISync, IResolveOrder, IWorldLoaded { public readonly MissionObjectivesInfo Info; - readonly List objectives = new List(); + readonly List objectives = new(); readonly Player player; public IReadOnlyList Objectives => objectives; diff --git a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs index 6ff5875b01..bdc7f2e574 100644 --- a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs +++ b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits readonly ModularBotInfo info; readonly World world; - readonly Queue orders = new Queue(); + readonly Queue orders = new(); Player player; diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index ac42ffb814..f4b60d2b14 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string CannotPlaceTextNotification = null; [Desc("Hotkey to toggle between PlaceBuildingVariants when placing a structure.")] - public readonly HotkeyReference ToggleVariantKey = new HotkeyReference(); + public readonly HotkeyReference ToggleVariantKey = new(); public override object Create(ActorInitializer init) { return new PlaceBuilding(this); } } diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index 1b1de58bd7..70cef6caa7 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string CashTickDownNotification = null; [Desc("Monetary value of each resource type.", "Dictionary of [resource type]: [value per unit].")] - public readonly Dictionary ResourceValues = new Dictionary(); + public readonly Dictionary ResourceValues = new(); IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index a98dc2e761..f9745620cf 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Traits public int Experience => experience != null ? experience.Experience : 0; // Low resolution (every 30 seconds) record of earnings, covering the entire game - public List IncomeSamples = new List(100); + public List IncomeSamples = new(100); public int Income; public int DisplayIncome; - public List ArmySamples = new List(100); + public List ArmySamples = new(100); public int KillsCost; public int DeathsCost; @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits public int AssetsValue; // High resolution (every second) record of earnings, limited to the last minute - readonly Queue earnedSeconds = new Queue(60); + readonly Queue earnedSeconds = new(60); int lastIncome; int lastIncomeTick; diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 339e72cc17..08e8820f7e 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Group = null; [Desc("Only enable this queue for certain factions.")] - public readonly HashSet Factions = new HashSet(); + public readonly HashSet Factions = new(); [Desc("Should the prerequisite remain enabled if the owner changes?")] public readonly bool Sticky = true; @@ -128,8 +128,8 @@ namespace OpenRA.Mods.Common.Traits public readonly ProductionQueueInfo Info; // A list of things we could possibly build - protected readonly Dictionary Producible = new Dictionary(); - protected readonly List Queue = new List(); + protected readonly Dictionary Producible = new(); + protected readonly List Queue = new(); readonly IEnumerable allProducibles; readonly IEnumerable buildableProducibles; diff --git a/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs b/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs index 06995346c6..f407c7cb91 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProvidesPrerequisite.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] RequiresPrerequisites = Array.Empty(); [Desc("Only grant this prerequisite for certain factions.")] - public readonly HashSet Factions = new HashSet(); + public readonly HashSet Factions = new(); [Desc("Should it recheck everything when it is captured?")] public readonly bool ResetOnOwnerChange = false; diff --git a/OpenRA.Mods.Common/Traits/Player/TechTree.cs b/OpenRA.Mods.Common/Traits/Player/TechTree.cs index 444a3e2cd1..ad54f110a0 100644 --- a/OpenRA.Mods.Common/Traits/Player/TechTree.cs +++ b/OpenRA.Mods.Common/Traits/Player/TechTree.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public class TechTree { - readonly List watchers = new List(); + readonly List watchers = new(); public TechTree(ActorInitializer init) { diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index 3998483dbd..cbf9047e15 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -30,12 +30,12 @@ namespace OpenRA.Mods.Common.Traits [Desc("Requirements for accepting a plug type.", "Key is the plug type that the requirements applies to.", "Value is the condition expression defining the requirements to place the plug.")] - public readonly Dictionary Requirements = new Dictionary(); + public readonly Dictionary Requirements = new(); [Desc("Options to display in the map editor.", "Key is the plug type that the requirements applies to.", "Value is the label that is displayed in the actor editor dropdown.")] - public readonly Dictionary EditorOptions = new Dictionary(); + public readonly Dictionary EditorOptions = new(); [Desc("Label to use for an empty plug socket.")] public readonly string EmptyOption = "Empty"; diff --git a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs index 0156eaa018..8e1a0df9b3 100644 --- a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs +++ b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits readonly PowerManagerInfo info; readonly DeveloperMode devMode; - readonly Dictionary powerDrain = new Dictionary(); + readonly Dictionary powerDrain = new(); [Sync] int totalProvided; diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs index 86f3068916..ca25d8b9de 100644 --- a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs +++ b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WDist Range = WDist.FromCells(5); [Desc("Allowed ProximityCaptor actors to capture this actor.")] - public readonly BitSet CaptorTypes = new BitSet("Player", "Vehicle", "Tank", "Infantry"); + public readonly BitSet CaptorTypes = new("Player", "Vehicle", "Tank", "Infantry"); [Desc("If set, the capturing process stops immediately after another player comes into Range.")] public readonly bool MustBeClear = false; @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits public ProximityCapturableInfo Info; public Actor Self; - readonly List actorsInRange = new List(); + readonly List actorsInRange = new(); int proximityTrigger; WPos prevPosition; bool skipTriggerUpdate; diff --git a/OpenRA.Mods.Common/Traits/Rearmable.cs b/OpenRA.Mods.Common/Traits/Rearmable.cs index 97ec51ddc8..c3031564a5 100644 --- a/OpenRA.Mods.Common/Traits/Rearmable.cs +++ b/OpenRA.Mods.Common/Traits/Rearmable.cs @@ -20,10 +20,10 @@ namespace OpenRA.Mods.Common.Traits [ActorReference] [FieldLoader.Require] [Desc("Actors that this actor can dock to and get rearmed by.")] - public readonly HashSet RearmActors = new HashSet { }; + public readonly HashSet RearmActors = new() { }; [Desc("Name(s) of AmmoPool(s) that use this trait to rearm.")] - public readonly HashSet AmmoPools = new HashSet { "primary" }; + public readonly HashSet AmmoPools = new() { "primary" }; public override object Create(ActorInitializer init) { return new Rearmable(this); } } diff --git a/OpenRA.Mods.Common/Traits/RejectsOrders.cs b/OpenRA.Mods.Common/Traits/RejectsOrders.cs index cfada3e041..bba8dd1bcf 100644 --- a/OpenRA.Mods.Common/Traits/RejectsOrders.cs +++ b/OpenRA.Mods.Common/Traits/RejectsOrders.cs @@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits public class RejectsOrdersInfo : ConditionalTraitInfo { [Desc("Explicit list of rejected orders. Leave empty to reject all minus those listed under Except.")] - public readonly HashSet Reject = new HashSet(); + public readonly HashSet Reject = new(); [Desc("List of orders that should *not* be rejected.", "Also overrides other instances of this trait's Reject fields.")] - public readonly HashSet Except = new HashSet(); + public readonly HashSet Except = new(); public override object Create(ActorInitializer init) { return new RejectsOrders(this); } } diff --git a/OpenRA.Mods.Common/Traits/Render/Contrail.cs b/OpenRA.Mods.Common/Traits/Render/Contrail.cs index 9724ba9ae1..226b743e97 100644 --- a/OpenRA.Mods.Common/Traits/Render/Contrail.cs +++ b/OpenRA.Mods.Common/Traits/Render/Contrail.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int TrailDelay = 0; [Desc("Thickness of the emitted line.")] - public readonly WDist TrailWidth = new WDist(64); + public readonly WDist TrailWidth = new(64); [Desc("RGB color at the contrail start.")] public readonly Color StartColor = Color.White; diff --git a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs index 74d74931f7..6ff293beff 100644 --- a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs +++ b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public class DrawLineToTarget : IRenderAboveShroud, IRenderAnnotationsWhenSelected, INotifySelected { readonly DrawLineToTargetInfo info; - readonly List renderableCache = new List(); + readonly List renderableCache = new(); long lifetime; public DrawLineToTarget(DrawLineToTargetInfo info) diff --git a/OpenRA.Mods.Common/Traits/Render/Hovers.cs b/OpenRA.Mods.Common/Traits/Render/Hovers.cs index 3bffd36913..49eed9d3d2 100644 --- a/OpenRA.Mods.Common/Traits/Render/Hovers.cs +++ b/OpenRA.Mods.Common/Traits/Render/Hovers.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits.Render public class HoversInfo : ConditionalTraitInfo, Requires { [Desc("Maximum visual Z axis distance relative to actual position + InitialHeight.")] - public readonly WDist BobDistance = new WDist(-43); + public readonly WDist BobDistance = new(-43); [Desc("Actual altitude of actor needs to be this or higher to enable hover effect.")] public readonly WDist MinHoveringAltitude = WDist.Zero; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly int RiseTicks = 20; [Desc("Initial Z axis modifier relative to actual position.")] - public readonly WDist InitialHeight = new WDist(43); + public readonly WDist InitialHeight = new(43); public override object Create(ActorInitializer init) { return new Hovers(this); } diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs index ebc9a9132c..ed75b4b401 100644 --- a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly string Palette = "effect"; [Desc("Only leave trail on listed terrain types. Leave empty to leave trail on all terrain types.")] - public readonly HashSet TerrainTypes = new HashSet(); + public readonly HashSet TerrainTypes = new(); [Desc("Accepts values: Cell to draw the trail sprite in the center of the current cell,", "CenterPosition to draw the trail sprite at the current position.")] diff --git a/OpenRA.Mods.Common/Traits/Render/ProductionIconOverlayManager.cs b/OpenRA.Mods.Common/Traits/Render/ProductionIconOverlayManager.cs index 76ecbd9f3a..1cf2f64d4f 100644 --- a/OpenRA.Mods.Common/Traits/Render/ProductionIconOverlayManager.cs +++ b/OpenRA.Mods.Common/Traits/Render/ProductionIconOverlayManager.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render // This makes sure that the keys are unique with respect to the registering ITechTreeElement. readonly string prefix; - readonly Dictionary overlayActive = new Dictionary(); + readonly Dictionary overlayActive = new(); public ProductionIconOverlayManager(ActorInitializer init, ProductionIconOverlayManagerInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs index 32c3dbe7c9..27865fcb60 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits.Render public class RenderDetectionCircleInfo : TraitInfo, Requires { [Desc("WAngle the Radar update line advances per tick.")] - public readonly WAngle UpdateLineTick = new WAngle(-1); + public readonly WAngle UpdateLineTick = new(-1); [Desc("Number of trailing Radar update lines.")] public readonly int TrailCount = 0; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index 8eab8427f0..8e4d262b53 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly RenderSpritesInfo Info; readonly string faction; - readonly List anims = new List(); + readonly List anims = new(); string cachedImage; public static Func MakeFacingFunc(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs index 6bf0458944..7090e6761f 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs @@ -105,8 +105,8 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly RenderVoxelsInfo Info; - readonly List components = new List(); - readonly Dictionary wrappers = new Dictionary(); + readonly List components = new(); + readonly Dictionary wrappers = new(); readonly Actor self; readonly BodyOrientation body; diff --git a/OpenRA.Mods.Common/Traits/Render/WithAircraftLandingEffect.cs b/OpenRA.Mods.Common/Traits/Render/WithAircraftLandingEffect.cs index 2590a5b3a1..b4c786cfe8 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAircraftLandingEffect.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAircraftLandingEffect.cs @@ -32,10 +32,10 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly bool VisibleThroughFog = false; [Desc("Height at which to play the animation when descending.")] - public readonly WDist DistanceAboveTerrain = new WDist(756); + public readonly WDist DistanceAboveTerrain = new(756); [Desc("Only play on these terrain types.")] - public readonly HashSet TerrainTypes = new HashSet(); + public readonly HashSet TerrainTypes = new(); public override object Create(ActorInitializer init) { return new WithAircraftLandingEffect(this); } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithCargoPipsDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithCargoPipsDecoration.cs index 45d78020e7..a8a11b2a99 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithCargoPipsDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithCargoPipsDecoration.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Render [SequenceReference(nameof(Image), dictionaryReference: LintDictionaryReference.Values)] [Desc("Pip sequence to use for specific passenger actors.")] - public readonly Dictionary CustomPipSequences = new Dictionary(); + public readonly Dictionary CustomPipSequences = new(); [PaletteReference] public readonly string Palette = "chrome"; diff --git a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs index c67d0defb2..1af100af59 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithCrateBody.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly string[] XmasImages = Array.Empty(); [Desc("Terrain types on which to display WaterSequence.")] - public readonly HashSet WaterTerrainTypes = new HashSet { "Water" }; + public readonly HashSet WaterTerrainTypes = new() { "Water" }; [SequenceReference] public readonly string IdleSequence = "idle"; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs index aba25b29a1..58c1f21b5b 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Death animations to use for each damage type (defined on the warheads).", "Is only used if UseDeathTypeSuffix is `True`.")] - public readonly Dictionary DeathTypes = new Dictionary(); + public readonly Dictionary DeathTypes = new(); [SequenceReference] [Desc("Sequence to use when the actor is killed by some non-standard means (e.g. suicide).")] diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs index dc04ea2a14..1798f4555c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Screen-space offsets to apply when defined conditions are enabled.", "A dictionary of [condition string]: [x, y offset].")] - public readonly Dictionary Offsets = new Dictionary(); + public readonly Dictionary Offsets = new(); [Desc("The number of ticks that each step in the blink pattern in active.")] public readonly int BlinkInterval = 5; @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Override blink conditions to use when defined conditions are enabled.", "A dictionary of [condition string]: [pattern].")] - public readonly Dictionary BlinkPatterns = new Dictionary(); + public readonly Dictionary BlinkPatterns = new(); [ConsumedConditionReference] public IEnumerable ConsumedConditions diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvesterPipsDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvesterPipsDecoration.cs index c6d7124488..3534ecd6e6 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvesterPipsDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvesterPipsDecoration.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits.Render [SequenceReference(nameof(Image), dictionaryReference: LintDictionaryReference.Values)] [Desc("Pip sequence to use for specific resource types.")] - public readonly Dictionary ResourceSequences = new Dictionary(); + public readonly Dictionary ResourceSequences = new(); [PaletteReference] public readonly string Palette = "chrome"; diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs index 8c82767009..e492814b3d 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Attack sequence to use for each armament.", "A dictionary of [armament name]: [sequence name(s)].", "Multiple sequence names can be defined to specify per-burst animations.")] - public readonly Dictionary AttackSequences = new Dictionary(); + public readonly Dictionary AttackSequences = new(); [SequenceReference] public readonly string[] IdleSequences = Array.Empty(); diff --git a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs index 240e93903d..6e88455046 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs @@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits.Render class WithMuzzleOverlay : ConditionalTrait, INotifyAttack, IRender, ITick { - readonly Dictionary visible = new Dictionary(); - readonly Dictionary anims = new Dictionary(); + readonly Dictionary visible = new(); + readonly Dictionary anims = new(); readonly Func getFacing; readonly Armament[] armaments; diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs index 16269196ac..e2210d4447 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly bool IsPlayerPalette = true; [Desc("Parachute position relative to the paradropped unit.")] - public readonly WVec Offset = new WVec(0, 0, 384); + public readonly WVec Offset = new(0, 0, 384); [Desc("The image that contains the shadow sequence for the paradropped unit.")] public readonly string ShadowImage = null; @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly Color ShadowColor = Color.FromArgb(140, 0, 0, 0); [Desc("Shadow position relative to the paradropped unit's intended landing position.")] - public readonly WVec ShadowOffset = new WVec(0, 128, 0); + public readonly WVec ShadowOffset = new(0, 128, 0); [Desc("Z-offset to apply on the shadow sequence.")] public readonly int ShadowZOffset = 0; diff --git a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs index 171ebfa525..e2837f88f0 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Render public class WithProductionOverlayInfo : PausableConditionalTraitInfo, Requires, Requires, Requires { [Desc("Queues that should be producing for this overlay to render.")] - public readonly HashSet Queues = new HashSet(); + public readonly HashSet Queues = new(); [SequenceReference] [Desc("Sequence name to use")] diff --git a/OpenRA.Mods.Common/Traits/Repairable.cs b/OpenRA.Mods.Common/Traits/Repairable.cs index aa44ef4cca..7fe00bc9ea 100644 --- a/OpenRA.Mods.Common/Traits/Repairable.cs +++ b/OpenRA.Mods.Common/Traits/Repairable.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits { [ActorReference] [FieldLoader.Require] - public readonly HashSet RepairActors = new HashSet { }; + public readonly HashSet RepairActors = new() { }; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/RepairableNear.cs b/OpenRA.Mods.Common/Traits/RepairableNear.cs index 709a83a8df..86726f580b 100644 --- a/OpenRA.Mods.Common/Traits/RepairableNear.cs +++ b/OpenRA.Mods.Common/Traits/RepairableNear.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits { [ActorReference] [FieldLoader.Require] - public readonly HashSet RepairActors = new HashSet { }; + public readonly HashSet RepairActors = new() { }; public readonly WDist CloseEnough = WDist.FromCells(4); diff --git a/OpenRA.Mods.Common/Traits/Replaceable.cs b/OpenRA.Mods.Common/Traits/Replaceable.cs index aff156e87d..fc4b2fa948 100644 --- a/OpenRA.Mods.Common/Traits/Replaceable.cs +++ b/OpenRA.Mods.Common/Traits/Replaceable.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("Replacement types this Replaceable actor accepts.")] - public readonly HashSet Types = new HashSet(); + public readonly HashSet Types = new(); public override object Create(ActorInitializer init) { return new Replaceable(this); } } diff --git a/OpenRA.Mods.Common/Traits/Replacement.cs b/OpenRA.Mods.Common/Traits/Replacement.cs index 9eada86f26..1e4e1d35b7 100644 --- a/OpenRA.Mods.Common/Traits/Replacement.cs +++ b/OpenRA.Mods.Common/Traits/Replacement.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("Replacement type (matched against Types in Replaceable).")] - public readonly HashSet ReplaceableTypes = new HashSet(); + public readonly HashSet ReplaceableTypes = new(); } public class Replacement { } diff --git a/OpenRA.Mods.Common/Traits/RequiresSpecificOwners.cs b/OpenRA.Mods.Common/Traits/RequiresSpecificOwners.cs index d4ec7628c5..9f85e5cfb1 100644 --- a/OpenRA.Mods.Common/Traits/RequiresSpecificOwners.cs +++ b/OpenRA.Mods.Common/Traits/RequiresSpecificOwners.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits { [Desc("Only allow players listed here as owners.")] [FieldLoader.Require] - public readonly HashSet ValidOwnerNames = new HashSet(); + public readonly HashSet ValidOwnerNames = new(); } public class RequiresSpecificOwners { } diff --git a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs index f462295311..c0dd2ce84e 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Duration = 25; [Desc("Radius of the reveal around this actor.")] - public readonly WDist Radius = new WDist(1536); + public readonly WDist Radius = new(1536); [Desc("Can this actor be revealed through shroud generated by the `" + nameof(CreatesShroud) + "` trait?")] public readonly bool RevealGeneratedShroud = true; diff --git a/OpenRA.Mods.Common/Traits/RevealOnFire.cs b/OpenRA.Mods.Common/Traits/RevealOnFire.cs index 0ea56c9592..654dac86b4 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnFire.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnFire.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Duration = 25; [Desc("Radius of the reveal around this actor.")] - public readonly WDist Radius = new WDist(1536); + public readonly WDist Radius = new(1536); [Desc("Can this actor be revealed through shroud generated by the `" + nameof(CreatesShroud) + "` trait?")] public readonly bool RevealGeneratedShroud = true; diff --git a/OpenRA.Mods.Common/Traits/ScriptTags.cs b/OpenRA.Mods.Common/Traits/ScriptTags.cs index 0afad33166..bb3d9c73ab 100644 --- a/OpenRA.Mods.Common/Traits/ScriptTags.cs +++ b/OpenRA.Mods.Common/Traits/ScriptTags.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits public class ScriptTags { - readonly HashSet tags = new HashSet(); + readonly HashSet tags = new(); public ScriptTags(ActorInitializer init, ScriptTagsInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs index 045e352c7f..670e962df7 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Sound class AmbientSound : ConditionalTrait, ITick, INotifyRemovedFromWorld { readonly bool loop; - readonly HashSet currentSounds = new HashSet(); + readonly HashSet currentSounds = new(); WPos cachedPosition; int delay; diff --git a/OpenRA.Mods.Common/Traits/SpawnActorsOnSell.cs b/OpenRA.Mods.Common/Traits/SpawnActorsOnSell.cs index 6948518629..9cc88360ff 100644 --- a/OpenRA.Mods.Common/Traits/SpawnActorsOnSell.cs +++ b/OpenRA.Mods.Common/Traits/SpawnActorsOnSell.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Spawns actors only if the selling player's faction is in this list. " + "Leave empty to allow all factions by default.")] - public readonly HashSet Factions = new HashSet(); + public readonly HashSet Factions = new(); public override object Create(ActorInitializer init) { return new SpawnActorsOnSell(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 7c29706f55..0a8c23192e 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -24,10 +24,10 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(typeof(AircraftInfo))] public readonly string UnitType = "badr.bomber"; public readonly int SquadSize = 1; - public readonly WVec SquadOffset = new WVec(-1536, 1536, 0); + public readonly WVec SquadOffset = new(-1536, 1536, 0); public readonly int QuantizedFacings = 32; - public readonly WDist Cordon = new WDist(5120); + public readonly WDist Cordon = new(5120); [ActorReference] [Desc("Actor to spawn when the aircraft start attacking")] diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index b5e7ba1c11..5adadd25b5 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int FlightDelay = 400; [Desc("Visual ascent velocity in WDist / tick.")] - public readonly WDist FlightVelocity = new WDist(512); + public readonly WDist FlightVelocity = new(512); [Desc("Descend immediately on the target.")] public readonly bool SkipAscent = false; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs index c1fe2469bf..76ceac8a00 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(typeof(AircraftInfo))] public readonly string UnitType = "badr"; public readonly int SquadSize = 1; - public readonly WVec SquadOffset = new WVec(-1536, 1536, 0); + public readonly WVec SquadOffset = new(-1536, 1536, 0); [NotificationReference("Speech")] [Desc("Speech notification to play when entering the drop zone.")] @@ -37,7 +37,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); [ActorReference(typeof(PassengerInfo))] [Desc("Troops to be delivered. They will be distributed between the planes if SquadSize > 1.")] diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index a2c5406a7a..8b101c5c35 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public class SupportPowerManager : ITick, IResolveOrder, ITechTreeElement { public readonly Actor Self; - public readonly Dictionary Powers = new Dictionary(); + public readonly Dictionary Powers = new(); public readonly DeveloperMode DevMode; public readonly TechTree TechTree; @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Key; - public readonly List Instances = new List(); + public readonly List Instances = new(); public readonly int TotalTicks; protected int remainingSubTicks; diff --git a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs index bb361cc4b5..4d43c4ff02 100644 --- a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs +++ b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs @@ -25,10 +25,10 @@ namespace OpenRA.Mods.Common.Traits public readonly WVec Offset = WVec.Zero; [Desc("Minimum distance to throw the particle")] - public readonly WDist MinThrowRange = new WDist(256); + public readonly WDist MinThrowRange = new(256); [Desc("Maximum distance to throw the particle")] - public readonly WDist MaxThrowRange = new WDist(768); + public readonly WDist MaxThrowRange = new(768); [Desc("Minimum angle to throw the particle")] public readonly WAngle MinThrowAngle = WAngle.FromDegrees(30); @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Velocity = 75; [Desc("Speed at which the particle turns.")] - public readonly WAngle TurnSpeed = new WAngle(60); + public readonly WAngle TurnSpeed = new(60); public override object Create(ActorInitializer init) { return new ThrowsParticle(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index bc7d69fae5..a4ea0e661b 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits public readonly CVec Offset = CVec.Zero; [Desc("Facing that the actor must face before transforming.")] - public readonly WAngle Facing = new WAngle(384); + public readonly WAngle Facing = new(384); [Desc("Sounds to play when transforming.")] public readonly string[] TransformSounds = Array.Empty(); diff --git a/OpenRA.Mods.Common/Traits/Turreted.cs b/OpenRA.Mods.Common/Traits/Turreted.cs index 1f84338f2f..3aa845909b 100644 --- a/OpenRA.Mods.Common/Traits/Turreted.cs +++ b/OpenRA.Mods.Common/Traits/Turreted.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Turret = "primary"; [Desc("Speed at which the turret turns.")] - public readonly WAngle TurnSpeed = new WAngle(512); + public readonly WAngle TurnSpeed = new(512); public readonly WAngle InitialFacing = WAngle.Zero; diff --git a/OpenRA.Mods.Common/Traits/Wanders.cs b/OpenRA.Mods.Common/Traits/Wanders.cs index e93b85e2a7..47d5f7bda0 100644 --- a/OpenRA.Mods.Common/Traits/Wanders.cs +++ b/OpenRA.Mods.Common/Traits/Wanders.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int MaxMoveDelay = 0; [Desc("The terrain types that this actor should avoid wandering on to.")] - public readonly HashSet AvoidTerrainTypes = new HashSet(); + public readonly HashSet AvoidTerrainTypes = new(); public override object Create(ActorInitializer init) { return new Wanders(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/ActorMap.cs b/OpenRA.Mods.Common/Traits/World/ActorMap.cs index 2591f936a8..09ff16a1a3 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorMap.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorMap.cs @@ -38,8 +38,8 @@ namespace OpenRA.Mods.Common.Traits class Bin { - public readonly List Actors = new List(); - public readonly List ProximityTriggers = new List(); + public readonly List Actors = new(); + public readonly List ProximityTriggers = new(); } class CellTrigger @@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits readonly Action onActorEntered; readonly Action onActorExited; - readonly HashSet oldActors = new HashSet(); - readonly HashSet currentActors = new HashSet(); + readonly HashSet oldActors = new(); + readonly HashSet currentActors = new(); public CellTrigger(CPos[] footprint, Action onActorEntered, Action onActorExited) { @@ -98,8 +98,8 @@ namespace OpenRA.Mods.Common.Traits readonly Action onActorEntered; readonly Action onActorExited; - readonly HashSet oldActors = new HashSet(); - readonly HashSet currentActors = new HashSet(); + readonly HashSet oldActors = new(); + readonly HashSet currentActors = new(); WPos position; WDist range; @@ -166,9 +166,9 @@ namespace OpenRA.Mods.Common.Traits readonly ActorMapInfo info; readonly Map map; - readonly Dictionary cellTriggers = new Dictionary(); - readonly Dictionary> cellTriggerInfluence = new Dictionary>(); - readonly Dictionary proximityTriggers = new Dictionary(); + readonly Dictionary cellTriggers = new(); + readonly Dictionary> cellTriggerInfluence = new(); + readonly Dictionary proximityTriggers = new(); int nextTriggerId; CellLayer[] 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 addActorPosition = new HashSet(); - readonly HashSet removeActorPosition = new HashSet(); + readonly HashSet addActorPosition = new(); + readonly HashSet removeActorPosition = new(); readonly Predicate actorShouldBeRemoved; public WDist LargestActorRadius { get; } diff --git a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs index f4bcbe46bb..35d00497dd 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorSpawnManager.cs @@ -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 Types = new HashSet() { }; + public readonly HashSet Types = new() { }; public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { diff --git a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs index 166a014c59..8e3d78cc25 100644 --- a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs @@ -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 FactionPreviewActors = new Dictionary(); + public readonly Dictionary FactionPreviewActors = new(); public void RulesetLoaded(Ruleset rules, ActorInfo ai) { diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs index e2ba06b897..d081a87c2c 100644 --- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs +++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs @@ -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 ValidGround = new HashSet { "Clear", "Rough", "Road", "Ore", "Beach" }; + public readonly HashSet ValidGround = new() { "Clear", "Rough", "Road", "Ore", "Beach" }; [Desc("Which terrain types count as water?")] - public readonly HashSet ValidWater = new HashSet { "Water" }; + public readonly HashSet 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 ILobbyOptions.LobbyOptions(MapPreview map) { diff --git a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs index 5f025126aa..608853310a 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs @@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits public class EditorActionManager : IWorldLoaded { - readonly Stack undoStack = new Stack(); - readonly Stack redoStack = new Stack(); + readonly Stack undoStack = new(); + readonly Stack redoStack = new(); public event Action ItemAdded; public event Action ItemRemoved; diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index 184a34d48d..bb4fdf4920 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -39,8 +39,8 @@ namespace OpenRA.Mods.Common.Traits public class EditorActorLayer : IWorldLoaded, ITickRender, IRender, IRadarSignature, ICreatePlayers, IRenderAnnotations { readonly EditorActorLayerInfo info; - readonly List previews = new List(); - readonly Dictionary> cellMap = new Dictionary>(); + readonly List previews = new(); + readonly Dictionary> cellMap = new(); SpatiallyPartitioned screenMap; WorldRenderer worldRenderer; diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 23f4cd1702..2b1857821d 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits readonly TooltipInfoBase tooltip; IActorPreview[] previews; readonly ActorReference reference; - readonly Dictionary editorData = new Dictionary(); + readonly Dictionary editorData = new(); public EditorActorPreview(WorldRenderer worldRenderer, string id, ActorReference reference, PlayerReference owner) { diff --git a/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs index 0233a3819e..4ab901d23c 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs @@ -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, Requires { - 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 terrainOrResourcePreview = new List(); + readonly List terrainOrResourcePreview = new(); public EditorCursorLayer(Actor self, EditorCursorLayerInfo info) { diff --git a/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs index 20b0080106..63472024a5 100644 --- a/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits readonly Map map; readonly CellLayer cellCenters; readonly CellLayer terrainIndices; - readonly HashSet ends = new HashSet(); + readonly HashSet ends = new(); bool enabled; public ElevatedBridgeLayer(Actor self, ElevatedBridgeLayerInfo info) diff --git a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs index 164aa8cf25..6b84e75618 100644 --- a/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/LegacyBridgeLayer.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits public class LegacyBridgeLayer : IWorldLoaded { readonly LegacyBridgeLayerInfo info; - readonly Dictionary bridgeTypes = new Dictionary(); + readonly Dictionary bridgeTypes = new(); readonly ITemplatedTerrainInfo terrainInfo; CellLayer bridges; diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index 91a62db6f2..de5afaf2d6 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -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 dirtyCells = new HashSet(); + readonly HashSet dirtyCells = new(); readonly bool sharesCell; CellLayer[] cellsCost; diff --git a/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs b/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs index f4dad3d98b..19868a051c 100644 --- a/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs +++ b/OpenRA.Mods.Common/Traits/World/MapStartingLocations.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits { public CPos[] SpawnLocations; public List AvailableSpawnPoints; - public readonly Dictionary OccupiedSpawnPoints = new Dictionary(); + public readonly Dictionary 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 occupiedSpawnPoints = new Dictionary(); + readonly Dictionary occupiedSpawnPoints = new(); bool separateTeamSpawns; CPos[] spawnLocations; List availableSpawnPoints; diff --git a/OpenRA.Mods.Common/Traits/World/MapStartingUnits.cs b/OpenRA.Mods.Common/Traits/World/MapStartingUnits.cs index 3443dec287..8682de6e92 100644 --- a/OpenRA.Mods.Common/Traits/World/MapStartingUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/MapStartingUnits.cs @@ -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 Factions = new HashSet(); + public readonly HashSet Factions = new(); [Desc("The actor at the center, usually the mobile construction vehicle.")] [ActorReference] diff --git a/OpenRA.Mods.Common/Traits/World/OrderEffects.cs b/OpenRA.Mods.Common/Traits/World/OrderEffects.cs index 92d13b2c69..605a0bbcd6 100644 --- a/OpenRA.Mods.Common/Traits/World/OrderEffects.cs +++ b/OpenRA.Mods.Common/Traits/World/OrderEffects.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/World/PathFinder.cs b/OpenRA.Mods.Common/Traits/World/PathFinder.cs index 732883a95e..0acb83e9bc 100644 --- a/OpenRA.Mods.Common/Traits/World/PathFinder.cs +++ b/OpenRA.Mods.Common/Traits/World/PathFinder.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits public class PathFinder : IPathFinder, IWorldLoaded { - public static readonly List NoPath = new List(0); + public static readonly List NoPath = new(0); /// /// When searching for paths, use a default weight of 125% to reduce diff --git a/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs b/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs index b32c60368d..dfec513d72 100644 --- a/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs @@ -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 edges - = new Dictionary(); + readonly Dictionary edges = new(); public void Add(CPos source, CPos destination, int costSoFar, int estimatedRemainingCost) { diff --git a/OpenRA.Mods.Common/Traits/World/RadarPings.cs b/OpenRA.Mods.Common/Traits/World/RadarPings.cs index 19fb483aa6..9c927fa410 100644 --- a/OpenRA.Mods.Common/Traits/World/RadarPings.cs +++ b/OpenRA.Mods.Common/Traits/World/RadarPings.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits public class RadarPings : ITick { - public readonly List Pings = new List(); + public readonly List Pings = new(); readonly RadarPingsInfo info; public WPos? LastPingPosition; diff --git a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs index 7ad2a876dd..b75eec59c9 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs @@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits public sealed class ResourceClaimLayer { - readonly Dictionary> claimByCell = new Dictionary>(32); - readonly Dictionary claimByActor = new Dictionary(32); + readonly Dictionary> claimByCell = new(32); + readonly Dictionary claimByActor = new(32); /// /// Attempt to reserve the resource in a cell for the given actor. diff --git a/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs b/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs index ef3a322e28..26e5253d36 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs @@ -98,11 +98,11 @@ namespace OpenRA.Mods.Common.Traits protected readonly ResourceRendererInfo Info; protected readonly IResourceLayer ResourceLayer; protected readonly CellLayer RenderContents; - protected readonly Dictionary> Variants = new Dictionary>(); + protected readonly Dictionary> Variants = new(); protected readonly World World; - readonly HashSet dirty = new HashSet(); - readonly Queue cleanDirty = new Queue(); + readonly HashSet dirty = new(); + readonly Queue cleanDirty = new(); TerrainSpriteLayer shadowLayer; TerrainSpriteLayer spriteLayer; bool disposed; diff --git a/OpenRA.Mods.Common/Traits/World/Selection.cs b/OpenRA.Mods.Common/Traits/World/Selection.cs index b2ada1f513..ddc8f212f9 100644 --- a/OpenRA.Mods.Common/Traits/World/Selection.cs +++ b/OpenRA.Mods.Common/Traits/World/Selection.cs @@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Traits public int Hash { get; private set; } public IEnumerable Actors => actors; - readonly HashSet actors = new HashSet(); - readonly List rolloverActors = new List(); + readonly HashSet actors = new(); + readonly List rolloverActors = new(); World world; INotifySelection[] worldNotifySelection; diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index a986c005cf..49b430522f 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -90,9 +90,9 @@ namespace OpenRA.Mods.Common.Traits } public readonly SmudgeLayerInfo Info; - readonly Dictionary tiles = new Dictionary(); - readonly Dictionary dirty = new Dictionary(); - readonly Dictionary smudges = new Dictionary(); + readonly Dictionary tiles = new(); + readonly Dictionary dirty = new(); + readonly Dictionary smudges = new(); readonly World world; readonly bool hasSmoke; diff --git a/OpenRA.Mods.Common/Traits/World/SpawnMapActors.cs b/OpenRA.Mods.Common/Traits/World/SpawnMapActors.cs index 1ecb4dae02..aacf9e0170 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnMapActors.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnMapActors.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits public class SpawnMapActors : IWorldLoaded { - public Dictionary Actors = new Dictionary(); + public Dictionary Actors = new(); public uint LastMapActorID { get; private set; } public void WorldLoaded(World world, WorldRenderer wr) diff --git a/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs b/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs index 17286ee17a..783090d754 100644 --- a/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs @@ -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 SubterraneanTransitionTerrainTypes = new HashSet(); + public readonly HashSet 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; diff --git a/OpenRA.Mods.Common/Traits/World/TerrainLighting.cs b/OpenRA.Mods.Common/Traits/World/TerrainLighting.cs index 0319750347..88c6627530 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainLighting.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainLighting.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits readonly TerrainLightingInfo info; readonly Map map; - readonly Dictionary lightSources = new Dictionary(); + readonly Dictionary lightSources = new(); readonly SpatiallyPartitioned partitionedLightSources; readonly float3 globalTint; int nextLightSourceToken = 1; diff --git a/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs b/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs index ce625ddb3c..26359cf5c7 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits readonly Map map; readonly CellLayer cellCenters; readonly CellLayer terrainIndices; - readonly HashSet portals = new HashSet(); + readonly HashSet portals = new(); bool enabled; public TerrainTunnelLayer(Actor self, TerrainTunnelLayerInfo info) diff --git a/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs b/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs index 2e0e44980f..e40c019eba 100644 --- a/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs +++ b/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs @@ -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 TimeLimitWarnings = new Dictionary + public readonly Dictionary TimeLimitWarnings = new() { { 1, null }, { 2, null }, diff --git a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs index 4b37b7f745..7446fe217a 100644 --- a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits } readonly WarheadDebugOverlayInfo info; - readonly List impacts = new List(); + readonly List impacts = new(); public WarheadDebugOverlay(WarheadDebugOverlayInfo info) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs index 7f59167fe6..5bd6b0c73a 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "ResourceType.PipColor has been removed and resource pip colours are now defined\n" + "in WithHarvesterPipsDecoration.ResourceSequences."; - static readonly Dictionary PipReplacements = new Dictionary + static readonly Dictionary PipReplacements = new() { { "transparent", "pip-empty" }, { "green", "pip-green" }, @@ -41,11 +41,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules }; bool customPips; - readonly List locations = new List(); - readonly List cargoPipLocations = new List(); - readonly HashSet cargoCustomPips = new HashSet(); - readonly List harvesterPipLocations = new List(); - readonly Dictionary harvesterCustomPips = new Dictionary(); + readonly List locations = new(); + readonly List cargoPipLocations = new(); + readonly HashSet cargoCustomPips = new(); + readonly List harvesterPipLocations = new(); + readonly Dictionary harvesterCustomPips = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs index 20ff0327e9..c77a808d87 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules power.AddNode(new MiniYamlNode("Footprint", footprint)); } - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs index cdc80eaf0b..d45dde3435 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override string Description => "The trait NukePower (via the NukeLaunch projectile that it uses) no longer has built-in palette flashing."; - readonly List> weaponsToUpdate = new List>(); + readonly List> weaponsToUpdate = new(); public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs index 1de4123de8..68c319e9ea 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules Right = 8, } - static readonly Dictionary PositionMap = new Dictionary() + static readonly Dictionary PositionMap = new() { { LegacyReferencePoints.Center, "Center" }, { LegacyReferencePoints.Top, "Top" }, @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { LegacyReferencePoints.Bottom | LegacyReferencePoints.Right, "BottomRight" } }; - readonly Dictionary> locations = new Dictionary>(); + readonly Dictionary> locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs index ea366c9b76..aeb1014314 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "UseClassicFacingFudge has been replaced with ClassicFacingBodyOrientation trait\n" + "and Classic* variants of *Sequence loaders respectively, both located in Mods.Cnc."; - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs index ea1127b8b2..bb6f0c443f 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveTurnToDock.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "TurnToDock is removed from the Aircraft trait in favor of letting the Exit trait on the host" + "building determine whether or not turning is required and to what facing the aircraft must turn."; - readonly List> turningAircraft = new List>(); + readonly List> turningAircraft = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs index 9bca9af8a8..4379b950e6 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class ReplaceFacingAngles : UpdateRule { - static readonly Dictionary TraitFields = new Dictionary() + static readonly Dictionary TraitFields = new() { { "Aircraft", new[] { "InitialFacing", "PreviewFacing", "TurnSpeed", "IdleTurnSpeed" } }, { "Mobile", new[] { "InitialFacing", "PreviewFacing", "TurnSpeed" } }, @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { "AttackTesla", new[] { "FacingTolerance" } }, }; - static readonly Dictionary ProjectileFields = new Dictionary() + static readonly Dictionary ProjectileFields = new() { { "Missile", new[] { "HorizontalRateOfTurn", "VerticalRateOfTurn" } } }; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemovePlaceBuildingPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemovePlaceBuildingPalette.cs index 1c2ebfda2c..2479463395 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemovePlaceBuildingPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemovePlaceBuildingPalette.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "SequencePlaceBuildingPreview, and D2kActorPreviewPlaceBuildingPreview traits have been removed.\n" + "New Alpha and LineBuildSegmentAlpha properties have been added in their place."; - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveSmokeTrailWhenDamaged.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveSmokeTrailWhenDamaged.cs index 086651c3a0..4ec94c2251 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveSmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveSmokeTrailWhenDamaged.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules } } - readonly Dictionary> locations = new Dictionary>(); + readonly Dictionary> locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceShadowPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceShadowPalette.cs index ace1c65c56..3ad2a7433e 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceShadowPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceShadowPalette.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "The ShadowPalette field has been replaced by ShadowColor on projectiles.\n" + "The Palette field on WithShadow and ShadowPalette on WithParachute have similarly been replaced with ShadowColor."; - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceWithColoredOverlayPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceWithColoredOverlayPalette.cs index 7dbc2a417f..6257e54fb9 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceWithColoredOverlayPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceWithColoredOverlayPalette.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override string Description => "The Palette field has been removed from WithColoredOverlay. You must now specify the Color directly."; - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs index 9eb0185163..61b2b7d44a 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class UnhardcodeSquadManager : UpdateRule { - readonly List addNodes = new List(); + readonly List addNodes = new(); // Excludes AttackBomber and AttackTDGunboatTurreted as actors with these AttackBase traits aren't supposed to be controlled. readonly string[] attackBase = { "AttackLeap", "AttackPopupTurreted", "AttackAircraft", "AttackTesla", "AttackCharges", "AttackFollow", "AttackTurreted", "AttackFrontal", "AttackGarrisoned", "AttackOmni", "AttackSwallow" }; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeVeteranProductionIconOverlay.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeVeteranProductionIconOverlay.cs index 4712450c79..8cdaa3c017 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeVeteranProductionIconOverlay.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeVeteranProductionIconOverlay.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules public override string Description => "ProductionIconOverlayManager now works with the new WithProductionIconOverlay trait, instead of ProducibleWithLevel."; - readonly List locations = new List(); + readonly List locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs index 1fbb8d94af..b3ed5806e9 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20221203/ExplicitSequenceFilenames.cs @@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules string defaultSpriteExtension = ".shp"; List resolvedImagesNodes; - readonly Dictionary tilesetExtensions = new Dictionary(); - readonly Dictionary tilesetCodes = new Dictionary(); + readonly Dictionary tilesetExtensions = new(); + readonly Dictionary tilesetCodes = new(); bool parseModYaml = true; bool reportModYamlChanges; bool disabled; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20221203/RemoveSequenceHasEmbeddedPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20221203/RemoveSequenceHasEmbeddedPalette.cs index f2f9bb7347..92b11480fd 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20221203/RemoveSequenceHasEmbeddedPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20221203/RemoveSequenceHasEmbeddedPalette.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules "The PaletteFromEmbeddedSpritePalette trait no longer references a sequence.\n" + "Image and Sequence are replaced by Filename and Frame."; - readonly HashSet locations = new HashSet(); + readonly HashSet locations = new(); public override IEnumerable AfterUpdate(ModData modData) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs b/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs index 9cc541a3d2..b213e0c101 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules static readonly string[] SourceFiles = { "art.ini", "artfs.ini", "artmd.ini" }; - readonly Dictionary selectionHeight = new Dictionary(); + readonly Dictionary selectionHeight = new(); bool complete; diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs index 61ad1e1be5..4e26f835d5 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs @@ -318,7 +318,7 @@ namespace OpenRA.Mods.Common.UtilityCommands public static class EmmyLuaExts { - static readonly Dictionary LuaTypeNameReplacements = new Dictionary() + static readonly Dictionary LuaTypeNameReplacements = new() { { "UInt32", "integer" }, { "Int32", "integer" }, diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index 29eb254911..70949644de 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.UtilityCommands public ModData ModData; public Map Map; - public List Players = new List(); + public List Players = new(); public MapPlayers MapPlayers; bool singlePlayer; int spawnCount; @@ -328,7 +328,7 @@ namespace OpenRA.Mods.Common.UtilityCommands } // TODO: fix this -- will have bitrotted pretty badly. - static readonly Dictionary NamedColorMapping = new Dictionary() + static readonly Dictionary NamedColorMapping = new() { { "gold", Color.FromArgb(246, 214, 121) }, { "blue", Color.FromArgb(226, 230, 246) }, diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index 7db6a5dffd..664398e729 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Warheads [Desc("The maximum inaccuracy of the effect spawn position relative to actual impact position.")] public readonly WDist Inaccuracy = WDist.Zero; - static readonly BitSet TargetTypeAir = new BitSet("Air"); + static readonly BitSet TargetTypeAir = new("Air"); /// Checks if there are any actors at impact position and if the warhead is valid against any of them. ImpactActorType ActorTypeAtImpact(World world, WPos pos, Actor firedBy) diff --git a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs index b3f3c3bbf3..4ecb16898d 100644 --- a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly BitSet DamageTypes = default; [Desc("Damage percentage versus each armor type.")] - public readonly Dictionary Versus = new Dictionary(); + public readonly Dictionary Versus = new(); public override bool IsValidAgainst(Actor victim, Actor firedBy) { diff --git a/OpenRA.Mods.Common/Warheads/DestroyResourceWarhead.cs b/OpenRA.Mods.Common/Warheads/DestroyResourceWarhead.cs index 4b382ea7d4..b0b464bca3 100644 --- a/OpenRA.Mods.Common/Warheads/DestroyResourceWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/DestroyResourceWarhead.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly int ResourceAmount = 0; [Desc("Resource types to remove with this warhead.", "If empty, all resource types will be removed.")] - public readonly HashSet ResourceTypes = new HashSet(); + public readonly HashSet ResourceTypes = new(); public override void DoImpact(in Target target, WarheadArgs args) { diff --git a/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs b/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs index 9e66e98aa4..c40e79302f 100644 --- a/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly int[] Size = { 0, 0 }; [Desc("Type of smudge to apply to terrain.")] - public readonly HashSet SmudgeType = new HashSet(); + public readonly HashSet SmudgeType = new(); [Desc("Percentage chance the smudge is created.")] public readonly int Chance = 100; diff --git a/OpenRA.Mods.Common/Warheads/ShakeScreenWarhead.cs b/OpenRA.Mods.Common/Warheads/ShakeScreenWarhead.cs index 24e242b5f1..e3a5bd6ed9 100644 --- a/OpenRA.Mods.Common/Warheads/ShakeScreenWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/ShakeScreenWarhead.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly int Intensity = 0; [Desc("Shake multipliers by the X and Y axis, comma-separated.")] - public readonly float2 Multiplier = new float2(0, 0); + public readonly float2 Multiplier = new(0, 0); public override void DoImpact(in Target target, WarheadArgs args) { diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index 2b1d491023..88ce7d7107 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Warheads public class SpreadDamageWarhead : DamageWarhead, IRulesetLoaded { [Desc("Range between falloff steps.")] - public readonly WDist Spread = new WDist(43); + public readonly WDist Spread = new(43); [Desc("Damage percentage at each range step")] public readonly int[] Falloff = { 100, 37, 14, 5, 0 }; diff --git a/OpenRA.Mods.Common/Warheads/Warhead.cs b/OpenRA.Mods.Common/Warheads/Warhead.cs index 09aaa14c91..bd44bfa015 100644 --- a/OpenRA.Mods.Common/Warheads/Warhead.cs +++ b/OpenRA.Mods.Common/Warheads/Warhead.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Warheads public abstract class Warhead : IWarhead { [Desc("What types of targets are affected.")] - public readonly BitSet ValidTargets = new BitSet("Ground", "Water"); + public readonly BitSet ValidTargets = new("Ground", "Water"); [Desc("What types of targets are unaffected.", "Overrules ValidTargets.")] public readonly BitSet InvalidTargets; @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly bool AffectsParent = false; [Desc("If impact is above this altitude, warheads that would affect terrain ignore terrain target types (and either do nothing or perform their own checks).")] - public readonly WDist AirThreshold = new WDist(128); + public readonly WDist AirThreshold = new(128); [Desc("Delay in ticks before applying the warhead effect.", "0 = instant (old model).")] public readonly int Delay = 0; diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index 99d9bbb73f..362646f77a 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets public readonly string TooltipContainer; public readonly string TooltipTemplate = "BUTTON_TOOLTIP"; - public HotkeyReference Key = new HotkeyReference(); + public HotkeyReference Key = new(); public bool DisableKeyRepeat = false; public bool DisableKeySound = false; diff --git a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs index 3c0ddb22b1..3f4bb7f238 100644 --- a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs +++ b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs @@ -24,8 +24,7 @@ namespace OpenRA.Mods.Common.Widgets public Func IsChecked = () => false; readonly CachedTransform<(string, bool), CachedTransform<(bool, bool, bool, bool, bool), Sprite>> getCheckmarkImageCache - = new CachedTransform<(string, bool), CachedTransform<(bool, bool, bool, bool, bool), Sprite>>( - ((string CheckType, bool Checked) args) => + = new(((string CheckType, bool Checked) args) => { var variantImageCollection = "checkmark-" + args.CheckType; var variantBaseName = args.Checked ? "checked" : "unchecked"; diff --git a/OpenRA.Mods.Common/Widgets/ImageWidget.cs b/OpenRA.Mods.Common/Widgets/ImageWidget.cs index 82d64298a4..9c7d197609 100644 --- a/OpenRA.Mods.Common/Widgets/ImageWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ImageWidget.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets readonly Lazy tooltipContainer; public Func GetTooltipText; - readonly CachedTransform<(string, string), Sprite> getImageCache = new CachedTransform<(string, string), Sprite>( + readonly CachedTransform<(string, string), Sprite> getImageCache = new( ((string collection, string image) args) => ChromeProvider.GetImage(args.collection, args.image)); public ImageWidget() diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index ba15b1d315..94c932ed7e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -430,7 +430,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic currentFrame = currentSprites.Length - 1; } - readonly Dictionary assetVisByName = new Dictionary(); + readonly Dictionary assetVisByName = new(); bool FilterAsset(string filename) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index f7a9f61d39..a42799f3a9 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly BackgroundWidget actorEditPanel; readonly LabelWidget typeLabel; readonly TextFieldWidget actorIDField; - readonly HashSet typableFields = new HashSet(); + readonly HashSet typableFields = new(); readonly LabelWidget actorIDErrorLabel; readonly Widget initContainer; @@ -505,7 +505,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { readonly EditorActorPreview actor; readonly SetActorIdAction setActorIdAction; - readonly List handles = new List(); + readonly List handles = new(); public EditActorPreview(EditorActorPreview actor) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs index 5181496fc2..101eaaf42d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs @@ -40,8 +40,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic protected readonly ScrollPanelWidget Panel; protected readonly ScrollItemWidget ItemTemplate; - protected readonly HashSet SelectedCategories = new HashSet(); - protected readonly List FilteredCategories = new List(); + protected readonly HashSet SelectedCategories = new(); + protected readonly List FilteredCategories = new(); protected string[] allCategories; protected string searchFilter; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs index 675760387c..5a79c7b3ef 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/HistoryLogLogic.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly EditorActionManager editorActionManager; readonly ScrollItemWidget template; - readonly Dictionary states = new Dictionary(); + readonly Dictionary states = new(); [ObjectCreator.UseCtor] public HistoryLogLogic(Widget widget, World world) diff --git a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs index ed0c71eb9c..968cc09dc0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly Widget panel; readonly ScrollPanelWidget gameList; readonly TextFieldWidget saveTextField; - readonly List games = new List(); + readonly List games = new(); readonly Action onStart; readonly Action onExit; readonly ModData modData; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs index 7bbddcff76..f91f544ad0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs @@ -46,9 +46,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly TextFieldWidget chatText; readonly CachedTransform chatAvailableIn; readonly string chatDisabled; - readonly Dictionary templates = new Dictionary(); + readonly Dictionary templates = new(); - readonly TabCompletionLogic tabCompletion = new TabCompletionLogic(); + readonly TabCompletionLogic tabCompletion = new(); readonly string chatLineSound = ChromeMetrics.Get("ChatLineSound"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs index 7fec0b22dc..4103d0e375 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs @@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly Widget buttonContainer; readonly ButtonWidget buttonTemplate; readonly int2 buttonStride; - readonly List buttons = new List(); + readonly List buttons = new(); readonly ModData modData; readonly Action onExit; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs index 4d7c7e9c06..1e511e5be2 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs @@ -45,8 +45,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly IOrderedEnumerable> teams; readonly bool limitViews; - readonly HotkeyReference combinedViewKey = new HotkeyReference(); - readonly HotkeyReference worldViewKey = new HotkeyReference(); + readonly HotkeyReference combinedViewKey = new(); + readonly HotkeyReference worldViewKey = new(); readonly World world; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ReplayControlBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ReplayControlBarLogic.cs index 053c6549ab..abdc6fcea4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ReplayControlBarLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ReplayControlBarLogic.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { enum PlaybackSpeed { Regular, Slow, Fast, Maximum } - readonly Dictionary multipliers = new Dictionary() + readonly Dictionary multipliers = new() { { PlaybackSpeed.Regular, 1 }, { PlaybackSpeed.Slow, 2 }, diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs index a0e44a733c..b2b941c845 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs @@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly ScrollPanelWidget scrollPanel; readonly Widget template; - readonly Dictionary sources = new Dictionary(); - readonly Dictionary downloads = new Dictionary(); + readonly Dictionary sources = new(); + readonly Dictionary downloads = new(); bool sourceAvailable; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 99fadb3718..68f675c3dd 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -81,18 +81,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly Widget newSpectatorTemplate; readonly ScrollPanelWidget lobbyChatPanel; - readonly Dictionary chatTemplates = new Dictionary(); + readonly Dictionary chatTemplates = new(); readonly TextFieldWidget chatTextField; readonly CachedTransform chatAvailableIn; readonly string chatDisabled; readonly ScrollPanelWidget players; - readonly Dictionary factions = new Dictionary(); + readonly Dictionary factions = new(); readonly ColorPickerManagerInfo colorManager; - readonly TabCompletionLogic tabCompletion = new TabCompletionLogic(); + readonly TabCompletionLogic tabCompletion = new(); MapPreview map; Session.MapStatus mapStatus; @@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool insufficientPlayerSpawns; bool teamChat; bool updateDiscordStatus = true; - Dictionary spawnOccupants = new Dictionary(); + Dictionary spawnOccupants = new(); readonly string chatLineSound = ChromeMetrics.Get("ChatLineSound"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index 07ffb15d2f..8413c1ddca 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -77,9 +77,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic MapClassification currentTab; - readonly Dictionary scrollpanels = new Dictionary(); + readonly Dictionary scrollpanels = new(); - readonly Dictionary tabMaps = new Dictionary(); + readonly Dictionary tabMaps = new(); string[] visibleMaps; string selectedUid; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 6cf3d303c3..9ab1c08fd4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -103,13 +103,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic [TranslationReference] const string Defeat = "options-winstate.defeat"; - static Filter filter = new Filter(); + static Filter filter = new(); readonly Widget panel; readonly ScrollPanelWidget replayList, playerList; readonly ScrollItemWidget playerTemplate, playerHeader; - readonly List replays = new List(); - readonly Dictionary replayState = new Dictionary(); + readonly List replays = new(); + readonly Dictionary replayState = new(); readonly Action onStart; readonly ModData modData; readonly WebServices services; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs index 066288c492..f9786653e1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs @@ -32,8 +32,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool isHotkeyDefault; string currentContext = "Any"; - readonly HashSet contexts = new HashSet() { "Any" }; - readonly Dictionary> hotkeyGroups = new Dictionary>(); + readonly HashSet contexts = new() { "Any" }; + readonly Dictionary> hotkeyGroups = new(); TextFieldWidget filterInput; Widget headerTemplate; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs index d40ce64aa0..b3211ef8c8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/SettingsLogic.cs @@ -52,14 +52,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic [TranslationReference] const string ResetCancel = "dialog-settings-reset.cancel"; - readonly Dictionary> leavePanelActions = new Dictionary>(); - readonly Dictionary resetPanelActions = new Dictionary(); + readonly Dictionary> leavePanelActions = new(); + readonly Dictionary resetPanelActions = new(); readonly Widget panelContainer, tabContainer; readonly ButtonWidget tabTemplate; readonly int2 buttonStride; - readonly List buttons = new List(); - readonly Dictionary panels = new Dictionary(); + readonly List buttons = new(); + readonly Dictionary panels = new(); string activePanel; bool needsRestart = false; diff --git a/OpenRA.Mods.Common/Widgets/LogicKeyListenerWidget.cs b/OpenRA.Mods.Common/Widgets/LogicKeyListenerWidget.cs index 1146aaf5f5..d218b6fffb 100644 --- a/OpenRA.Mods.Common/Widgets/LogicKeyListenerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LogicKeyListenerWidget.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets { public class LogicKeyListenerWidget : Widget { - readonly List> handlers = new List>(); + readonly List> handlers = new(); public override bool HandleKeyPress(KeyInput e) { diff --git a/OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs index 99bf6a3b59..5a7d991cde 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs @@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Widgets public readonly string TooltipContainer; readonly Lazy tooltipContainer; - readonly List armyIcons = new List(); + readonly List armyIcons = new(); - readonly CachedTransform stats = new CachedTransform(player => player.PlayerActor.TraitOrDefault()); + readonly CachedTransform stats = new(player => player.PlayerActor.TraitOrDefault()); int lastIconIdx; int currentTooltipToken; diff --git a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs index d52a269a87..d095ce3a03 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs @@ -41,8 +41,8 @@ namespace OpenRA.Mods.Common.Widgets readonly Dictionary clocks; readonly Lazy tooltipContainer; - readonly List productionIcons = new List(); - readonly List productionIconsBounds = new List(); + readonly List productionIcons = new(); + readonly List productionIconsBounds = new(); readonly float2 iconSize; int lastIconIdx; diff --git a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs index 64bec39719..a6afbc4fb7 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs @@ -41,8 +41,8 @@ namespace OpenRA.Mods.Common.Widgets public string ClockPalette = "chrome"; public Func GetPlayer; - readonly List supportPowerIconsIcons = new List(); - readonly List supportPowerIconsBounds = new List(); + readonly List supportPowerIconsIcons = new(); + readonly List supportPowerIconsBounds = new(); Animation icon; int lastIconIdx; int currentTooltipToken; diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 988ea12dd7..de4c8eabf1 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -44,11 +44,11 @@ namespace OpenRA.Mods.Common.Widgets public readonly Color TextColor = Color.White; public readonly Color ReadyTextAltColor = Color.Gold; public readonly int Columns = 3; - public readonly int2 IconSize = new int2(64, 48); + public readonly int2 IconSize = new(64, 48); public readonly int2 IconMargin = int2.Zero; public readonly int2 IconSpriteOffset = int2.Zero; - public readonly float2 QueuedOffset = new float2(4, 2); + public readonly float2 QueuedOffset = new(4, 2); public readonly TextAlign QueuedTextAlign = TextAlign.Left; public readonly string ClickSound = ChromeMetrics.Get("ClickSound"); @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Widgets // Note: LinterHotkeyNames assumes that these are disabled by default public readonly string HotkeyPrefix = null; public readonly int HotkeyCount = 0; - public readonly HotkeyReference SelectProductionBuildingHotkey = new HotkeyReference(); + public readonly HotkeyReference SelectProductionBuildingHotkey = new(); public readonly string ClockAnimation = "clock"; public readonly string ClockSequence = "idle"; @@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Widgets } public override Rectangle EventBounds => eventBounds; - Dictionary icons = new Dictionary(); + Dictionary icons = new(); Animation cantBuild; Animation clock; Rectangle eventBounds = Rectangle.Empty; diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs index a2fc2171bf..91c2f64e1c 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Widgets public class ProductionTabGroup { - public List Tabs = new List(); + public List Tabs = new(); public string Group; public int NextQueueName = 1; public bool Alert { get { return Tabs.Any(t => t.Queue.AllQueued().Any(i => i.Done)); } } @@ -76,8 +76,8 @@ namespace OpenRA.Mods.Common.Widgets public readonly string ClickSound = ChromeMetrics.Get("ClickSound"); public readonly string ClickDisabledSound = ChromeMetrics.Get("ClickDisabledSound"); - public readonly HotkeyReference PreviousProductionTabKey = new HotkeyReference(); - public readonly HotkeyReference NextProductionTabKey = new HotkeyReference(); + public readonly HotkeyReference PreviousProductionTabKey = new(); + public readonly HotkeyReference NextProductionTabKey = new(); public readonly Dictionary Groups; diff --git a/OpenRA.Mods.Common/Widgets/ProgressBarWidget.cs b/OpenRA.Mods.Common/Widgets/ProgressBarWidget.cs index 88e823ad5f..19ca4732df 100644 --- a/OpenRA.Mods.Common/Widgets/ProgressBarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProgressBarWidget.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets { public string Background = "progressbar-bg"; public string Bar = "progressbar-thumb"; - public Size BarMargin = new Size(2, 2); + public Size BarMargin = new(2, 2); public int Percentage = 0; public bool Indeterminate = false; diff --git a/OpenRA.Mods.Common/Widgets/ResourceBarWidget.cs b/OpenRA.Mods.Common/Widgets/ResourceBarWidget.cs index a14214186b..755c08158c 100644 --- a/OpenRA.Mods.Common/Widgets/ResourceBarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ResourceBarWidget.cs @@ -31,8 +31,8 @@ namespace OpenRA.Mods.Common.Widgets public Func GetProvided = () => 0; public Func GetUsed = () => 0; public Func GetBarColor = () => Color.White; - readonly EWMA providedLerp = new EWMA(0.3f); - readonly EWMA usedLerp = new EWMA(0.3f); + readonly EWMA providedLerp = new(0.3f); + readonly EWMA usedLerp = new(0.3f); readonly World world; Sprite indicator; diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index 346a313164..307ac61503 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets public readonly string OverlayFont = "TinyBold"; - public readonly int2 IconSize = new int2(64, 48); + public readonly int2 IconSize = new(64, 48); public readonly int IconMargin = 10; public readonly int2 IconSpriteOffset = int2.Zero; @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Widgets Animation icon; Animation clock; - Dictionary icons = new Dictionary(); + Dictionary icons = new(); public SupportPowerIcon TooltipIcon { get; private set; } public Func GetTooltipIcon; diff --git a/OpenRA.Mods.Common/Widgets/TextNotificationsDisplayWidget.cs b/OpenRA.Mods.Common/Widgets/TextNotificationsDisplayWidget.cs index 1d0180a1c7..20f308b718 100644 --- a/OpenRA.Mods.Common/Widgets/TextNotificationsDisplayWidget.cs +++ b/OpenRA.Mods.Common/Widgets/TextNotificationsDisplayWidget.cs @@ -29,9 +29,9 @@ namespace OpenRA.Mods.Common.Widgets public string MissionTemplate = "CHAT_LINE_TEMPLATE"; public string FeedbackTemplate = "TRANSIENT_LINE_TEMPLATE"; public string TransientsTemplate = "TRANSIENT_LINE_TEMPLATE"; - readonly Dictionary templates = new Dictionary(); + readonly Dictionary templates = new(); - readonly List expirations = new List(); + readonly List expirations = new(); Rectangle overflowDrawBounds = Rectangle.Empty; public override Rectangle EventBounds => Rectangle.Empty; diff --git a/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs b/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs index 1ea1247d3e..f83ef15fcd 100644 --- a/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets static readonly Action Nothing = () => { }; readonly GraphicSettings graphicSettings; - public int2 CursorOffset = new int2(0, 20); + public int2 CursorOffset = new(0, 20); public int BottomEdgeYOffset = -5; public Action BeforeRender = Nothing; diff --git a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs index b95754be4e..a3e4a04700 100644 --- a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets { public class VideoPlayerWidget : Widget { - public Hotkey CancelKey = new Hotkey(Keycode.ESCAPE, Modifiers.None); + public Hotkey CancelKey = new(Keycode.ESCAPE, Modifiers.None); public float AspectRatio = 1.2f; public bool DrawOverlay = true; public bool Skippable = true; diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index 27f2264c9a..cf2e3c4919 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -27,18 +27,18 @@ namespace OpenRA.Mods.Common.Widgets readonly ModData modData; readonly IEnumerable resourceRenderers; - public readonly HotkeyReference ZoomInKey = new HotkeyReference(); - public readonly HotkeyReference ZoomOutKey = new HotkeyReference(); + public readonly HotkeyReference ZoomInKey = new(); + public readonly HotkeyReference ZoomOutKey = new(); - public readonly HotkeyReference ScrollUpKey = new HotkeyReference(); - public readonly HotkeyReference ScrollDownKey = new HotkeyReference(); - public readonly HotkeyReference ScrollLeftKey = new HotkeyReference(); - public readonly HotkeyReference ScrollRightKey = new HotkeyReference(); + public readonly HotkeyReference ScrollUpKey = new(); + public readonly HotkeyReference ScrollDownKey = new(); + public readonly HotkeyReference ScrollLeftKey = new(); + public readonly HotkeyReference ScrollRightKey = new(); - public readonly HotkeyReference JumpToTopEdgeKey = new HotkeyReference(); - public readonly HotkeyReference JumpToBottomEdgeKey = new HotkeyReference(); - public readonly HotkeyReference JumpToLeftEdgeKey = new HotkeyReference(); - public readonly HotkeyReference JumpToRightEdgeKey = new HotkeyReference(); + public readonly HotkeyReference JumpToTopEdgeKey = new(); + public readonly HotkeyReference JumpToBottomEdgeKey = new(); + public readonly HotkeyReference JumpToLeftEdgeKey = new(); + public readonly HotkeyReference JumpToRightEdgeKey = new(); // Note: LinterHotkeyNames assumes that these are disabled by default public readonly string BookmarkSaveKeyPrefix = null; @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Widgets public FrozenActor FrozenActorTooltip { get; private set; } public string ResourceTooltip { get; private set; } - static readonly Dictionary ScrollCursors = new Dictionary + static readonly Dictionary ScrollCursors = new() { { ScrollDirection.Up | ScrollDirection.Left, "scroll-tl" }, { ScrollDirection.Up | ScrollDirection.Right, "scroll-tr" }, @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets { ScrollDirection.Right, "scroll-r" }, }; - static readonly Dictionary JoystickCursors = new Dictionary + static readonly Dictionary JoystickCursors = new() { { ScrollDirection.Up | ScrollDirection.Left, "joystick-tl-blocked" }, { ScrollDirection.Up | ScrollDirection.Right, "joystick-tr-blocked" }, @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Widgets { ScrollDirection.Right, "joystick-r-blocked" }, }; - static readonly Dictionary ScrollOffsets = new Dictionary + static readonly Dictionary ScrollOffsets = new() { { ScrollDirection.Up, new float2(0, -1) }, { ScrollDirection.Down, new float2(0, 1) }, diff --git a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs index ca324faadb..878499d429 100644 --- a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs +++ b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.D2k.PackageLoaders public IEnumerable Contents => index.Keys; readonly Stream s; - readonly Dictionary index = new Dictionary(); + readonly Dictionary index = new(); public D2kSoundResources(Stream s, string filename) { diff --git a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs index a304d57114..0ff996383f 100644 --- a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs +++ b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.D2k.Traits public readonly int[] Falloff = { 100, 100, 25, 11, 6, 4, 3, 2, 1, 0 }; [Desc("Range between falloff steps.")] - public readonly WDist Spread = new WDist(3072); + public readonly WDist Spread = new(3072); [Desc("Ranges at which each Falloff step is defined. Overrides Spread.")] public readonly WDist[] Range = null; diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs index 8a51d70dfa..8eb8b12c48 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.D2k.Traits public class D2kActorPreviewPlaceBuildingPreviewInfo : ActorPreviewPlaceBuildingPreviewInfo { [Desc("Terrain types that should show the 'unsafe' footprint tile.")] - public readonly HashSet UnsafeTerrainTypes = new HashSet { "Rock" }; + public readonly HashSet UnsafeTerrainTypes = new() { "Rock" }; [Desc("Only check for 'unsafe' footprint tiles when you have these prerequisites.")] public readonly string[] RequiresPrerequisites = Array.Empty(); diff --git a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs index 113049c9c5..df7e93305d 100644 --- a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs +++ b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.D2k.Traits public readonly string ResourceType = "Spice"; [Desc("Spice blooms only grow on these terrain types.")] - public readonly HashSet GrowthTerrainTypes = new HashSet(); + public readonly HashSet GrowthTerrainTypes = new(); [Desc("The weapon to use for spice creation.")] [WeaponReference] diff --git a/OpenRA.Mods.D2k/Traits/World/BuildableTerrainLayer.cs b/OpenRA.Mods.D2k/Traits/World/BuildableTerrainLayer.cs index 656cc78c1c..0a4c30f5e5 100644 --- a/OpenRA.Mods.D2k/Traits/World/BuildableTerrainLayer.cs +++ b/OpenRA.Mods.D2k/Traits/World/BuildableTerrainLayer.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.D2k.Traits public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender, IRadarTerrainLayer, INotifyActorDisposing { readonly BuildableTerrainLayerInfo info; - readonly Dictionary dirty = new Dictionary(); + readonly Dictionary dirty = new(); readonly ITiledTerrainRenderer terrainRenderer; readonly World world; readonly CellLayer strength; diff --git a/OpenRA.Mods.D2k/Traits/World/D2kResourceRenderer.cs b/OpenRA.Mods.D2k/Traits/World/D2kResourceRenderer.cs index 9735ab6fee..53c21b4287 100644 --- a/OpenRA.Mods.D2k/Traits/World/D2kResourceRenderer.cs +++ b/OpenRA.Mods.D2k/Traits/World/D2kResourceRenderer.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.D2k.Traits All = 0xFF } - public static readonly Dictionary SpriteMap = new Dictionary() + public static readonly Dictionary SpriteMap = new() { { ClearSides.Left | ClearSides.Top | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 2 }, { ClearSides.Top | ClearSides.Right | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 3 }, diff --git a/OpenRA.Mods.D2k/UtilityCommands/D2kMapImporter.cs b/OpenRA.Mods.D2k/UtilityCommands/D2kMapImporter.cs index 7dec3d979c..36d6a1baad 100644 --- a/OpenRA.Mods.D2k/UtilityCommands/D2kMapImporter.cs +++ b/OpenRA.Mods.D2k/UtilityCommands/D2kMapImporter.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands // PlayerReference colors in D2k missions only affect chat text and minimap colors because actors use specific palette colors. // So using the colors from the original game's minimap. - public static Dictionary PlayerReferenceDataByPlayerName = new Dictionary + public static Dictionary PlayerReferenceDataByPlayerName = new() { { "Neutral", ("Random", Color.White) }, { "Atreides", ("atreides", Color.FromArgb(90, 115, 148)) }, @@ -36,7 +36,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands { "Mercenaries", ("mercenary", Color.FromArgb(156, 132, 8)) } }; - public static Dictionary ActorDataByActorCode = new Dictionary + public static Dictionary ActorDataByActorCode = new() { { 20, ("wormspawner", "Creeps") }, { 23, ("mpspawn", "Neutral") }, diff --git a/OpenRA.Platforms.Default/FreeTypeFont.cs b/OpenRA.Platforms.Default/FreeTypeFont.cs index a55862bc97..6dd0476bf4 100644 --- a/OpenRA.Platforms.Default/FreeTypeFont.cs +++ b/OpenRA.Platforms.Default/FreeTypeFont.cs @@ -53,7 +53,7 @@ namespace OpenRA.Platforms.Default public sealed class FreeTypeFont : IFont { - static readonly FontGlyph EmptyGlyph = new FontGlyph + static readonly FontGlyph EmptyGlyph = new() { Offset = int2.Zero, Size = new Size(0, 0), diff --git a/OpenRA.Platforms.Default/MultiTapDetection.cs b/OpenRA.Platforms.Default/MultiTapDetection.cs index 1a34413de1..b3fa586fdb 100644 --- a/OpenRA.Platforms.Default/MultiTapDetection.cs +++ b/OpenRA.Platforms.Default/MultiTapDetection.cs @@ -17,9 +17,9 @@ namespace OpenRA.Platforms.Default static class MultiTapDetection { static readonly Cache<(Keycode Key, Modifiers Mods), TapHistory> KeyHistoryCache = - new Cache<(Keycode, Modifiers), TapHistory>(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1))); + new(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1))); static readonly Cache ClickHistoryCache = - new Cache(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1))); + new(_ => new TapHistory(DateTime.Now - TimeSpan.FromSeconds(1))); public static int DetectFromMouse(byte button, int2 xy) { diff --git a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs index 712e12eadd..4d6332dab8 100644 --- a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs +++ b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs @@ -51,7 +51,7 @@ namespace OpenRA.Platforms.Default const int GroupDistanceSqr = GroupDistance * GroupDistance; const int PoolSize = 32; - readonly Dictionary sourcePool = new Dictionary(PoolSize); + readonly Dictionary sourcePool = new(PoolSize); float volume = 1f; IntPtr device; IntPtr context; @@ -541,7 +541,7 @@ namespace OpenRA.Platforms.Default class OpenAlAsyncLoadSound : OpenAlSound { static readonly byte[] SilentData = new byte[2]; - readonly CancellationTokenSource cts = new CancellationTokenSource(); + readonly CancellationTokenSource cts = new(); readonly Task playTask; public OpenAlAsyncLoadSound(uint source, bool looping, bool relative, WPos pos, float volume, int channels, int sampleBits, int sampleRate, Stream stream) diff --git a/OpenRA.Platforms.Default/OpenGL.cs b/OpenRA.Platforms.Default/OpenGL.cs index bc2d05c466..b30c5bf017 100644 --- a/OpenRA.Platforms.Default/OpenGL.cs +++ b/OpenRA.Platforms.Default/OpenGL.cs @@ -63,7 +63,7 @@ namespace OpenRA.Platforms.Default public const int GL_CONTEXT_LOST = 0x0507; public const int GL_TABLE_TOO_LARGE = 0x8031; - static readonly Dictionary ErrorToText = new Dictionary + static readonly Dictionary ErrorToText = new() { { GL_NO_ERROR, "No Error" }, { GL_INVALID_ENUM, "Invalid Enum" }, @@ -157,7 +157,7 @@ namespace OpenRA.Platforms.Default public const int GL_DEBUG_SOURCE_APPLICATION = 0x824A; public const int GL_DEBUG_SOURCE_OTHER = 0x824B; - static readonly Dictionary DebugSourceToText = new Dictionary + static readonly Dictionary DebugSourceToText = new() { { GL_DEBUG_SOURCE_API, "API" }, { GL_DEBUG_SOURCE_WINDOW_SYSTEM, "Window System" }, @@ -177,7 +177,7 @@ namespace OpenRA.Platforms.Default public const int GL_DEBUG_TYPE_POP_GROUP = 0x826A; public const int GL_DEBUG_TYPE_OTHER = 0x8251; - static readonly Dictionary DebugTypeToText = new Dictionary + static readonly Dictionary DebugTypeToText = new() { { GL_DEBUG_TYPE_ERROR, "Error" }, { GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, "Deprecated Behaviour" }, @@ -195,7 +195,7 @@ namespace OpenRA.Platforms.Default public const int GL_DEBUG_SEVERITY_LOW = 0x9148; public const int GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; - static readonly Dictionary DebugSeverityToText = new Dictionary + static readonly Dictionary DebugSeverityToText = new() { { GL_DEBUG_SEVERITY_HIGH, "High" }, { GL_DEBUG_SEVERITY_MEDIUM, "Medium" }, diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index b2ebba61ce..0045dcc382 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -29,7 +29,7 @@ namespace OpenRA.Platforms.Default readonly IntPtr window; bool disposed; - readonly object syncObject = new object(); + readonly object syncObject = new(); readonly Size windowSize; Size surfaceSize; float windowScale = 1f; diff --git a/OpenRA.Platforms.Default/Shader.cs b/OpenRA.Platforms.Default/Shader.cs index d6c221b398..2e58dc4b5f 100644 --- a/OpenRA.Platforms.Default/Shader.cs +++ b/OpenRA.Platforms.Default/Shader.cs @@ -23,10 +23,10 @@ namespace OpenRA.Platforms.Default public const int TexMetadataAttributeIndex = 2; public const int TintAttributeIndex = 3; - readonly Dictionary samplers = new Dictionary(); - readonly Dictionary legacySizeUniforms = new Dictionary(); - readonly Dictionary textures = new Dictionary(); - readonly Queue unbindTextures = new Queue(); + readonly Dictionary samplers = new(); + readonly Dictionary legacySizeUniforms = new(); + readonly Dictionary textures = new(); + readonly Queue unbindTextures = new(); readonly uint program; protected uint CompileShaderObject(int type, string name) diff --git a/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs b/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs index 1c0611f3c9..4752fdbd3f 100644 --- a/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs +++ b/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs @@ -25,12 +25,12 @@ namespace OpenRA.Platforms.Default sealed class ThreadedGraphicsContext : IGraphicsContext { // PERF: Maintain several object pools to reduce allocations. - readonly Stack verticesPool = new Stack(); - readonly Stack messagePool = new Stack(); - readonly Queue messages = new Queue(); + readonly Stack verticesPool = new(); + readonly Stack messagePool = new(); + readonly Queue messages = new(); public readonly int BatchSize; - readonly object syncObject = new object(); + readonly object syncObject = new(); readonly Thread renderThread; volatile ExceptionDispatchInfo messageException; @@ -162,7 +162,7 @@ namespace OpenRA.Platforms.Default this.device = device; } - readonly AutoResetEvent completed = new AutoResetEvent(false); + readonly AutoResetEvent completed = new(false); readonly ThreadedGraphicsContext device; volatile Action action; volatile Action actionWithParam;