From 4a1e4f3e16e98608c254847afe90477bb90f32db Mon Sep 17 00:00:00 2001 From: teinarss Date: Thu, 25 Feb 2021 20:52:13 +0100 Subject: [PATCH] Use expression body syntax --- OpenRA.Game/Activities/Activity.cs | 10 +- OpenRA.Game/Actor.cs | 24 +- OpenRA.Game/CPos.cs | 11 +- OpenRA.Game/CVec.cs | 9 +- OpenRA.Game/ExternalMods.cs | 8 +- OpenRA.Game/FieldLoader.cs | 2 +- OpenRA.Game/FileFormats/Png.cs | 2 +- OpenRA.Game/FileSystem/FileSystem.cs | 2 +- OpenRA.Game/FileSystem/Folder.cs | 2 +- OpenRA.Game/FileSystem/ZipFile.cs | 2 +- OpenRA.Game/Game.cs | 8 +- OpenRA.Game/GameInformation.cs | 7 +- OpenRA.Game/Graphics/Animation.cs | 4 +- OpenRA.Game/Graphics/Model.cs | 2 +- OpenRA.Game/Graphics/ModelAnimation.cs | 8 +- OpenRA.Game/Graphics/Palette.cs | 12 +- OpenRA.Game/Graphics/PaletteReference.cs | 4 +- OpenRA.Game/Graphics/SequenceProvider.cs | 4 +- OpenRA.Game/Graphics/Sheet.cs | 2 +- OpenRA.Game/Graphics/SheetBuilder.cs | 6 +- OpenRA.Game/Graphics/SpriteLoader.cs | 2 +- OpenRA.Game/Graphics/SpriteRenderable.cs | 16 +- OpenRA.Game/Graphics/TargetLineRenderable.cs | 6 +- OpenRA.Game/Graphics/UISpriteRenderable.cs | 10 +- OpenRA.Game/Graphics/Viewport.cs | 15 +- OpenRA.Game/HotkeyManager.cs | 10 +- OpenRA.Game/Input/InputHandler.cs | 16 +- OpenRA.Game/InstalledMods.cs | 8 +- OpenRA.Game/LocalPlayerProfile.cs | 8 +- OpenRA.Game/Map/ActorInitializer.cs | 4 +- OpenRA.Game/Map/ActorReference.cs | 2 +- OpenRA.Game/Map/CellLayer.cs | 10 +- OpenRA.Game/Map/CellRegion.cs | 9 +- OpenRA.Game/Map/Map.cs | 12 +- OpenRA.Game/Map/MapCache.cs | 5 +- OpenRA.Game/Map/MapCoordsRegion.cs | 8 +- OpenRA.Game/Map/MapPreview.cs | 35 ++- OpenRA.Game/Map/ProjectedCellLayer.cs | 22 +- OpenRA.Game/Map/ProjectedCellRegion.cs | 6 +- OpenRA.Game/ModData.cs | 10 +- OpenRA.Game/Network/Connection.cs | 28 +- OpenRA.Game/Network/GameServer.cs | 2 +- OpenRA.Game/Network/Order.cs | 2 +- OpenRA.Game/Network/OrderManager.cs | 9 +- OpenRA.Game/Network/ReplayConnection.cs | 12 +- OpenRA.Game/Network/Session.cs | 8 +- OpenRA.Game/Network/UPnP.cs | 11 +- OpenRA.Game/Orders/UnitOrderGenerator.cs | 2 +- OpenRA.Game/Platform.cs | 4 +- OpenRA.Game/Player.cs | 14 +- OpenRA.Game/Primitives/BitSet.cs | 2 +- OpenRA.Game/Primitives/Cache.cs | 11 +- OpenRA.Game/Primitives/Color.cs | 290 +++++++++--------- OpenRA.Game/Primitives/ConcurrentCache.cs | 11 +- OpenRA.Game/Primitives/LongBitSet.cs | 4 +- OpenRA.Game/Primitives/MergedStream.cs | 24 +- .../Primitives/ObservableCollection.cs | 5 +- .../Primitives/ObservableDictionary.cs | 23 +- OpenRA.Game/Primitives/ObservableList.cs | 17 +- OpenRA.Game/Primitives/PlayerDictionary.cs | 10 +- OpenRA.Game/Primitives/Polygon.cs | 3 +- OpenRA.Game/Primitives/PriorityQueue.cs | 2 +- .../Primitives/ReadOnlyAdapterStream.cs | 13 +- OpenRA.Game/Primitives/ReadOnlyDictionary.cs | 9 +- OpenRA.Game/Primitives/ReadOnlyList.cs | 5 +- OpenRA.Game/Primitives/Rectangle.cs | 22 +- OpenRA.Game/Primitives/SegmentStream.cs | 23 +- OpenRA.Game/Primitives/Size.cs | 2 +- .../Primitives/SpatiallyPartitioned.cs | 4 +- OpenRA.Game/Primitives/float2.cs | 4 +- OpenRA.Game/Primitives/float3.cs | 2 +- OpenRA.Game/Primitives/int2.cs | 4 +- OpenRA.Game/Renderer.cs | 40 +-- OpenRA.Game/Server/Connection.cs | 2 +- OpenRA.Game/Server/Server.cs | 4 +- OpenRA.Game/Sound/Sound.cs | 35 +-- OpenRA.Game/Support/Arguments.cs | 2 +- OpenRA.Game/Support/PerfTimer.cs | 10 +- OpenRA.Game/Support/VariableExpression.cs | 22 +- OpenRA.Game/TraitDictionary.cs | 8 +- OpenRA.Game/Traits/DebugPauseState.cs | 3 +- OpenRA.Game/Traits/Player/FrozenActorLayer.cs | 14 +- OpenRA.Game/Traits/Player/Shroud.cs | 7 +- OpenRA.Game/Traits/Target.cs | 14 +- .../ClearInvalidModRegistrationsCommand.cs | 3 +- .../UtilityCommands/RegisterModCommand.cs | 3 +- .../UtilityCommands/UnregisterModCommand.cs | 3 +- OpenRA.Game/WAngle.cs | 4 +- OpenRA.Game/WDist.cs | 7 +- OpenRA.Game/WPos.cs | 5 +- OpenRA.Game/WVec.cs | 17 +- OpenRA.Game/Widgets/Widget.cs | 8 +- OpenRA.Game/World.cs | 35 +-- OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs | 8 +- OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs | 21 +- OpenRA.Mods.Cnc/FileFormats/AudReader.cs | 5 +- OpenRA.Mods.Cnc/FileFormats/VqaReader.cs | 22 +- OpenRA.Mods.Cnc/FileSystem/BigFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/MixFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/Pak.cs | 2 +- .../Graphics/TeslaZapRenderable.cs | 8 +- OpenRA.Mods.Cnc/Graphics/Voxel.cs | 4 +- .../Graphics/VoxelModelSequenceLoader.cs | 2 +- OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs | 8 +- OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs | 10 +- OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs | 6 +- OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs | 6 +- OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs | 18 +- OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs | 2 +- OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs | 2 +- OpenRA.Mods.Cnc/Traits/Disguise.cs | 14 +- OpenRA.Mods.Cnc/Traits/Minelayer.cs | 4 +- OpenRA.Mods.Cnc/Traits/PortableChrono.cs | 11 +- OpenRA.Mods.Cnc/Traits/TDGunboat.cs | 19 +- ...ansferTimedExternalConditionOnTransform.cs | 2 +- .../UtilityCommands/ConvertPngToShpCommand.cs | 2 +- .../ImportRedAlertLegacyMapCommand.cs | 2 +- .../UtilityCommands/ImportTSMapCommand.cs | 2 +- .../ImportTiberianDawnLegacyMapCommand.cs | 2 +- .../UtilityCommands/LegacyRulesImporter.cs | 2 +- .../UtilityCommands/LegacySequenceImporter.cs | 2 +- .../UtilityCommands/LegacyTilesetImporter.cs | 2 +- .../UtilityCommands/ListMixContentsCommand.cs | 2 +- .../UtilityCommands/RemapShpCommand.cs | 2 +- .../Activities/Move/MoveAdjacentTo.cs | 8 +- OpenRA.Mods.Common/ActorInitializer.cs | 2 +- OpenRA.Mods.Common/AudioLoaders/WavLoader.cs | 8 +- OpenRA.Mods.Common/FileFormats/IniFile.cs | 2 +- .../FileSystem/InstallShieldPackage.cs | 4 +- OpenRA.Mods.Common/Graphics/ActorPreview.cs | 2 +- OpenRA.Mods.Common/Graphics/BeamRenderable.cs | 6 +- .../Graphics/CircleAnnotationRenderable.cs | 6 +- .../Graphics/ContrailRenderable.cs | 8 +- .../Graphics/DefaultSpriteSequence.cs | 28 +- .../DetectionCircleAnnotationRenderable.cs | 6 +- ...metricSelectionBarsAnnotationRenderable.cs | 10 +- ...ometricSelectionBoxAnnotationRenderable.cs | 6 +- .../Graphics/LineAnnotationRenderable.cs | 6 +- .../Graphics/ModelRenderable.cs | 14 +- .../Graphics/PolygonAnnotationRenderable.cs | 6 +- .../Graphics/RailgunRenderable.cs | 6 +- .../RangeCircleAnnotationRenderable.cs | 6 +- .../SelectionBarsAnnotationRenderable.cs | 10 +- .../SelectionBoxAnnotationRenderable.cs | 6 +- .../Graphics/TextAnnotationRenderable.cs | 6 +- .../Graphics/UIModelRenderable.cs | 8 +- .../Graphics/UITextRenderable.cs | 6 +- OpenRA.Mods.Common/HitShapes/Circle.cs | 2 +- .../Orders/GuardOrderGenerator.cs | 2 +- .../Pathfinder/BasePathSearch.cs | 4 +- OpenRA.Mods.Common/Pathfinder/PathGraph.cs | 4 +- OpenRA.Mods.Common/Pathfinder/PathSearch.cs | 5 +- OpenRA.Mods.Common/Projectiles/AreaBeam.cs | 8 +- OpenRA.Mods.Common/Projectiles/NukeLaunch.cs | 2 +- .../Scripting/Global/AngleGlobal.cs | 16 +- .../Scripting/Global/CameraGlobal.cs | 4 +- .../Scripting/Global/ColorGlobal.cs | 72 ++--- .../Scripting/Global/CoordinateGlobals.cs | 8 +- .../Scripting/Global/DateTimeGlobal.cs | 20 +- .../Scripting/Global/LightingGlobal.cs | 8 +- .../Scripting/Global/MapGlobal.cs | 34 +- OpenRA.Mods.Common/Scripting/LuaScript.cs | 2 +- .../Properties/GainsExperienceProperties.cs | 8 +- .../Scripting/Properties/GeneralProperties.cs | 27 +- .../Scripting/Properties/HealthProperties.cs | 6 +- .../Scripting/Properties/MobileProperties.cs | 2 +- .../Properties/PlayerExperienceProperties.cs | 10 +- .../Scripting/Properties/PlayerProperties.cs | 18 +- .../Properties/PlayerStatsProperties.cs | 12 +- .../Scripting/Properties/PowerProperties.cs | 17 +- .../Properties/ProductionProperties.cs | 9 +- .../Properties/ResourceProperties.cs | 10 +- .../Properties/TransportProperties.cs | 6 +- .../ServerTraits/PlayerPinger.cs | 2 +- OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs | 6 +- .../SpriteLoaders/PngSheetLoader.cs | 2 +- .../SpriteLoaders/ShpTSLoader.cs | 4 +- OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs | 2 +- OpenRA.Mods.Common/Terrain/DefaultTerrain.cs | 21 +- .../Terrain/DefaultTileCache.cs | 2 +- OpenRA.Mods.Common/Terrain/TerrainInfo.cs | 7 +- OpenRA.Mods.Common/Traits/ActorSpawner.cs | 2 +- OpenRA.Mods.Common/Traits/AffectsShroud.cs | 2 +- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 36 +-- OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs | 4 +- OpenRA.Mods.Common/Traits/AmmoPool.cs | 4 +- OpenRA.Mods.Common/Traits/Armament.cs | 4 +- .../Traits/Attack/AttackBase.cs | 2 +- OpenRA.Mods.Common/Traits/AttackMove.cs | 2 +- OpenRA.Mods.Common/Traits/AutoCarryable.cs | 2 +- OpenRA.Mods.Common/Traits/AutoTarget.cs | 2 +- .../Traits/BlocksProjectiles.cs | 2 +- OpenRA.Mods.Common/Traits/BodyOrientation.cs | 4 +- .../Traits/BotModules/BaseBuilderBotModule.cs | 32 +- .../Traits/BotModules/Squads/Squad.cs | 16 +- .../Traits/Buildings/BaseProvider.cs | 4 +- OpenRA.Mods.Common/Traits/Buildings/Bridge.cs | 2 +- .../Traits/Buildings/BridgeHut.cs | 2 +- .../Traits/Buildings/BridgePlaceholder.cs | 10 +- .../Traits/Buildings/Building.cs | 4 +- .../FootprintPlaceBuildingPreview.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/Gate.cs | 8 +- .../Traits/Buildings/GivesBuildableArea.cs | 2 +- .../Traits/Buildings/GroundLevelBridge.cs | 10 +- .../Traits/Buildings/LegacyBridgeHut.cs | 4 +- .../Traits/Buildings/RallyPoint.cs | 4 +- .../Traits/Buildings/Refinery.cs | 12 +- .../Buildings/TransformsIntoAircraft.cs | 4 +- .../Traits/Buildings/TransformsIntoMobile.cs | 4 +- .../Traits/CapturableProgressBar.cs | 2 +- .../Traits/CaptureProgressBar.cs | 2 +- OpenRA.Mods.Common/Traits/Cargo.cs | 11 +- OpenRA.Mods.Common/Traits/Carryable.cs | 4 +- OpenRA.Mods.Common/Traits/Carryall.cs | 6 +- OpenRA.Mods.Common/Traits/Cloak.cs | 2 +- .../Traits/CombatDebugOverlay.cs | 2 +- .../Conditions/GrantConditionOnDeploy.cs | 2 +- .../Conditions/GrantConditionOnProduction.cs | 2 +- OpenRA.Mods.Common/Traits/Crates/Crate.cs | 4 +- .../Traits/ExitsDebugOverlay.cs | 2 +- OpenRA.Mods.Common/Traits/GainsExperience.cs | 4 +- OpenRA.Mods.Common/Traits/Harvester.cs | 10 +- OpenRA.Mods.Common/Traits/Health.cs | 6 +- OpenRA.Mods.Common/Traits/HitShape.cs | 2 +- OpenRA.Mods.Common/Traits/Husk.cs | 14 +- OpenRA.Mods.Common/Traits/Immobile.cs | 6 +- .../Traits/Infantry/ScaredyCat.cs | 6 +- .../Traits/Infantry/TakeCover.cs | 11 +- .../Traits/IsometricSelectable.cs | 8 +- OpenRA.Mods.Common/Traits/JamsMissiles.cs | 6 +- OpenRA.Mods.Common/Traits/Mobile.cs | 31 +- OpenRA.Mods.Common/Traits/Passenger.cs | 2 +- .../Traits/Player/DeveloperMode.cs | 16 +- OpenRA.Mods.Common/Traits/Player/DummyBot.cs | 8 +- .../Traits/Player/MissionObjectives.cs | 4 +- .../Traits/Player/ModularBot.cs | 8 +- .../Traits/Player/PlayerRadarTerrain.cs | 5 +- .../Traits/Player/PlayerStatistics.cs | 8 +- .../Traits/Player/ProductionQueue.cs | 13 +- .../Traits/Player/ProvidesTechPrerequisite.cs | 10 +- .../Player/StrategicVictoryConditions.cs | 9 +- OpenRA.Mods.Common/Traits/Player/TechTree.cs | 4 +- OpenRA.Mods.Common/Traits/Pluggable.cs | 2 +- .../Traits/Power/AffectedByPowerOutage.cs | 2 +- .../Traits/Power/Player/PowerManager.cs | 6 +- OpenRA.Mods.Common/Traits/PowerTooltip.cs | 8 +- .../Traits/ProximityCapturable.cs | 2 +- OpenRA.Mods.Common/Traits/RejectsOrders.cs | 4 +- .../Traits/Render/CashTricklerBar.cs | 2 +- .../Render/CustomTerrainDebugOverlay.cs | 2 +- .../Traits/Render/DrawLineToTarget.cs | 4 +- .../Traits/Render/ProductionBar.cs | 2 +- .../Traits/Render/ReloadArmamentsBar.cs | 2 +- .../Traits/Render/RenderDebugState.cs | 2 +- .../Traits/Render/RenderDetectionCircle.cs | 2 +- .../Traits/Render/RenderJammerCircle.cs | 2 +- .../Traits/Render/RenderRangeCircle.cs | 2 +- .../Traits/Render/RenderShroudCircle.cs | 2 +- .../Traits/Render/RenderSprites.cs | 8 +- .../Traits/Render/RenderVoxels.cs | 3 +- .../Traits/Render/SelectionDecorationsBase.cs | 2 +- .../Traits/Render/SupportPowerChargeBar.cs | 2 +- .../Traits/Render/TimedConditionBar.cs | 4 +- .../Render/VeteranProductionIconOverlay.cs | 5 +- .../Traits/Render/WithDecorationBase.cs | 2 +- .../Traits/Render/WithInfantryBody.cs | 2 +- .../Traits/Render/WithRangeCircle.cs | 4 +- .../WithSpriteControlGroupDecoration.cs | 2 +- .../Render/WithTextControlGroupDecoration.cs | 2 +- OpenRA.Mods.Common/Traits/Selectable.cs | 8 +- OpenRA.Mods.Common/Traits/StoresResources.cs | 4 +- .../SupportPowers/SelectDirectionalTarget.cs | 5 +- .../SupportPowers/SupportPowerManager.cs | 21 +- OpenRA.Mods.Common/Traits/Targetable.cs | 4 +- .../Traits/TemporaryOwnerManager.cs | 2 +- OpenRA.Mods.Common/Traits/Tooltip.cs | 12 +- .../Traits/TooltipDescription.cs | 16 +- OpenRA.Mods.Common/Traits/TunnelEntrance.cs | 2 +- OpenRA.Mods.Common/Traits/Turreted.cs | 4 +- OpenRA.Mods.Common/Traits/Voiced.cs | 2 +- OpenRA.Mods.Common/Traits/World/ActorMap.cs | 7 +- .../Traits/World/BridgeLayer.cs | 2 +- .../Traits/World/EditorActorLayer.cs | 2 +- .../Traits/World/EditorActorPreview.cs | 13 +- .../Traits/World/EditorCursorLayer.cs | 4 +- .../Traits/World/EditorSelectionLayer.cs | 2 +- .../Traits/World/ElevatedBridgeLayer.cs | 6 +- .../Traits/World/JumpjetActorLayer.cs | 6 +- .../Traits/World/JumpjetLocomotor.cs | 2 +- .../Traits/World/LobbyPrerequisiteCheckbox.cs | 2 +- OpenRA.Mods.Common/Traits/World/Locomotor.cs | 2 +- .../Traits/World/MusicPlaylist.cs | 5 +- .../World/PaletteFromEmbeddedSpritePalette.cs | 2 +- .../Traits/World/PaletteFromFile.cs | 2 +- .../Traits/World/PaletteFromGimpOrJascFile.cs | 2 +- .../Traits/World/PaletteFromPng.cs | 2 +- .../Traits/World/ResourceLayer.cs | 2 +- OpenRA.Mods.Common/Traits/World/Selection.cs | 2 +- .../Traits/World/SubterraneanActorLayer.cs | 6 +- .../Traits/World/SubterraneanLocomotor.cs | 2 +- .../Traits/World/TerrainGeometryOverlay.cs | 2 +- .../Traits/World/TerrainRenderer.cs | 2 +- .../Traits/World/TerrainTunnelLayer.cs | 6 +- .../Traits/World/WarheadDebugOverlay.cs | 7 +- .../Rules/20191117/ReplaceAttackTypeStrafe.cs | 18 +- .../Rules/20200202/AddResourceRenderer.cs | 10 +- .../20200202/CreateScreenShakeWarhead.cs | 10 +- .../Rules/20200202/ReformatChromeProvider.cs | 13 +- .../20200202/RemoveAirdropActorTypeDefault.cs | 11 +- .../20200202/RemoveInitialFacingHardcoding.cs | 11 +- .../20200202/RemoveWithPermanentInjury.cs | 16 +- .../UpdateRules/Rules/20200202/RemoveYesNo.cs | 13 +- .../Rules/20200202/RenameProneTime.cs | 11 +- .../Rules/20200202/RenameRallyPointPath.cs | 11 +- .../UpdateRules/Rules/20200202/RenameSpins.cs | 11 +- .../Rules/20200503/AddPipDecorationTraits.cs | 26 +- .../ChangeTargetLineDelayToMilliseconds.cs | 14 +- .../ConvertSupportPowerRangesToFootprint.cs | 16 +- .../CreateFlashPaletteEffectWarhead.cs | 10 +- .../20200503/ModernizeDecorationTraits.cs | 22 +- .../Rules/20200503/MoveClassicFacingFudge.cs | 14 +- .../Rules/20200503/RemoveConditionManager.cs | 10 +- .../Rules/20200503/RemoveLaysTerrain.cs | 11 +- .../20200503/RemoveMuzzleSplitFacings.cs | 16 +- .../Rules/20200503/RenameCircleOutline.cs | 11 +- .../Rules/20200503/RenameHealCrateAction.cs | 11 +- .../RenameInfiltrationNotifications.cs | 11 +- .../Rules/20200503/RenameSelfHealing.cs | 14 +- .../Rules/20200503/RenameStances.cs | 14 +- .../Rules/20200503/RenameWithNukeLaunch.cs | 11 +- .../Rules/20200503/ReplaceBurns.cs | 11 +- .../Rules/20200503/ReplaceFacingAngles.cs | 3 +- .../20200503/SpawnActorPowerDefaultEffect.cs | 11 +- .../Rules/20200503/SplitDamagedByTerrain.cs | 11 +- .../Rules/20200503/UpdateMapInits.cs | 3 +- .../Rules/20200503/UpdateTilesetColors.cs | 11 +- .../20201213/RemovePlaceBuildingPalette.cs | 15 +- .../20201213/RemovePlayerHighlightPalette.cs | 10 +- .../20201213/RemoveRenderSpritesScale.cs | 10 +- .../Rules/20201213/RenameMPTraits.cs | 13 +- .../Rules/20201213/ReplaceShadowPalette.cs | 13 +- .../ReplaceWithColoredOverlayPalette.cs | 10 +- .../Rules/CopyIsometricSelectableHeight.cs | 14 +- .../UpdateRules/Rules/RemoveTurnToDock.cs | 14 +- .../Rules/RenameSmudgeSmokeFields.cs | 14 +- ...CheckConditionalTraitInterfaceOverrides.cs | 2 +- .../CheckExplicitInterfacesCommand.cs | 2 +- .../UtilityCommands/CheckMissingSprites.cs | 2 +- .../UtilityCommands/CheckYaml.cs | 2 +- .../ConvertSpriteToPngCommand.cs | 2 +- .../UtilityCommands/CreateManPage.cs | 2 +- .../UtilityCommands/DebugChromeRegions.cs | 2 +- .../DumpSequenceSheetsCommand.cs | 2 +- .../UtilityCommands/ExtractFilesCommand.cs | 2 +- .../UtilityCommands/ExtractLuaDocsCommand.cs | 2 +- .../UtilityCommands/ExtractMapRules.cs | 2 +- .../ExtractSettingsDocsCommand.cs | 2 +- .../ExtractTraitDocsCommand.cs | 2 +- .../ExtractWeaponDocsCommand.cs | 2 +- .../ExtractZeroBraneStudioLuaAPI.cs | 2 +- .../UtilityCommands/GetMapHashCommand.cs | 2 +- .../ListInstallShieldCabContentsCommand.cs | 2 +- .../ListInstallShieldContentsCommand.cs | 2 +- .../ListMSCabContentsCommand.cs | 2 +- .../OutputResolvedRulesCommand.cs | 2 +- .../OutputResolvedSequencesCommand.cs | 2 +- .../OutputResolvedWeaponsCommand.cs | 2 +- .../PngSheetExportMetadataCommand.cs | 2 +- .../PngSheetImportMetadataCommand.cs | 2 +- .../UtilityCommands/RefreshMapCommand.cs | 2 +- .../UtilityCommands/ReplayMetadataCommand.cs | 2 +- .../UtilityCommands/ResizeMapCommand.cs | 2 +- .../UtilityCommands/Rgba2Hex.cs | 4 +- .../UtilityCommands/UpdateMapCommand.cs | 2 +- .../UtilityCommands/UpdateModCommand.cs | 2 +- OpenRA.Mods.Common/Warheads/Warhead.cs | 2 +- OpenRA.Mods.Common/Widgets/ButtonWidget.cs | 13 +- .../Widgets/ChatDisplayWidget.cs | 2 +- .../Widgets/ColorMixerWidget.cs | 2 +- .../Widgets/DropDownButtonWidget.cs | 2 +- .../Widgets/Logic/Editor/ActorEditLogic.cs | 9 +- .../Logic/Ingame/ObserverStatsLogic.cs | 5 +- .../Widgets/Logic/ReplayBrowserLogic.cs | 21 +- .../Widgets/MapPreviewWidget.cs | 2 +- .../Widgets/MouseAttachmentWidget.cs | 2 +- .../Widgets/ProductionPaletteWidget.cs | 12 +- .../Widgets/ProductionTabsWidget.cs | 10 +- .../Widgets/ScrollPanelWidget.cs | 13 +- .../Widgets/SupportPowersWidget.cs | 2 +- .../Widgets/TerrainTemplatePreviewWidget.cs | 5 +- OpenRA.Mods.Common/Widgets/TextFieldWidget.cs | 10 +- .../Widgets/VideoPlayerWidget.cs | 4 +- .../Widgets/ViewportControllerWidget.cs | 11 +- .../WorldInteractionControllerWidget.cs | 8 +- .../PackageLoaders/D2kSoundResources.cs | 2 +- OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs | 4 +- .../UtilityCommands/ImportD2kMapCommand.cs | 2 +- OpenRA.Platforms.Default/DummySoundEngine.cs | 8 +- OpenRA.Platforms.Default/OpenAlSoundEngine.cs | 15 +- .../Sdl2GraphicsContext.cs | 2 +- .../Sdl2PlatformWindow.cs | 18 +- OpenRA.Platforms.Default/Texture.cs | 7 +- .../ThreadedGraphicsContext.cs | 42 +-- 403 files changed, 1342 insertions(+), 2031 deletions(-) diff --git a/OpenRA.Game/Activities/Activity.cs b/OpenRA.Game/Activities/Activity.cs index 8f2493005e..0fa330a896 100644 --- a/OpenRA.Game/Activities/Activity.cs +++ b/OpenRA.Game/Activities/Activity.cs @@ -53,15 +53,15 @@ namespace OpenRA.Activities Activity childActivity; protected Activity ChildActivity { - get { return SkipDoneActivities(childActivity); } - private set { childActivity = value; } + get => SkipDoneActivities(childActivity); + private set => childActivity = value; } Activity nextActivity; public Activity NextActivity { - get { return SkipDoneActivities(nextActivity); } - private set { nextActivity = value; } + get => SkipDoneActivities(nextActivity); + private set => nextActivity = value; } internal static Activity SkipDoneActivities(Activity first) @@ -81,7 +81,7 @@ namespace OpenRA.Activities public bool IsInterruptible { get; protected set; } public bool ChildHasPriority { get; protected set; } - public bool IsCanceling { get { return State == ActivityState.Canceling; } } + public bool IsCanceling => State == ActivityState.Canceling; bool finishing; bool firstRunCompleted; bool lastRun; diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index c5b50101d0..421fc28c25 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -48,8 +48,8 @@ namespace OpenRA Activity currentActivity; public Activity CurrentActivity { - get { return Activity.SkipDoneActivities(currentActivity); } - private set { currentActivity = value; } + get => Activity.SkipDoneActivities(currentActivity); + private set => currentActivity = value; } public int Generation; @@ -59,19 +59,13 @@ namespace OpenRA public IOccupySpace OccupiesSpace { get; private set; } public ITargetable[] Targetables { get; private set; } - public bool IsIdle { get { return CurrentActivity == null; } } - public bool IsDead { get { return Disposed || (health != null && health.IsDead); } } + public bool IsIdle => CurrentActivity == null; + public bool IsDead => Disposed || (health != null && health.IsDead); - public CPos Location { get { return OccupiesSpace.TopLeft; } } - public WPos CenterPosition { get { return OccupiesSpace.CenterPosition; } } + public CPos Location => OccupiesSpace.TopLeft; + public WPos CenterPosition => OccupiesSpace.CenterPosition; - public WRot Orientation - { - get - { - return facing != null ? facing.Orientation : WRot.None; - } - } + public WRot Orientation => facing != null ? facing.Orientation : WRot.None; /// Value used to represent an invalid token. public static readonly int InvalidConditionToken = -1; @@ -615,8 +609,8 @@ namespace OpenRA public LuaValue this[LuaRuntime runtime, LuaValue keyValue] { - get { return luaInterface.Value[runtime, keyValue]; } - set { luaInterface.Value[runtime, keyValue] = value; } + get => luaInterface.Value[runtime, keyValue]; + set => luaInterface.Value[runtime, keyValue] = value; } public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right) diff --git a/OpenRA.Game/CPos.cs b/OpenRA.Game/CPos.cs index 06a578d167..35caf2d52a 100644 --- a/OpenRA.Game/CPos.cs +++ b/OpenRA.Game/CPos.cs @@ -25,13 +25,13 @@ namespace OpenRA public readonly int Bits; // X is padded to MSB, so bit shift does the correct sign extension - public int X { get { return Bits >> 20; } } + public int X => Bits >> 20; // Align Y with a short, cast, then shift the rest of the way // The signed short bit shift does the correct sign extension - public int Y { get { return ((short)(Bits >> 4)) >> 4; } } + public int Y => ((short)(Bits >> 4)) >> 4; - public byte Layer { get { return (byte)Bits; } } + public byte Layer => (byte)Bits; public CPos(int bits) { Bits = bits; } public CPos(int x, int y) @@ -136,10 +136,7 @@ namespace OpenRA } } - set - { - throw new LuaException("CPos is read-only. Use CPos.New to create a new value"); - } + set => throw new LuaException("CPos is read-only. Use CPos.New to create a new value"); } #endregion diff --git a/OpenRA.Game/CVec.cs b/OpenRA.Game/CVec.cs index 2892537962..4a7910d976 100644 --- a/OpenRA.Game/CVec.cs +++ b/OpenRA.Game/CVec.cs @@ -42,8 +42,8 @@ namespace OpenRA public CVec Sign() { return new CVec(Math.Sign(X), Math.Sign(Y)); } public CVec Abs() { return new CVec(Math.Abs(X), Math.Abs(Y)); } - public int LengthSquared { get { return X * X + Y * Y; } } - public int Length { get { return Exts.ISqrt(LengthSquared); } } + public int LengthSquared => X * X + Y * Y; + public int Length => Exts.ISqrt(LengthSquared); public CVec Clamp(Rectangle r) { @@ -114,10 +114,7 @@ namespace OpenRA } } - set - { - throw new LuaException("CVec is read-only. Use CVec.New to create a new value"); - } + set => throw new LuaException("CVec is read-only. Use CVec.New to create a new value"); } #endregion diff --git a/OpenRA.Game/ExternalMods.cs b/OpenRA.Game/ExternalMods.cs index 96ad758d75..aca8037892 100644 --- a/OpenRA.Game/ExternalMods.cs +++ b/OpenRA.Game/ExternalMods.cs @@ -290,10 +290,10 @@ namespace OpenRA } } - public ExternalMod this[string key] { get { return mods[key]; } } - public int Count { get { return mods.Count; } } - public ICollection Keys { get { return mods.Keys; } } - public ICollection Values { get { return mods.Values; } } + public ExternalMod this[string key] => mods[key]; + public int Count => mods.Count; + public ICollection Keys => mods.Keys; + public ICollection Values => mods.Values; public bool ContainsKey(string key) { return mods.ContainsKey(key); } public IEnumerator> GetEnumerator() { return mods.GetEnumerator(); } public bool TryGetValue(string key, out ExternalMod value) { return mods.TryGetValue(key, out value); } diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs index 03dd94f647..dd27d8ce91 100644 --- a/OpenRA.Game/FieldLoader.cs +++ b/OpenRA.Game/FieldLoader.cs @@ -651,7 +651,7 @@ namespace OpenRA { public static readonly SerializeAttribute Default = new SerializeAttribute(true); - public bool IsDefault { get { return this == Default; } } + public bool IsDefault => this == Default; public readonly bool Serialize; public string YamlName; diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs index cd64e708a9..2bb4f2c552 100644 --- a/OpenRA.Game/FileFormats/Png.cs +++ b/OpenRA.Game/FileFormats/Png.cs @@ -33,7 +33,7 @@ namespace OpenRA.FileFormats public SpriteFrameType Type { get; private set; } public Dictionary EmbeddedData = new Dictionary(); - public int PixelStride { get { return Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4; } } + public int PixelStride => Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4; public Png(Stream s) { diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs index 1648909a33..16ebe4c613 100644 --- a/OpenRA.Game/FileSystem/FileSystem.cs +++ b/OpenRA.Game/FileSystem/FileSystem.cs @@ -28,7 +28,7 @@ namespace OpenRA.FileSystem public class FileSystem : IReadOnlyFileSystem { - public IEnumerable MountedPackages { get { return mountedPackages.Keys; } } + public IEnumerable MountedPackages => mountedPackages.Keys; readonly Dictionary mountedPackages = new Dictionary(); readonly Dictionary explicitMounts = new Dictionary(); readonly string modID; diff --git a/OpenRA.Game/FileSystem/Folder.cs b/OpenRA.Game/FileSystem/Folder.cs index d9b9d7328e..1a3856a1c9 100644 --- a/OpenRA.Game/FileSystem/Folder.cs +++ b/OpenRA.Game/FileSystem/Folder.cs @@ -27,7 +27,7 @@ namespace OpenRA.FileSystem Directory.CreateDirectory(path); } - public string Name { get { return path; } } + public string Name => path; public IEnumerable Contents { diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index 5fc0a16afa..cdacbd85d0 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -141,7 +141,7 @@ namespace OpenRA.FileSystem sealed class ZipFolder : IReadOnlyPackage { - public string Name { get { return path; } } + public string Name => path; public ReadOnlyZipFile Parent { get; private set; } readonly string path; diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 034cb32fa8..670b8e3180 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -99,16 +99,16 @@ namespace OpenRA // More accurate replacement for Environment.TickCount static Stopwatch stopwatch = Stopwatch.StartNew(); - public static long RunTime { get { return stopwatch.ElapsedMilliseconds; } } + public static long RunTime => stopwatch.ElapsedMilliseconds; public static int RenderFrame = 0; - public static int NetFrameNumber { get { return OrderManager.NetFrameNumber; } } - public static int LocalTick { get { return OrderManager.LocalFrameNumber; } } + public static int NetFrameNumber => OrderManager.NetFrameNumber; + public static int LocalTick => OrderManager.LocalFrameNumber; public static event Action OnRemoteDirectConnect = _ => { }; public static event Action ConnectionStateChanged = _ => { }; static ConnectionState lastConnectionState = ConnectionState.PreConnecting; - public static int LocalClientId { get { return OrderManager.Connection.LocalClientId; } } + public static int LocalClientId => OrderManager.Connection.LocalClientId; public static void RemoteDirectConnect(ConnectionTarget endpoint) { diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index 96acd686e1..e78d1bdf6c 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -33,12 +33,13 @@ namespace OpenRA public DateTime EndTimeUtc; /// Gets the game's duration, from the time the game started until the replay recording stopped. - public TimeSpan Duration { get { return EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero; } } + public TimeSpan Duration => EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero; + public IList Players { get; private set; } public HashSet DisabledSpawnPoints = new HashSet(); - public MapPreview MapPreview { get { return Game.ModData.MapCache[MapUid]; } } + public MapPreview MapPreview => Game.ModData.MapCache[MapUid]; public IEnumerable HumanPlayers { get { return Players.Where(p => p.IsHuman); } } - public bool IsSinglePlayer { get { return HumanPlayers.Count() == 1; } } + public bool IsSinglePlayer => HumanPlayers.Count() == 1; readonly Dictionary playersByRuntime; diff --git a/OpenRA.Game/Graphics/Animation.cs b/OpenRA.Game/Graphics/Animation.cs index bf4f682286..8e825e7b11 100644 --- a/OpenRA.Game/Graphics/Animation.cs +++ b/OpenRA.Game/Graphics/Animation.cs @@ -49,8 +49,8 @@ namespace OpenRA.Graphics this.paused = paused; } - public int CurrentFrame { get { return backwards ? CurrentSequence.Length - frame - 1 : frame; } } - public Sprite Image { get { return CurrentSequence.GetSprite(CurrentFrame, facingFunc()); } } + public int CurrentFrame => backwards ? CurrentSequence.Length - frame - 1 : frame; + public Sprite Image => CurrentSequence.GetSprite(CurrentFrame, facingFunc()); public IRenderable[] Render(WPos pos, WVec offset, int zOffset, PaletteReference palette) { diff --git a/OpenRA.Game/Graphics/Model.cs b/OpenRA.Game/Graphics/Model.cs index b912534992..1eb3526ca7 100644 --- a/OpenRA.Game/Graphics/Model.cs +++ b/OpenRA.Game/Graphics/Model.cs @@ -63,7 +63,7 @@ namespace OpenRA.Graphics class PlaceholderModelCache : IModelCache { - public IVertexBuffer VertexBuffer { get { throw new NotImplementedException(); } } + public IVertexBuffer VertexBuffer => throw new NotImplementedException(); public void Dispose() { } diff --git a/OpenRA.Game/Graphics/ModelAnimation.cs b/OpenRA.Game/Graphics/ModelAnimation.cs index 884363a45b..6bc96f060b 100644 --- a/OpenRA.Game/Graphics/ModelAnimation.cs +++ b/OpenRA.Game/Graphics/ModelAnimation.cs @@ -46,12 +46,6 @@ namespace OpenRA.Graphics xy.Y + (int)(r.Bottom * scale)); } - public bool IsVisible - { - get - { - return DisableFunc == null || !DisableFunc(); - } - } + public bool IsVisible => DisableFunc == null || !DisableFunc(); } } diff --git a/OpenRA.Game/Graphics/Palette.cs b/OpenRA.Game/Graphics/Palette.cs index c7994960db..2972662950 100644 --- a/OpenRA.Game/Graphics/Palette.cs +++ b/OpenRA.Game/Graphics/Palette.cs @@ -44,7 +44,8 @@ namespace OpenRA.Graphics { IPalette palette; public ReadOnlyPalette(IPalette palette) { this.palette = palette; } - public uint this[int index] { get { return palette[index]; } } + public uint this[int index] => palette[index]; + public void CopyToArray(Array destination, int destinationOffset) { palette.CopyToArray(destination, destinationOffset); @@ -56,10 +57,7 @@ namespace OpenRA.Graphics { readonly uint[] colors = new uint[Palette.Size]; - public uint this[int index] - { - get { return colors[index]; } - } + public uint this[int index] => colors[index]; public void CopyToArray(Array destination, int destinationOffset) { @@ -126,8 +124,8 @@ namespace OpenRA.Graphics public uint this[int index] { - get { return colors[index]; } - set { colors[index] = value; } + get => colors[index]; + set => colors[index] = value; } public void CopyToArray(Array destination, int destinationOffset) diff --git a/OpenRA.Game/Graphics/PaletteReference.cs b/OpenRA.Game/Graphics/PaletteReference.cs index 51becfe3e4..26b948ac69 100644 --- a/OpenRA.Game/Graphics/PaletteReference.cs +++ b/OpenRA.Game/Graphics/PaletteReference.cs @@ -18,8 +18,8 @@ namespace OpenRA.Graphics public readonly string Name; public IPalette Palette { get; internal set; } - public float TextureIndex { get { return index / hardwarePalette.Height; } } - public float TextureMidIndex { get { return (index + 0.5f) / hardwarePalette.Height; } } + public float TextureIndex => index / hardwarePalette.Height; + public float TextureMidIndex => (index + 0.5f) / hardwarePalette.Height; public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette) { diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs index 659da8880f..2324c72d5a 100644 --- a/OpenRA.Game/Graphics/SequenceProvider.cs +++ b/OpenRA.Game/Graphics/SequenceProvider.cs @@ -52,7 +52,7 @@ namespace OpenRA.Graphics readonly string tileSet; readonly Lazy sequences; readonly Lazy spriteCache; - public SpriteCache SpriteCache { get { return spriteCache.Value; } } + public SpriteCache SpriteCache => spriteCache.Value; readonly Dictionary sequenceCache = new Dictionary(); @@ -80,7 +80,7 @@ namespace OpenRA.Graphics return seq; } - public IEnumerable Images { get { return sequences.Value.Keys; } } + public IEnumerable Images => sequences.Value.Keys; public bool HasSequence(string unitName) { diff --git a/OpenRA.Game/Graphics/Sheet.cs b/OpenRA.Game/Graphics/Sheet.cs index bb9bae1b35..a8d76f668b 100644 --- a/OpenRA.Game/Graphics/Sheet.cs +++ b/OpenRA.Game/Graphics/Sheet.cs @@ -32,7 +32,7 @@ namespace OpenRA.Graphics return data; } - public bool Buffered { get { return data != null || texture == null; } } + public bool Buffered => data != null || texture == null; public Sheet(SheetType type, Size size) { diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index 0e66d465f9..76e59fb98f 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -147,9 +147,9 @@ namespace OpenRA.Graphics return rect; } - public Sheet Current { get { return current; } } - public TextureChannel CurrentChannel { get { return channel; } } - public IEnumerable AllSheets { get { return sheets; } } + public Sheet Current => current; + public TextureChannel CurrentChannel => channel; + public IEnumerable AllSheets => sheets; public void Dispose() { diff --git a/OpenRA.Game/Graphics/SpriteLoader.cs b/OpenRA.Game/Graphics/SpriteLoader.cs index eba92e89c3..d6fcb903bb 100644 --- a/OpenRA.Game/Graphics/SpriteLoader.cs +++ b/OpenRA.Game/Graphics/SpriteLoader.cs @@ -164,7 +164,7 @@ namespace OpenRA.Graphics frames = new Cache(filename => FrameLoader.GetFrames(fileSystem, filename, loaders, out _)); } - public ISpriteFrame[] this[string filename] { get { return frames[filename]; } } + public ISpriteFrame[] this[string filename] => frames[filename]; } public static class FrameLoader diff --git a/OpenRA.Game/Graphics/SpriteRenderable.cs b/OpenRA.Game/Graphics/SpriteRenderable.cs index ef8bdba409..e478e17d44 100644 --- a/OpenRA.Game/Graphics/SpriteRenderable.cs +++ b/OpenRA.Game/Graphics/SpriteRenderable.cs @@ -43,15 +43,15 @@ namespace OpenRA.Graphics this.alpha = alpha; } - public WPos Pos { get { return pos + offset; } } - public WVec Offset { get { return offset; } } - public PaletteReference Palette { get { return palette; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return isDecoration; } } + public WPos Pos => pos + offset; + public WVec Offset => offset; + public PaletteReference Palette => palette; + public int ZOffset => zOffset; + public bool IsDecoration => isDecoration; - public float Alpha { get { return alpha; } } - public float3 Tint { get { return tint; } } - public TintModifiers TintModifiers { get { return tintModifiers; } } + public float Alpha => alpha; + public float3 Tint => tint; + public TintModifiers TintModifiers => tintModifiers; public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new SpriteRenderable(sprite, pos, offset, zOffset, newPalette, scale, alpha, tint, tintModifiers, isDecoration); } public IRenderable WithZOffset(int newOffset) { return new SpriteRenderable(sprite, pos, offset, newOffset, palette, scale, alpha, tint, tintModifiers, isDecoration); } diff --git a/OpenRA.Game/Graphics/TargetLineRenderable.cs b/OpenRA.Game/Graphics/TargetLineRenderable.cs index 8473c7048f..ecc542abcd 100644 --- a/OpenRA.Game/Graphics/TargetLineRenderable.cs +++ b/OpenRA.Game/Graphics/TargetLineRenderable.cs @@ -30,9 +30,9 @@ namespace OpenRA.Graphics this.markerSize = markerSize; } - public WPos Pos { get { return waypoints.First(); } } - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => waypoints.First(); + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new TargetLineRenderable(waypoints, color); } public IRenderable OffsetBy(WVec vec) { return new TargetLineRenderable(waypoints.Select(w => w + vec), color); } diff --git a/OpenRA.Game/Graphics/UISpriteRenderable.cs b/OpenRA.Game/Graphics/UISpriteRenderable.cs index 0afac9c62e..0930881138 100644 --- a/OpenRA.Game/Graphics/UISpriteRenderable.cs +++ b/OpenRA.Game/Graphics/UISpriteRenderable.cs @@ -35,12 +35,12 @@ namespace OpenRA.Graphics } // Does not exist in the world, so a world positions don't make sense - public WPos Pos { get { return effectiveWorldPos; } } - public WVec Offset { get { return WVec.Zero; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => effectiveWorldPos; + public WVec Offset => WVec.Zero; + public bool IsDecoration => true; - public PaletteReference Palette { get { return palette; } } - public int ZOffset { get { return zOffset; } } + public PaletteReference Palette => palette; + public int ZOffset => zOffset; public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new UISpriteRenderable(sprite, effectiveWorldPos, screenPos, zOffset, newPalette, scale, alpha); } public IRenderable WithZOffset(int newOffset) { return this; } diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 05aacec8ce..dc137c5c6c 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -51,11 +51,11 @@ namespace OpenRA.Graphics // Viewport geometry (world-px) public int2 CenterLocation { get; private set; } - public WPos CenterPosition { get { return worldRenderer.ProjectedPosition(CenterLocation); } } + public WPos CenterPosition => worldRenderer.ProjectedPosition(CenterLocation); - public Rectangle Rectangle { get { return new Rectangle(TopLeft, new Size(viewportSize.X, viewportSize.Y)); } } - public int2 TopLeft { get { return CenterLocation - viewportSize / 2; } } - public int2 BottomRight { get { return CenterLocation + viewportSize / 2; } } + public Rectangle Rectangle => new Rectangle(TopLeft, new Size(viewportSize.X, viewportSize.Y)); + public int2 TopLeft => CenterLocation - viewportSize / 2; + public int2 BottomRight => CenterLocation + viewportSize / 2; int2 viewportSize; ProjectedCellRegion cells; bool cellsDirty = true; @@ -75,10 +75,7 @@ namespace OpenRA.Graphics public float Zoom { - get - { - return zoom; - } + get => zoom; private set { @@ -89,7 +86,7 @@ namespace OpenRA.Graphics } } - public float MinZoom { get { return minZoom; } } + public float MinZoom => minZoom; public void AdjustZoom(float dz) { diff --git a/OpenRA.Game/HotkeyManager.cs b/OpenRA.Game/HotkeyManager.cs index 392d16971f..0a028b7dae 100644 --- a/OpenRA.Game/HotkeyManager.cs +++ b/OpenRA.Game/HotkeyManager.cs @@ -96,14 +96,8 @@ namespace OpenRA return null; } - public HotkeyReference this[string name] - { - get - { - return new HotkeyReference(GetHotkeyReference(name)); - } - } + public HotkeyReference this[string name] => new HotkeyReference(GetHotkeyReference(name)); - public IEnumerable Definitions { get { return definitions.Values; } } + public IEnumerable Definitions => definitions.Values; } } diff --git a/OpenRA.Game/Input/InputHandler.cs b/OpenRA.Game/Input/InputHandler.cs index b36432fb12..d4094d3b8c 100644 --- a/OpenRA.Game/Input/InputHandler.cs +++ b/OpenRA.Game/Input/InputHandler.cs @@ -53,20 +53,8 @@ namespace OpenRA public class MouseButtonPreference { - public MouseButton Action - { - get - { - return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Left : MouseButton.Right; - } - } + public MouseButton Action => Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Left : MouseButton.Right; - public MouseButton Cancel - { - get - { - return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Right : MouseButton.Left; - } - } + public MouseButton Cancel => Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Right : MouseButton.Left; } } diff --git a/OpenRA.Game/InstalledMods.cs b/OpenRA.Game/InstalledMods.cs index 27c8728826..14ae4157ef 100644 --- a/OpenRA.Game/InstalledMods.cs +++ b/OpenRA.Game/InstalledMods.cs @@ -99,10 +99,10 @@ namespace OpenRA return ret; } - public Manifest this[string key] { get { return mods[key]; } } - public int Count { get { return mods.Count; } } - public ICollection Keys { get { return mods.Keys; } } - public ICollection Values { get { return mods.Values; } } + public Manifest this[string key] => mods[key]; + public int Count => mods.Count; + public ICollection Keys => mods.Keys; + public ICollection Values => mods.Values; public bool ContainsKey(string key) { return mods.ContainsKey(key); } public IEnumerator> GetEnumerator() { return mods.GetEnumerator(); } public bool TryGetValue(string key, out Manifest value) { return mods.TryGetValue(key, out value); } diff --git a/OpenRA.Game/LocalPlayerProfile.cs b/OpenRA.Game/LocalPlayerProfile.cs index 9da2b880e3..833a17a285 100644 --- a/OpenRA.Game/LocalPlayerProfile.cs +++ b/OpenRA.Game/LocalPlayerProfile.cs @@ -24,11 +24,11 @@ namespace OpenRA const int AuthKeySize = 2048; public enum LinkState { Uninitialized, GeneratingKeys, Unlinked, CheckingLink, ConnectionFailed, Linked } - public LinkState State { get { return innerState; } } - public string Fingerprint { get { return innerFingerprint; } } - public string PublicKey { get { return innerPublicKey; } } + public LinkState State => innerState; + public string Fingerprint => innerFingerprint; + public string PublicKey => innerPublicKey; - public PlayerProfile ProfileData { get { return innerData; } } + public PlayerProfile ProfileData => innerData; volatile LinkState innerState; volatile PlayerProfile innerData; diff --git a/OpenRA.Game/Map/ActorInitializer.cs b/OpenRA.Game/Map/ActorInitializer.cs index ffe7f523a5..4f0cf50691 100644 --- a/OpenRA.Game/Map/ActorInitializer.cs +++ b/OpenRA.Game/Map/ActorInitializer.cs @@ -37,7 +37,7 @@ namespace OpenRA public class ActorInitializer : IActorInitializer { public readonly Actor Self; - public World World { get { return Self.World; } } + public World World => Self.World; internal TypeDictionary Dict; @@ -150,7 +150,7 @@ namespace OpenRA protected ValueActorInit(T value) { this.value = value; } - public virtual T Value { get { return value; } } + public virtual T Value => value; public virtual void Initialize(MiniYaml yaml) { diff --git a/OpenRA.Game/Map/ActorReference.cs b/OpenRA.Game/Map/ActorReference.cs index 1977dacac2..80e6afb1da 100644 --- a/OpenRA.Game/Map/ActorReference.cs +++ b/OpenRA.Game/Map/ActorReference.cs @@ -27,7 +27,7 @@ namespace OpenRA public string Type; Lazy initDict; - internal TypeDictionary InitDict { get { return initDict.Value; } } + internal TypeDictionary InitDict => initDict.Value; public ActorReference(string type) : this(type, new Dictionary()) { } diff --git a/OpenRA.Game/Map/CellLayer.cs b/OpenRA.Game/Map/CellLayer.cs index 3a291ec45c..ed5dae94e9 100644 --- a/OpenRA.Game/Map/CellLayer.cs +++ b/OpenRA.Game/Map/CellLayer.cs @@ -64,10 +64,7 @@ namespace OpenRA /// Gets or sets the using cell coordinates public T this[CPos cell] { - get - { - return entries[Index(cell)]; - } + get => entries[Index(cell)]; set { @@ -80,10 +77,7 @@ namespace OpenRA /// Gets or sets the layer contents using raw map coordinates (not CPos!) public T this[MPos uv] { - get - { - return entries[Index(uv)]; - } + get => entries[Index(uv)]; set { diff --git a/OpenRA.Game/Map/CellRegion.cs b/OpenRA.Game/Map/CellRegion.cs index a3a23e6f51..7f0da7d671 100644 --- a/OpenRA.Game/Map/CellRegion.cs +++ b/OpenRA.Game/Map/CellRegion.cs @@ -97,10 +97,7 @@ namespace OpenRA return uv.U >= mapTopLeft.U && uv.U <= mapBottomRight.U && uv.V >= mapTopLeft.V && uv.V <= mapBottomRight.V; } - public MapCoordsRegion MapCoords - { - get { return new MapCoordsRegion(mapTopLeft, mapBottomRight); } - } + public MapCoordsRegion MapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight); public CellRegionEnumerator GetEnumerator() { @@ -161,8 +158,8 @@ namespace OpenRA v = r.mapTopLeft.V; } - public CPos Current { get { return current; } } - object IEnumerator.Current { get { return Current; } } + public CPos Current => current; + object IEnumerator.Current => Current; public void Dispose() { } } } diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index bbc7fe954f..c122c6cfa9 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -902,15 +902,9 @@ namespace OpenRA /// /// The size of the map Height step in world units /// - public WDist CellHeightStep - { - get - { - // RectangularIsometric defines 1024 units along the diagonal axis, - // giving a half-tile height step of sqrt(2) * 512 - return new WDist(Grid.Type == MapGridType.RectangularIsometric ? 724 : 512); - } - } + /// 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 CPos CellContaining(WPos pos) { diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 16bf4c0da8..8e260bf4b8 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -335,10 +335,7 @@ namespace OpenRA return initialUid; } - public MapPreview this[string key] - { - get { return previews[key]; } - } + public MapPreview this[string key] => previews[key]; public IEnumerator GetEnumerator() { diff --git a/OpenRA.Game/Map/MapCoordsRegion.cs b/OpenRA.Game/Map/MapCoordsRegion.cs index 488eafb472..d4d813330e 100644 --- a/OpenRA.Game/Map/MapCoordsRegion.cs +++ b/OpenRA.Game/Map/MapCoordsRegion.cs @@ -53,8 +53,8 @@ namespace OpenRA current = new MPos(r.topLeft.U - 1, r.topLeft.V); } - public MPos Current { get { return current; } } - object IEnumerator.Current { get { return Current; } } + public MPos Current => current; + object IEnumerator.Current => Current; public void Dispose() { } } @@ -82,7 +82,7 @@ namespace OpenRA return GetEnumerator(); } - public MPos TopLeft { get { return topLeft; } } - public MPos BottomRight { get { return bottomRight; } } + public MPos TopLeft => topLeft; + public MPos BottomRight => bottomRight; } } diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 24ab5bf20e..cc9569631b 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -84,7 +84,7 @@ namespace OpenRA public MapVisibility Visibility; Lazy rules; - public Ruleset Rules { get { return rules != null ? rules.Value : null; } } + public Ruleset Rules => rules != null ? rules.Value : null; public bool InvalidCustomRules { get; private set; } public bool DefinesUnsafeCustomRules { get; private set; } public bool RulesLoaded { get; private set; } @@ -138,23 +138,24 @@ namespace OpenRA volatile InnerData innerData; - public string Title { get { return innerData.Title; } } - public string[] Categories { get { return innerData.Categories; } } - public string Author { get { return innerData.Author; } } - public string TileSet { get { return innerData.TileSet; } } - public MapPlayers Players { get { return innerData.Players; } } - public int PlayerCount { get { return innerData.PlayerCount; } } - public CPos[] SpawnPoints { get { return innerData.SpawnPoints; } } - public MapGridType GridType { get { return innerData.GridType; } } - public Rectangle Bounds { get { return innerData.Bounds; } } - public Png Preview { get { return innerData.Preview; } } - public MapStatus Status { get { return innerData.Status; } } - public MapClassification Class { get { return innerData.Class; } } - public MapVisibility Visibility { get { return innerData.Visibility; } } + public string Title => innerData.Title; + public string[] Categories => innerData.Categories; + public string Author => innerData.Author; + public string TileSet => innerData.TileSet; + public MapPlayers Players => innerData.Players; + public int PlayerCount => innerData.PlayerCount; + public CPos[] SpawnPoints => innerData.SpawnPoints; + public MapGridType GridType => innerData.GridType; + public Rectangle Bounds => innerData.Bounds; + public Png Preview => innerData.Preview; + public MapStatus Status => innerData.Status; + public MapClassification Class => innerData.Class; + public MapVisibility Visibility => innerData.Visibility; + + public Ruleset Rules => innerData.Rules; + public bool InvalidCustomRules => innerData.InvalidCustomRules; + public bool RulesLoaded => innerData.RulesLoaded; - public Ruleset Rules { get { return innerData.Rules; } } - public bool InvalidCustomRules { get { return innerData.InvalidCustomRules; } } - public bool RulesLoaded { get { return innerData.RulesLoaded; } } public bool DefinesUnsafeCustomRules { get diff --git a/OpenRA.Game/Map/ProjectedCellLayer.cs b/OpenRA.Game/Map/ProjectedCellLayer.cs index f3482fba20..76a3989ae7 100644 --- a/OpenRA.Game/Map/ProjectedCellLayer.cs +++ b/OpenRA.Game/Map/ProjectedCellLayer.cs @@ -15,7 +15,7 @@ namespace OpenRA { public sealed class ProjectedCellLayer : CellLayerBase { - public int MaxIndex { get { return Size.Width * Size.Height; } } + public int MaxIndex => Size.Width * Size.Height; public ProjectedCellLayer(Map map) : base(map) { } @@ -36,29 +36,17 @@ namespace OpenRA public T this[int index] { - get - { - return entries[index]; - } + get => entries[index]; - set - { - entries[index] = value; - } + set => entries[index] = value; } /// Gets or sets the layer contents using projected map coordinates. public T this[PPos uv] { - get - { - return entries[Index(uv)]; - } + get => entries[Index(uv)]; - set - { - entries[Index(uv)] = value; - } + set => entries[Index(uv)] = value; } public bool Contains(PPos uv) diff --git a/OpenRA.Game/Map/ProjectedCellRegion.cs b/OpenRA.Game/Map/ProjectedCellRegion.cs index 985d892949..5426f28404 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 { get { return new MapCoordsRegion(mapTopLeft, mapBottomRight); } } + public MapCoordsRegion CandidateMapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight); public ProjectedCellRegionEnumerator GetEnumerator() { @@ -119,8 +119,8 @@ namespace OpenRA v = r.TopLeft.V; } - public PPos Current { get { return current; } } - object IEnumerator.Current { get { return Current; } } + public PPos Current => current; + object IEnumerator.Current => Current; public void Dispose() { } } } diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 7067771029..3228811b53 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -38,16 +38,16 @@ namespace OpenRA public ILoadScreen LoadScreen { get; private set; } public CursorProvider CursorProvider { get; private set; } public FS ModFiles; - public IReadOnlyFileSystem DefaultFileSystem { get { return ModFiles; } } + public IReadOnlyFileSystem DefaultFileSystem => ModFiles; readonly Lazy defaultRules; - public Ruleset DefaultRules { get { return defaultRules.Value; } } + public Ruleset DefaultRules => defaultRules.Value; readonly Lazy> defaultTerrainInfo; - public IReadOnlyDictionary DefaultTerrainInfo { get { return defaultTerrainInfo.Value; } } + public IReadOnlyDictionary DefaultTerrainInfo => defaultTerrainInfo.Value; readonly Lazy> defaultSequences; - public IReadOnlyDictionary DefaultSequences { get { return defaultSequences.Value; } } + public IReadOnlyDictionary DefaultSequences => defaultSequences.Value; public ModData(Manifest mod, InstalledMods mods, bool useLoadScreen = false) { @@ -134,7 +134,7 @@ namespace OpenRA LoadScreen.Display(); } - internal bool IsOnMainThread { get { return System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId; } } + internal bool IsOnMainThread => System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId; public void InitializeLoaders(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index df20adcde8..2c9d243fcd 100644 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -101,25 +101,13 @@ namespace OpenRA.Network readonly List receivedPackets = new List(); public ReplayRecorder Recorder { get; private set; } - public virtual int LocalClientId - { - get { return 1; } - } + public virtual int LocalClientId => 1; - public virtual ConnectionState ConnectionState - { - get { return ConnectionState.PreConnecting; } - } + public virtual ConnectionState ConnectionState => ConnectionState.PreConnecting; - public virtual IPEndPoint EndPoint - { - get { throw new NotSupportedException("An echo connection doesn't have an endpoint"); } - } + public virtual IPEndPoint EndPoint => throw new NotSupportedException("An echo connection doesn't have an endpoint"); - public virtual string ErrorMessage - { - get { return null; } - } + public virtual string ErrorMessage => null; public virtual void Send(int frame, List orders) { @@ -209,9 +197,9 @@ namespace OpenRA.Network bool disposed; string errorMessage; - public override IPEndPoint EndPoint { get { return endpoint; } } + public override IPEndPoint EndPoint => endpoint; - public override string ErrorMessage { get { return errorMessage; } } + public override string ErrorMessage => errorMessage; public NetworkConnection(ConnectionTarget target) { @@ -325,8 +313,8 @@ namespace OpenRA.Network } } - public override int LocalClientId { get { return clientId; } } - public override ConnectionState ConnectionState { get { return connectionState; } } + public override int LocalClientId => clientId; + public override ConnectionState ConnectionState => connectionState; public override void SendSync(int frame, byte[] syncData) { diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs index f0f914a2e7..c95d2a3dce 100644 --- a/OpenRA.Game/Network/GameServer.cs +++ b/OpenRA.Game/Network/GameServer.cs @@ -135,7 +135,7 @@ namespace OpenRA.Network /// The list of spawnpoints that are disabled for this game public readonly int[] DisabledSpawnPoints = { }; - public string ModLabel { get { return "{0} ({1})".F(ModTitle, Version); } } + public string ModLabel => "{0} ({1})".F(ModTitle, Version); static object LoadClients(MiniYaml yaml) { diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs index f1c9767295..954a446d2e 100644 --- a/OpenRA.Game/Network/Order.cs +++ b/OpenRA.Game/Network/Order.cs @@ -68,7 +68,7 @@ namespace OpenRA public bool SuppressVisualFeedback; public ref readonly Target VisualFeedbackTarget => ref visualFeedbackTarget; - public Player Player { get { return Subject != null ? Subject.Owner : null; } } + public Player Player => Subject != null ? Subject.Owner : null; readonly Target target; readonly Target visualFeedbackTarget; diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index e0fe3392b6..11f47c1e59 100644 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -25,7 +25,7 @@ namespace OpenRA.Network readonly FrameData frameData = new FrameData(); public Session LobbyInfo = new Session(); - public Session.Client LocalClient { get { return LobbyInfo.ClientWithIndex(Connection.LocalClientId); } } + public Session.Client LocalClient => LobbyInfo.ClientWithIndex(Connection.LocalClientId); public World World; public readonly ConnectionTarget Endpoint; @@ -41,7 +41,7 @@ namespace OpenRA.Network public long LastTickTime = Game.RunTime; - public bool GameStarted { get { return NetFrameNumber != 0; } } + public bool GameStarted => NetFrameNumber != 0; public IConnection Connection { get; private set; } internal int GameSaveLastFrame = -1; @@ -170,10 +170,7 @@ namespace OpenRA.Network syncForFrame.Add(frame, packet); } - public bool IsReadyForNextFrame - { - get { return GameStarted && frameData.IsReadyForFrame(NetFrameNumber); } - } + public bool IsReadyForNextFrame => GameStarted && frameData.IsReadyForFrame(NetFrameNumber); public IEnumerable GetClientsNotReadyForNextFrame { diff --git a/OpenRA.Game/Network/ReplayConnection.cs b/OpenRA.Game/Network/ReplayConnection.cs index c0ecaf0d7f..81faa1a63a 100644 --- a/OpenRA.Game/Network/ReplayConnection.cs +++ b/OpenRA.Game/Network/ReplayConnection.cs @@ -30,14 +30,12 @@ namespace OpenRA.Network int ordersFrame; Dictionary lastClientsFrame = new Dictionary(); - public int LocalClientId { get { return -1; } } - public ConnectionState ConnectionState { get { return ConnectionState.Connected; } } - public IPEndPoint EndPoint - { - get { throw new NotSupportedException("A replay connection doesn't have an endpoint"); } - } + public int LocalClientId => -1; + public ConnectionState ConnectionState => ConnectionState.Connected; - public string ErrorMessage { get { return null; } } + public IPEndPoint EndPoint => throw new NotSupportedException("A replay connection doesn't have an endpoint"); + + public string ErrorMessage => null; public readonly int TickCount; public readonly int FinalGameTick; diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index 090b218c30..22561f2cad 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -149,9 +149,9 @@ namespace OpenRA.Network public string Bot; // Bot type, null for real clients public int BotControllerClientIndex; // who added the bot to the slot public bool IsAdmin; - public bool IsReady { get { return State == ClientState.Ready; } } - public bool IsInvalid { get { return State == ClientState.Invalid; } } - public bool IsObserver { get { return Slot == null; } } + public bool IsReady => State == ClientState.Ready; + public bool IsInvalid => State == ClientState.Invalid; + public bool IsObserver => Slot == null; // Linked to the online player database public string Fingerprint; @@ -215,7 +215,7 @@ namespace OpenRA.Network public string PreferredValue; public bool IsLocked; - public bool IsEnabled { get { return Value == "True"; } } + public bool IsEnabled => Value == "True"; } public class Global diff --git a/OpenRA.Game/Network/UPnP.cs b/OpenRA.Game/Network/UPnP.cs index 96e2e430dd..15fd29b696 100644 --- a/OpenRA.Game/Network/UPnP.cs +++ b/OpenRA.Game/Network/UPnP.cs @@ -28,14 +28,9 @@ namespace OpenRA.Network static bool initialized; public static IPAddress ExternalIP { get; private set; } - public static UPnPStatus Status - { - get - { - return initialized ? natDevice != null ? - UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled; - } - } + public static UPnPStatus Status => + initialized ? natDevice != null ? + UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled; public static async Task DiscoverNatDevices(int timeout) { diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 03134b2c98..0870b10868 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -214,6 +214,6 @@ namespace OpenRA.Orders } } - public virtual bool ClearSelectionOnLeftClick { get { return true; } } + public virtual bool ClearSelectionOnLeftClick => true; } } diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs index 1de967f2f9..e89a707a85 100644 --- a/OpenRA.Game/Platform.cs +++ b/OpenRA.Game/Platform.cs @@ -22,7 +22,7 @@ namespace OpenRA public static class Platform { - public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } } + public static PlatformType CurrentPlatform => currentPlatform.Value; public static readonly Guid SessionGUID = Guid.NewGuid(); static Lazy currentPlatform = Exts.Lazy(GetCurrentPlatform); @@ -77,7 +77,7 @@ namespace OpenRA /// /// Directory containing user-specific support files (settings, maps, replays, game data, etc). /// - public static string SupportDir { get { return GetSupportDir(SupportDirType.User); } } + public static string SupportDir => GetSupportDir(SupportDirType.User); public static string GetSupportDir(SupportDirType type) { diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index b7904ecfff..fb7c21be7c 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -77,14 +77,8 @@ namespace OpenRA public WinState WinState = WinState.Undefined; public bool HasObjectives = false; - public bool Spectating - { - get - { - // Players in mission maps must not leave the player view - return !inMissionMap && (spectating || WinState != WinState.Undefined); - } - } + // Players in mission maps must not leave the player view + public bool Spectating => !inMissionMap && (spectating || WinState != WinState.Undefined); public World World { get; private set; } @@ -301,8 +295,8 @@ namespace OpenRA public LuaValue this[LuaRuntime runtime, LuaValue keyValue] { - get { return luaInterface.Value[runtime, keyValue]; } - set { luaInterface.Value[runtime, keyValue] = value; } + get => luaInterface.Value[runtime, keyValue]; + set => luaInterface.Value[runtime, keyValue] = value; } public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right) diff --git a/OpenRA.Game/Primitives/BitSet.cs b/OpenRA.Game/Primitives/BitSet.cs index da34b5bf9b..9881325441 100644 --- a/OpenRA.Game/Primitives/BitSet.cs +++ b/OpenRA.Game/Primitives/BitSet.cs @@ -101,7 +101,7 @@ namespace OpenRA.Primitives public override bool Equals(object obj) { return obj is BitSet && Equals((BitSet)obj); } public override int GetHashCode() { return bits.GetHashCode(); } - public bool IsEmpty { get { return bits == 0; } } + public bool IsEmpty => bits == 0; public bool IsProperSubsetOf(BitSet other) { diff --git a/OpenRA.Game/Primitives/Cache.cs b/OpenRA.Game/Primitives/Cache.cs index 359e773537..75cea420f3 100644 --- a/OpenRA.Game/Primitives/Cache.cs +++ b/OpenRA.Game/Primitives/Cache.cs @@ -31,18 +31,15 @@ namespace OpenRA.Primitives public Cache(Func loader) : this(loader, EqualityComparer.Default) { } - public U this[T key] - { - get { return cache.GetOrAdd(key, loader); } - } + public U this[T key] => cache.GetOrAdd(key, loader); public bool ContainsKey(T key) { return cache.ContainsKey(key); } public bool TryGetValue(T key, out U value) { return cache.TryGetValue(key, out value); } - public int Count { get { return cache.Count; } } + public int Count => cache.Count; public void Clear() { cache.Clear(); } - public ICollection Keys { get { return cache.Keys; } } - public ICollection Values { get { return cache.Values; } } + public ICollection Keys => cache.Keys; + public ICollection Values => cache.Values; public IEnumerator> GetEnumerator() { return cache.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } } diff --git a/OpenRA.Game/Primitives/Color.cs b/OpenRA.Game/Primitives/Color.cs index def4ab341b..13819d6b7e 100644 --- a/OpenRA.Game/Primitives/Color.cs +++ b/OpenRA.Game/Primitives/Color.cs @@ -195,10 +195,10 @@ namespace OpenRA.Primitives return hue; } - public byte A { get { return (byte)(argb >> 24); } } - public byte R { get { return (byte)(argb >> 16); } } - public byte G { get { return (byte)(argb >> 8); } } - public byte B { get { return (byte)argb; } } + public byte A => (byte)(argb >> 24); + public byte R => (byte)(argb >> 16); + public byte G => (byte)(argb >> 8); + public byte B => (byte)argb; public bool Equals(Color other) { @@ -226,146 +226,146 @@ namespace OpenRA.Primitives return R.ToString("X2") + G.ToString("X2") + B.ToString("X2") + A.ToString("X2"); } - public static Color Transparent { get { return FromArgb(0x00FFFFFF); } } - public static Color AliceBlue { get { return FromArgb(0xFFF0F8FF); } } - public static Color AntiqueWhite { get { return FromArgb(0xFFFAEBD7); } } - public static Color Aqua { get { return FromArgb(0xFF00FFFF); } } - public static Color Aquamarine { get { return FromArgb(0xFF7FFFD4); } } - public static Color Azure { get { return FromArgb(0xFFF0FFFF); } } - public static Color Beige { get { return FromArgb(0xFFF5F5DC); } } - public static Color Bisque { get { return FromArgb(0xFFFFE4C4); } } - public static Color Black { get { return FromArgb(0xFF000000); } } - public static Color BlanchedAlmond { get { return FromArgb(0xFFFFEBCD); } } - public static Color Blue { get { return FromArgb(0xFF0000FF); } } - public static Color BlueViolet { get { return FromArgb(0xFF8A2BE2); } } - public static Color Brown { get { return FromArgb(0xFFA52A2A); } } - public static Color BurlyWood { get { return FromArgb(0xFFDEB887); } } - public static Color CadetBlue { get { return FromArgb(0xFF5F9EA0); } } - public static Color Chartreuse { get { return FromArgb(0xFF7FFF00); } } - public static Color Chocolate { get { return FromArgb(0xFFD2691E); } } - public static Color Coral { get { return FromArgb(0xFFFF7F50); } } - public static Color CornflowerBlue { get { return FromArgb(0xFF6495ED); } } - public static Color Cornsilk { get { return FromArgb(0xFFFFF8DC); } } - public static Color Crimson { get { return FromArgb(0xFFDC143C); } } - public static Color Cyan { get { return FromArgb(0xFF00FFFF); } } - public static Color DarkBlue { get { return FromArgb(0xFF00008B); } } - public static Color DarkCyan { get { return FromArgb(0xFF008B8B); } } - public static Color DarkGoldenrod { get { return FromArgb(0xFFB8860B); } } - public static Color DarkGray { get { return FromArgb(0xFFA9A9A9); } } - public static Color DarkGreen { get { return FromArgb(0xFF006400); } } - public static Color DarkKhaki { get { return FromArgb(0xFFBDB76B); } } - public static Color DarkMagenta { get { return FromArgb(0xFF8B008B); } } - public static Color DarkOliveGreen { get { return FromArgb(0xFF556B2F); } } - public static Color DarkOrange { get { return FromArgb(0xFFFF8C00); } } - public static Color DarkOrchid { get { return FromArgb(0xFF9932CC); } } - public static Color DarkRed { get { return FromArgb(0xFF8B0000); } } - public static Color DarkSalmon { get { return FromArgb(0xFFE9967A); } } - public static Color DarkSeaGreen { get { return FromArgb(0xFF8FBC8B); } } - public static Color DarkSlateBlue { get { return FromArgb(0xFF483D8B); } } - public static Color DarkSlateGray { get { return FromArgb(0xFF2F4F4F); } } - public static Color DarkTurquoise { get { return FromArgb(0xFF00CED1); } } - public static Color DarkViolet { get { return FromArgb(0xFF9400D3); } } - public static Color DeepPink { get { return FromArgb(0xFFFF1493); } } - public static Color DeepSkyBlue { get { return FromArgb(0xFF00BFFF); } } - public static Color DimGray { get { return FromArgb(0xFF696969); } } - public static Color DodgerBlue { get { return FromArgb(0xFF1E90FF); } } - public static Color Firebrick { get { return FromArgb(0xFFB22222); } } - public static Color FloralWhite { get { return FromArgb(0xFFFFFAF0); } } - public static Color ForestGreen { get { return FromArgb(0xFF228B22); } } - public static Color Fuchsia { get { return FromArgb(0xFFFF00FF); } } - public static Color Gainsboro { get { return FromArgb(0xFFDCDCDC); } } - public static Color GhostWhite { get { return FromArgb(0xFFF8F8FF); } } - public static Color Gold { get { return FromArgb(0xFFFFD700); } } - public static Color Goldenrod { get { return FromArgb(0xFFDAA520); } } - public static Color Gray { get { return FromArgb(0xFF808080); } } - public static Color Green { get { return FromArgb(0xFF008000); } } - public static Color GreenYellow { get { return FromArgb(0xFFADFF2F); } } - public static Color Honeydew { get { return FromArgb(0xFFF0FFF0); } } - public static Color HotPink { get { return FromArgb(0xFFFF69B4); } } - public static Color IndianRed { get { return FromArgb(0xFFCD5C5C); } } - public static Color Indigo { get { return FromArgb(0xFF4B0082); } } - public static Color Ivory { get { return FromArgb(0xFFFFFFF0); } } - public static Color Khaki { get { return FromArgb(0xFFF0E68C); } } - public static Color Lavender { get { return FromArgb(0xFFE6E6FA); } } - public static Color LavenderBlush { get { return FromArgb(0xFFFFF0F5); } } - public static Color LawnGreen { get { return FromArgb(0xFF7CFC00); } } - public static Color LemonChiffon { get { return FromArgb(0xFFFFFACD); } } - public static Color LightBlue { get { return FromArgb(0xFFADD8E6); } } - public static Color LightCoral { get { return FromArgb(0xFFF08080); } } - public static Color LightCyan { get { return FromArgb(0xFFE0FFFF); } } - public static Color LightGoldenrodYellow { get { return FromArgb(0xFFFAFAD2); } } - public static Color LightGray { get { return FromArgb(0xFFD3D3D3); } } - public static Color LightGreen { get { return FromArgb(0xFF90EE90); } } - public static Color LightPink { get { return FromArgb(0xFFFFB6C1); } } - public static Color LightSalmon { get { return FromArgb(0xFFFFA07A); } } - public static Color LightSeaGreen { get { return FromArgb(0xFF20B2AA); } } - public static Color LightSkyBlue { get { return FromArgb(0xFF87CEFA); } } - public static Color LightSlateGray { get { return FromArgb(0xFF778899); } } - public static Color LightSteelBlue { get { return FromArgb(0xFFB0C4DE); } } - public static Color LightYellow { get { return FromArgb(0xFFFFFFE0); } } - public static Color Lime { get { return FromArgb(0xFF00FF00); } } - public static Color LimeGreen { get { return FromArgb(0xFF32CD32); } } - public static Color Linen { get { return FromArgb(0xFFFAF0E6); } } - public static Color Magenta { get { return FromArgb(0xFFFF00FF); } } - public static Color Maroon { get { return FromArgb(0xFF800000); } } - public static Color MediumAquamarine { get { return FromArgb(0xFF66CDAA); } } - public static Color MediumBlue { get { return FromArgb(0xFF0000CD); } } - public static Color MediumOrchid { get { return FromArgb(0xFFBA55D3); } } - public static Color MediumPurple { get { return FromArgb(0xFF9370DB); } } - public static Color MediumSeaGreen { get { return FromArgb(0xFF3CB371); } } - public static Color MediumSlateBlue { get { return FromArgb(0xFF7B68EE); } } - public static Color MediumSpringGreen { get { return FromArgb(0xFF00FA9A); } } - public static Color MediumTurquoise { get { return FromArgb(0xFF48D1CC); } } - public static Color MediumVioletRed { get { return FromArgb(0xFFC71585); } } - public static Color MidnightBlue { get { return FromArgb(0xFF191970); } } - public static Color MintCream { get { return FromArgb(0xFFF5FFFA); } } - public static Color MistyRose { get { return FromArgb(0xFFFFE4E1); } } - public static Color Moccasin { get { return FromArgb(0xFFFFE4B5); } } - public static Color NavajoWhite { get { return FromArgb(0xFFFFDEAD); } } - public static Color Navy { get { return FromArgb(0xFF000080); } } - public static Color OldLace { get { return FromArgb(0xFFFDF5E6); } } - public static Color Olive { get { return FromArgb(0xFF808000); } } - public static Color OliveDrab { get { return FromArgb(0xFF6B8E23); } } - public static Color Orange { get { return FromArgb(0xFFFFA500); } } - public static Color OrangeRed { get { return FromArgb(0xFFFF4500); } } - public static Color Orchid { get { return FromArgb(0xFFDA70D6); } } - public static Color PaleGoldenrod { get { return FromArgb(0xFFEEE8AA); } } - public static Color PaleGreen { get { return FromArgb(0xFF98FB98); } } - public static Color PaleTurquoise { get { return FromArgb(0xFFAFEEEE); } } - public static Color PaleVioletRed { get { return FromArgb(0xFFDB7093); } } - public static Color PapayaWhip { get { return FromArgb(0xFFFFEFD5); } } - public static Color PeachPuff { get { return FromArgb(0xFFFFDAB9); } } - public static Color Peru { get { return FromArgb(0xFFCD853F); } } - public static Color Pink { get { return FromArgb(0xFFFFC0CB); } } - public static Color Plum { get { return FromArgb(0xFFDDA0DD); } } - public static Color PowderBlue { get { return FromArgb(0xFFB0E0E6); } } - public static Color Purple { get { return FromArgb(0xFF800080); } } - public static Color Red { get { return FromArgb(0xFFFF0000); } } - public static Color RosyBrown { get { return FromArgb(0xFFBC8F8F); } } - public static Color RoyalBlue { get { return FromArgb(0xFF4169E1); } } - public static Color SaddleBrown { get { return FromArgb(0xFF8B4513); } } - public static Color Salmon { get { return FromArgb(0xFFFA8072); } } - public static Color SandyBrown { get { return FromArgb(0xFFF4A460); } } - public static Color SeaGreen { get { return FromArgb(0xFF2E8B57); } } - public static Color SeaShell { get { return FromArgb(0xFFFFF5EE); } } - public static Color Sienna { get { return FromArgb(0xFFA0522D); } } - public static Color Silver { get { return FromArgb(0xFFC0C0C0); } } - public static Color SkyBlue { get { return FromArgb(0xFF87CEEB); } } - public static Color SlateBlue { get { return FromArgb(0xFF6A5ACD); } } - public static Color SlateGray { get { return FromArgb(0xFF708090); } } - public static Color Snow { get { return FromArgb(0xFFFFFAFA); } } - public static Color SpringGreen { get { return FromArgb(0xFF00FF7F); } } - public static Color SteelBlue { get { return FromArgb(0xFF4682B4); } } - public static Color Tan { get { return FromArgb(0xFFD2B48C); } } - public static Color Teal { get { return FromArgb(0xFF008080); } } - public static Color Thistle { get { return FromArgb(0xFFD8BFD8); } } - public static Color Tomato { get { return FromArgb(0xFFFF6347); } } - public static Color Turquoise { get { return FromArgb(0xFF40E0D0); } } - public static Color Violet { get { return FromArgb(0xFFEE82EE); } } - public static Color Wheat { get { return FromArgb(0xFFF5DEB3); } } - public static Color White { get { return FromArgb(0xFFFFFFFF); } } - public static Color WhiteSmoke { get { return FromArgb(0xFFF5F5F5); } } - public static Color Yellow { get { return FromArgb(0xFFFFFF00); } } - public static Color YellowGreen { get { return FromArgb(0xFF9ACD32); } } + public static Color Transparent => FromArgb(0x00FFFFFF); + public static Color AliceBlue => FromArgb(0xFFF0F8FF); + public static Color AntiqueWhite => FromArgb(0xFFFAEBD7); + public static Color Aqua => FromArgb(0xFF00FFFF); + public static Color Aquamarine => FromArgb(0xFF7FFFD4); + public static Color Azure => FromArgb(0xFFF0FFFF); + public static Color Beige => FromArgb(0xFFF5F5DC); + public static Color Bisque => FromArgb(0xFFFFE4C4); + public static Color Black => FromArgb(0xFF000000); + public static Color BlanchedAlmond => FromArgb(0xFFFFEBCD); + public static Color Blue => FromArgb(0xFF0000FF); + public static Color BlueViolet => FromArgb(0xFF8A2BE2); + public static Color Brown => FromArgb(0xFFA52A2A); + public static Color BurlyWood => FromArgb(0xFFDEB887); + public static Color CadetBlue => FromArgb(0xFF5F9EA0); + public static Color Chartreuse => FromArgb(0xFF7FFF00); + public static Color Chocolate => FromArgb(0xFFD2691E); + public static Color Coral => FromArgb(0xFFFF7F50); + public static Color CornflowerBlue => FromArgb(0xFF6495ED); + public static Color Cornsilk => FromArgb(0xFFFFF8DC); + public static Color Crimson => FromArgb(0xFFDC143C); + public static Color Cyan => FromArgb(0xFF00FFFF); + public static Color DarkBlue => FromArgb(0xFF00008B); + public static Color DarkCyan => FromArgb(0xFF008B8B); + public static Color DarkGoldenrod => FromArgb(0xFFB8860B); + public static Color DarkGray => FromArgb(0xFFA9A9A9); + public static Color DarkGreen => FromArgb(0xFF006400); + public static Color DarkKhaki => FromArgb(0xFFBDB76B); + public static Color DarkMagenta => FromArgb(0xFF8B008B); + public static Color DarkOliveGreen => FromArgb(0xFF556B2F); + public static Color DarkOrange => FromArgb(0xFFFF8C00); + public static Color DarkOrchid => FromArgb(0xFF9932CC); + public static Color DarkRed => FromArgb(0xFF8B0000); + public static Color DarkSalmon => FromArgb(0xFFE9967A); + public static Color DarkSeaGreen => FromArgb(0xFF8FBC8B); + public static Color DarkSlateBlue => FromArgb(0xFF483D8B); + public static Color DarkSlateGray => FromArgb(0xFF2F4F4F); + public static Color DarkTurquoise => FromArgb(0xFF00CED1); + public static Color DarkViolet => FromArgb(0xFF9400D3); + public static Color DeepPink => FromArgb(0xFFFF1493); + public static Color DeepSkyBlue => FromArgb(0xFF00BFFF); + public static Color DimGray => FromArgb(0xFF696969); + public static Color DodgerBlue => FromArgb(0xFF1E90FF); + public static Color Firebrick => FromArgb(0xFFB22222); + public static Color FloralWhite => FromArgb(0xFFFFFAF0); + public static Color ForestGreen => FromArgb(0xFF228B22); + public static Color Fuchsia => FromArgb(0xFFFF00FF); + public static Color Gainsboro => FromArgb(0xFFDCDCDC); + public static Color GhostWhite => FromArgb(0xFFF8F8FF); + public static Color Gold => FromArgb(0xFFFFD700); + public static Color Goldenrod => FromArgb(0xFFDAA520); + public static Color Gray => FromArgb(0xFF808080); + public static Color Green => FromArgb(0xFF008000); + public static Color GreenYellow => FromArgb(0xFFADFF2F); + public static Color Honeydew => FromArgb(0xFFF0FFF0); + public static Color HotPink => FromArgb(0xFFFF69B4); + public static Color IndianRed => FromArgb(0xFFCD5C5C); + public static Color Indigo => FromArgb(0xFF4B0082); + public static Color Ivory => FromArgb(0xFFFFFFF0); + public static Color Khaki => FromArgb(0xFFF0E68C); + public static Color Lavender => FromArgb(0xFFE6E6FA); + public static Color LavenderBlush => FromArgb(0xFFFFF0F5); + public static Color LawnGreen => FromArgb(0xFF7CFC00); + public static Color LemonChiffon => FromArgb(0xFFFFFACD); + public static Color LightBlue => FromArgb(0xFFADD8E6); + public static Color LightCoral => FromArgb(0xFFF08080); + public static Color LightCyan => FromArgb(0xFFE0FFFF); + public static Color LightGoldenrodYellow => FromArgb(0xFFFAFAD2); + public static Color LightGray => FromArgb(0xFFD3D3D3); + public static Color LightGreen => FromArgb(0xFF90EE90); + public static Color LightPink => FromArgb(0xFFFFB6C1); + public static Color LightSalmon => FromArgb(0xFFFFA07A); + public static Color LightSeaGreen => FromArgb(0xFF20B2AA); + public static Color LightSkyBlue => FromArgb(0xFF87CEFA); + public static Color LightSlateGray => FromArgb(0xFF778899); + public static Color LightSteelBlue => FromArgb(0xFFB0C4DE); + public static Color LightYellow => FromArgb(0xFFFFFFE0); + public static Color Lime => FromArgb(0xFF00FF00); + public static Color LimeGreen => FromArgb(0xFF32CD32); + public static Color Linen => FromArgb(0xFFFAF0E6); + public static Color Magenta => FromArgb(0xFFFF00FF); + public static Color Maroon => FromArgb(0xFF800000); + public static Color MediumAquamarine => FromArgb(0xFF66CDAA); + public static Color MediumBlue => FromArgb(0xFF0000CD); + public static Color MediumOrchid => FromArgb(0xFFBA55D3); + public static Color MediumPurple => FromArgb(0xFF9370DB); + public static Color MediumSeaGreen => FromArgb(0xFF3CB371); + public static Color MediumSlateBlue => FromArgb(0xFF7B68EE); + public static Color MediumSpringGreen => FromArgb(0xFF00FA9A); + public static Color MediumTurquoise => FromArgb(0xFF48D1CC); + public static Color MediumVioletRed => FromArgb(0xFFC71585); + public static Color MidnightBlue => FromArgb(0xFF191970); + public static Color MintCream => FromArgb(0xFFF5FFFA); + public static Color MistyRose => FromArgb(0xFFFFE4E1); + public static Color Moccasin => FromArgb(0xFFFFE4B5); + public static Color NavajoWhite => FromArgb(0xFFFFDEAD); + public static Color Navy => FromArgb(0xFF000080); + public static Color OldLace => FromArgb(0xFFFDF5E6); + public static Color Olive => FromArgb(0xFF808000); + public static Color OliveDrab => FromArgb(0xFF6B8E23); + public static Color Orange => FromArgb(0xFFFFA500); + public static Color OrangeRed => FromArgb(0xFFFF4500); + public static Color Orchid => FromArgb(0xFFDA70D6); + public static Color PaleGoldenrod => FromArgb(0xFFEEE8AA); + public static Color PaleGreen => FromArgb(0xFF98FB98); + public static Color PaleTurquoise => FromArgb(0xFFAFEEEE); + public static Color PaleVioletRed => FromArgb(0xFFDB7093); + public static Color PapayaWhip => FromArgb(0xFFFFEFD5); + public static Color PeachPuff => FromArgb(0xFFFFDAB9); + public static Color Peru => FromArgb(0xFFCD853F); + public static Color Pink => FromArgb(0xFFFFC0CB); + public static Color Plum => FromArgb(0xFFDDA0DD); + public static Color PowderBlue => FromArgb(0xFFB0E0E6); + public static Color Purple => FromArgb(0xFF800080); + public static Color Red => FromArgb(0xFFFF0000); + public static Color RosyBrown => FromArgb(0xFFBC8F8F); + public static Color RoyalBlue => FromArgb(0xFF4169E1); + public static Color SaddleBrown => FromArgb(0xFF8B4513); + public static Color Salmon => FromArgb(0xFFFA8072); + public static Color SandyBrown => FromArgb(0xFFF4A460); + public static Color SeaGreen => FromArgb(0xFF2E8B57); + public static Color SeaShell => FromArgb(0xFFFFF5EE); + public static Color Sienna => FromArgb(0xFFA0522D); + public static Color Silver => FromArgb(0xFFC0C0C0); + public static Color SkyBlue => FromArgb(0xFF87CEEB); + public static Color SlateBlue => FromArgb(0xFF6A5ACD); + public static Color SlateGray => FromArgb(0xFF708090); + public static Color Snow => FromArgb(0xFFFFFAFA); + public static Color SpringGreen => FromArgb(0xFF00FF7F); + public static Color SteelBlue => FromArgb(0xFF4682B4); + public static Color Tan => FromArgb(0xFFD2B48C); + public static Color Teal => FromArgb(0xFF008080); + public static Color Thistle => FromArgb(0xFFD8BFD8); + public static Color Tomato => FromArgb(0xFFFF6347); + public static Color Turquoise => FromArgb(0xFF40E0D0); + public static Color Violet => FromArgb(0xFFEE82EE); + public static Color Wheat => FromArgb(0xFFF5DEB3); + public static Color White => FromArgb(0xFFFFFFFF); + public static Color WhiteSmoke => FromArgb(0xFFF5F5F5); + public static Color Yellow => FromArgb(0xFFFFFF00); + public static Color YellowGreen => FromArgb(0xFF9ACD32); } } diff --git a/OpenRA.Game/Primitives/ConcurrentCache.cs b/OpenRA.Game/Primitives/ConcurrentCache.cs index c380829fce..367aea0ab1 100644 --- a/OpenRA.Game/Primitives/ConcurrentCache.cs +++ b/OpenRA.Game/Primitives/ConcurrentCache.cs @@ -32,16 +32,13 @@ namespace OpenRA.Primitives public ConcurrentCache(Func loader) : this(loader, EqualityComparer.Default) { } - public U this[T key] - { - get { return cache.GetOrAdd(key, loader); } - } + public U this[T key] => cache.GetOrAdd(key, loader); public bool ContainsKey(T key) { return cache.ContainsKey(key); } public bool TryGetValue(T key, out U value) { return cache.TryGetValue(key, out value); } - public int Count { get { return cache.Count; } } - public ICollection Keys { get { return cache.Keys; } } - public ICollection Values { get { return cache.Values; } } + public int Count => cache.Count; + public ICollection Keys => cache.Keys; + public ICollection Values => cache.Values; public IEnumerator> GetEnumerator() { return cache.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } } diff --git a/OpenRA.Game/Primitives/LongBitSet.cs b/OpenRA.Game/Primitives/LongBitSet.cs index a8ef80ab76..ba0e958572 100644 --- a/OpenRA.Game/Primitives/LongBitSet.cs +++ b/OpenRA.Game/Primitives/LongBitSet.cs @@ -88,7 +88,7 @@ namespace OpenRA.Primitives } } - public static long Mask { get { return allBits; } } + public static long Mask => allBits; } // Opitmized BitSet to be used only when guaranteed to be no more than 64 values. @@ -124,7 +124,7 @@ namespace OpenRA.Primitives public override bool Equals(object obj) { return obj is LongBitSet && Equals((LongBitSet)obj); } public override int GetHashCode() { return bits.GetHashCode(); } - public bool IsEmpty { get { return bits == 0; } } + public bool IsEmpty => bits == 0; public bool IsProperSubsetOf(LongBitSet other) { diff --git a/OpenRA.Game/Primitives/MergedStream.cs b/OpenRA.Game/Primitives/MergedStream.cs index e4dd99d6ed..51c37c116f 100644 --- a/OpenRA.Game/Primitives/MergedStream.cs +++ b/OpenRA.Game/Primitives/MergedStream.cs @@ -108,30 +108,18 @@ namespace OpenRA.Primitives throw new NotSupportedException(); } - public override bool CanRead - { - get { return Stream1.CanRead && Stream2.CanRead; } - } + public override bool CanRead => Stream1.CanRead && Stream2.CanRead; - public override bool CanSeek - { - get { return Stream1.CanSeek && Stream2.CanSeek; } - } + public override bool CanSeek => Stream1.CanSeek && Stream2.CanSeek; - public override bool CanWrite - { - get { return false; } - } + public override bool CanWrite => false; - public override long Length - { - get { return VirtualLength; } - } + public override long Length => VirtualLength; public override long Position { - get { return position; } - set { Seek(value, SeekOrigin.Begin); } + get => position; + set => Seek(value, SeekOrigin.Begin); } } } diff --git a/OpenRA.Game/Primitives/ObservableCollection.cs b/OpenRA.Game/Primitives/ObservableCollection.cs index a6a62ba993..3aaa0c5187 100644 --- a/OpenRA.Game/Primitives/ObservableCollection.cs +++ b/OpenRA.Game/Primitives/ObservableCollection.cs @@ -57,9 +57,6 @@ namespace OpenRA.Primitives OnRemoveAt(this, index); } - public IEnumerable ObservedItems - { - get { return Items; } - } + public IEnumerable ObservedItems => Items; } } diff --git a/OpenRA.Game/Primitives/ObservableDictionary.cs b/OpenRA.Game/Primitives/ObservableDictionary.cs index b1dce81480..a91c659f67 100644 --- a/OpenRA.Game/Primitives/ObservableDictionary.cs +++ b/OpenRA.Game/Primitives/ObservableDictionary.cs @@ -74,8 +74,8 @@ namespace OpenRA.Primitives return innerDict.ContainsKey(key); } - public ICollection Keys { get { return innerDict.Keys; } } - public ICollection Values { get { return innerDict.Values; } } + public ICollection Keys => innerDict.Keys; + public ICollection Values => innerDict.Values; public bool TryGetValue(TKey key, out TValue value) { @@ -84,8 +84,8 @@ namespace OpenRA.Primitives public TValue this[TKey key] { - get { return innerDict[key]; } - set { innerDict[key] = value; } + get => innerDict[key]; + set => innerDict[key] = value; } public void Clear() @@ -94,10 +94,7 @@ namespace OpenRA.Primitives OnRefresh(this); } - public int Count - { - get { return innerDict.Count; } - } + public int Count => innerDict.Count; public void Add(KeyValuePair item) { @@ -114,10 +111,7 @@ namespace OpenRA.Primitives innerDict.CopyTo(array, arrayIndex); } - public bool IsReadOnly - { - get { return innerDict.IsReadOnly; } - } + public bool IsReadOnly => innerDict.IsReadOnly; public bool Remove(KeyValuePair item) { @@ -134,9 +128,6 @@ namespace OpenRA.Primitives return innerDict.GetEnumerator(); } - public IEnumerable ObservedItems - { - get { return innerDict.Keys; } - } + public IEnumerable ObservedItems => innerDict.Keys; } } diff --git a/OpenRA.Game/Primitives/ObservableList.cs b/OpenRA.Game/Primitives/ObservableList.cs index aedef4fd21..978dc034c8 100644 --- a/OpenRA.Game/Primitives/ObservableList.cs +++ b/OpenRA.Game/Primitives/ObservableList.cs @@ -66,7 +66,7 @@ namespace OpenRA.Primitives OnRefresh(this); } - public int Count { get { return innerList.Count; } } + public int Count => innerList.Count; public int IndexOf(T item) { return innerList.IndexOf(item); } public bool Contains(T item) { return innerList.Contains(item); } @@ -78,10 +78,7 @@ namespace OpenRA.Primitives public T this[int index] { - get - { - return innerList[index]; - } + get => innerList[index]; set { @@ -106,14 +103,8 @@ namespace OpenRA.Primitives return innerList.GetEnumerator(); } - public IEnumerable ObservedItems - { - get { return innerList; } - } + public IEnumerable ObservedItems => innerList; - public bool IsReadOnly - { - get { return innerList.IsReadOnly; } - } + public bool IsReadOnly => innerList.IsReadOnly; } } diff --git a/OpenRA.Game/Primitives/PlayerDictionary.cs b/OpenRA.Game/Primitives/PlayerDictionary.cs index 069758bbdc..74d1cde195 100644 --- a/OpenRA.Game/Primitives/PlayerDictionary.cs +++ b/OpenRA.Game/Primitives/PlayerDictionary.cs @@ -46,16 +46,16 @@ namespace OpenRA.Primitives { } /// Gets the value for the specified player. This is slower than specifying a player index. - public T this[Player player] { get { return valueByPlayer[player]; } } + public T this[Player player] => valueByPlayer[player]; /// Gets the value for the specified player index. - public T this[int playerIndex] { get { return valueByPlayerIndex[playerIndex]; } } + public T this[int playerIndex] => valueByPlayerIndex[playerIndex]; - public int Count { get { return valueByPlayerIndex.Length; } } + public int Count => valueByPlayerIndex.Length; public IEnumerator GetEnumerator() { return ((IEnumerable)valueByPlayerIndex).GetEnumerator(); } - ICollection IReadOnlyDictionary.Keys { get { return valueByPlayer.Keys; } } - ICollection IReadOnlyDictionary.Values { get { return valueByPlayer.Values; } } + ICollection IReadOnlyDictionary.Keys => valueByPlayer.Keys; + ICollection IReadOnlyDictionary.Values => valueByPlayer.Values; bool IReadOnlyDictionary.ContainsKey(Player key) { return valueByPlayer.ContainsKey(key); } bool IReadOnlyDictionary.TryGetValue(Player key, out T value) { return valueByPlayer.TryGetValue(key, out value); } IEnumerator> IEnumerable>.GetEnumerator() { return valueByPlayer.GetEnumerator(); } diff --git a/OpenRA.Game/Primitives/Polygon.cs b/OpenRA.Game/Primitives/Polygon.cs index 693a998d91..cf9b51b364 100644 --- a/OpenRA.Game/Primitives/Polygon.cs +++ b/OpenRA.Game/Primitives/Polygon.cs @@ -57,7 +57,8 @@ namespace OpenRA.Primitives } } - public bool IsEmpty { get { return BoundingRect.IsEmpty; } } + public bool IsEmpty => BoundingRect.IsEmpty; + public bool Contains(int2 xy) { return isRectangle ? BoundingRect.Contains(xy) : Vertices.PolygonContains(xy); diff --git a/OpenRA.Game/Primitives/PriorityQueue.cs b/OpenRA.Game/Primitives/PriorityQueue.cs index c1c28f9f8a..79fd09c5c7 100644 --- a/OpenRA.Game/Primitives/PriorityQueue.cs +++ b/OpenRA.Game/Primitives/PriorityQueue.cs @@ -59,7 +59,7 @@ namespace OpenRA.Primitives } } - public bool Empty { get { return level == 0; } } + public bool Empty => level == 0; T At(int level, int index) { return items[level][index]; } T Above(int level, int index) { return items[level - 1][index >> 1]; } diff --git a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs index e18b035d02..84907b1647 100644 --- a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs +++ b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs @@ -35,15 +35,16 @@ namespace OpenRA.Primitives baseStream = stream; } - public sealed override bool CanSeek { get { return false; } } - public sealed override bool CanRead { get { return true; } } - public sealed override bool CanWrite { get { return false; } } + public sealed override bool CanSeek => false; + public sealed override bool CanRead => true; + public sealed override bool CanWrite => false; + + public override long Length => throw new NotSupportedException(); - public override long Length { get { throw new NotSupportedException(); } } public sealed override long Position { - get { throw new NotSupportedException(); } - set { throw new NotSupportedException(); } + get => throw new NotSupportedException(); + set => throw new NotSupportedException(); } public sealed override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); } diff --git a/OpenRA.Game/Primitives/ReadOnlyDictionary.cs b/OpenRA.Game/Primitives/ReadOnlyDictionary.cs index d301ca840c..ab03b63d4b 100644 --- a/OpenRA.Game/Primitives/ReadOnlyDictionary.cs +++ b/OpenRA.Game/Primitives/ReadOnlyDictionary.cs @@ -73,13 +73,14 @@ namespace OpenRA return dict.TryGetValue(key, out value); } - public int Count { get { return dict.Count; } } + public int Count => dict.Count; - public TValue this[TKey key] { get { return dict[key]; } } + public TValue this[TKey key] => dict[key]; - public ICollection Keys { get { return dict.Keys; } } + public ICollection Keys => dict.Keys; + + public ICollection Values => dict.Values; - public ICollection Values { get { return dict.Values; } } #endregion #region IEnumerable implementation diff --git a/OpenRA.Game/Primitives/ReadOnlyList.cs b/OpenRA.Game/Primitives/ReadOnlyList.cs index d505c594ed..9f32c07b32 100644 --- a/OpenRA.Game/Primitives/ReadOnlyList.cs +++ b/OpenRA.Game/Primitives/ReadOnlyList.cs @@ -72,9 +72,10 @@ namespace OpenRA #endregion #region IReadOnlyList implementation - public int Count { get { return list.Count; } } + public int Count => list.Count; + + public T this[int index] => list[index]; - public T this[int index] { get { return list[index]; } } #endregion } } diff --git a/OpenRA.Game/Primitives/Rectangle.cs b/OpenRA.Game/Primitives/Rectangle.cs index 1c91907a81..f5166d526a 100644 --- a/OpenRA.Game/Primitives/Rectangle.cs +++ b/OpenRA.Game/Primitives/Rectangle.cs @@ -58,18 +58,18 @@ namespace OpenRA.Primitives Height = size.Height; } - public int Left { get { return X; } } - public int Right { get { return X + Width; } } - public int Top { get { return Y; } } - public int Bottom { get { return Y + Height; } } - public bool IsEmpty { get { return X == 0 && Y == 0 && Width == 0 && Height == 0; } } - public int2 Location { get { return new int2(X, Y); } } - public Size Size { get { return new Size(Width, Height); } } + public int Left => X; + public int Right => X + Width; + 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 TopLeft { get { return Location; } } - public int2 TopRight { get { return new int2(X + Width, Y); } } - public int2 BottomLeft { get { return new int2(X, Y + Height); } } - public int2 BottomRight { get { return new int2(X + Width, Y + 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 bool Contains(int x, int y) { diff --git a/OpenRA.Game/Primitives/SegmentStream.cs b/OpenRA.Game/Primitives/SegmentStream.cs index e34c732460..f1bdce4f30 100644 --- a/OpenRA.Game/Primitives/SegmentStream.cs +++ b/OpenRA.Game/Primitives/SegmentStream.cs @@ -48,15 +48,16 @@ namespace OpenRA.Primitives stream.Seek(BaseOffset, SeekOrigin.Begin); } - public override bool CanSeek { get { return true; } } - public override bool CanRead { get { return BaseStream.CanRead; } } - public override bool CanWrite { get { return BaseStream.CanWrite; } } + public override bool CanSeek => true; + public override bool CanRead => BaseStream.CanRead; + public override bool CanWrite => BaseStream.CanWrite; + + public override long Length => BaseCount; - public override long Length { get { return BaseCount; } } public override long Position { - get { return BaseStream.Position - BaseOffset; } - set { BaseStream.Position = BaseOffset + value; } + get => BaseStream.Position - BaseOffset; + set => BaseStream.Position = BaseOffset + value; } public override int ReadByte() @@ -105,18 +106,18 @@ namespace OpenRA.Primitives public override void SetLength(long value) { throw new NotSupportedException(); } - public override bool CanTimeout { get { return BaseStream.CanTimeout; } } + public override bool CanTimeout => BaseStream.CanTimeout; public override int ReadTimeout { - get { return BaseStream.ReadTimeout; } - set { BaseStream.ReadTimeout = value; } + get => BaseStream.ReadTimeout; + set => BaseStream.ReadTimeout = value; } public override int WriteTimeout { - get { return BaseStream.WriteTimeout; } - set { BaseStream.WriteTimeout = value; } + get => BaseStream.WriteTimeout; + set => BaseStream.WriteTimeout = value; } protected override void Dispose(bool disposing) diff --git a/OpenRA.Game/Primitives/Size.cs b/OpenRA.Game/Primitives/Size.cs index ce3431309b..06f05b2b33 100644 --- a/OpenRA.Game/Primitives/Size.cs +++ b/OpenRA.Game/Primitives/Size.cs @@ -44,7 +44,7 @@ namespace OpenRA.Primitives Height = height; } - public bool IsEmpty { get { return Width == 0 && Height == 0; } } + public bool IsEmpty => Width == 0 && Height == 0; public bool Equals(Size other) { diff --git a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs index 410be1e068..5b9e9172eb 100644 --- a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs +++ b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs @@ -135,8 +135,8 @@ namespace OpenRA.Primitives } } - public IEnumerable ItemBounds { get { return itemBounds.Values; } } + public IEnumerable ItemBounds => itemBounds.Values; - public IEnumerable Items { get { return itemBounds.Keys; } } + public IEnumerable Items => itemBounds.Keys; } } diff --git a/OpenRA.Game/Primitives/float2.cs b/OpenRA.Game/Primitives/float2.cs index 4fbee79c1d..bffb3d6c10 100644 --- a/OpenRA.Game/Primitives/float2.cs +++ b/OpenRA.Game/Primitives/float2.cs @@ -93,8 +93,8 @@ namespace OpenRA public static float2 Max(float2 a, float2 b) { return new float2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y)); } public static float2 Min(float2 a, float2 b) { return new float2(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y)); } - public float LengthSquared { get { return X * X + Y * Y; } } - public float Length { get { return (float)Math.Sqrt(LengthSquared); } } + public float LengthSquared => X * X + Y * Y; + public float Length => (float)Math.Sqrt(LengthSquared); } public class EWMA diff --git a/OpenRA.Game/Primitives/float3.cs b/OpenRA.Game/Primitives/float3.cs index 5b87260286..45de826ff5 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 { get { return new float2(X, Y); } } + public float2 XY => new float2(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; } diff --git a/OpenRA.Game/Primitives/int2.cs b/OpenRA.Game/Primitives/int2.cs index afcd937b55..8543ca412f 100644 --- a/OpenRA.Game/Primitives/int2.cs +++ b/OpenRA.Game/Primitives/int2.cs @@ -43,8 +43,8 @@ namespace OpenRA public int2 Sign() { return new int2(Math.Sign(X), Math.Sign(Y)); } public int2 Abs() { return new int2(Math.Abs(X), Math.Abs(Y)); } - public int LengthSquared { get { return X * X + Y * Y; } } - public int Length { get { return Exts.ISqrt(LengthSquared); } } + public int LengthSquared => X * X + Y * Y; + public int Length => Exts.ISqrt(LengthSquared); public int2 WithX(int newX) { diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 8cf837e3bd..1101dc7fb6 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -32,13 +32,7 @@ namespace OpenRA public SpriteRenderer SpriteRenderer { get; private set; } public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; } - public bool WindowHasInputFocus - { - get - { - return Window.HasInputFocus; - } - } + public bool WindowHasInputFocus => Window.HasInputFocus; public IReadOnlyDictionary Fonts; @@ -306,21 +300,18 @@ namespace OpenRA CurrentBatchRenderer = null; } - public Size Resolution { get { return Window.EffectiveWindowSize; } } - public Size NativeResolution { get { return Window.NativeWindowSize; } } - public float WindowScale { get { return Window.EffectiveWindowScale; } } - public float NativeWindowScale { get { return Window.NativeWindowScale; } } - public GLProfile GLProfile { get { return Window.GLProfile; } } - public GLProfile[] SupportedGLProfiles { get { return Window.SupportedGLProfiles; } } + public Size Resolution => Window.EffectiveWindowSize; + public Size NativeResolution => Window.NativeWindowSize; + public float WindowScale => Window.EffectiveWindowScale; + public float NativeWindowScale => Window.NativeWindowScale; + public GLProfile GLProfile => Window.GLProfile; + public GLProfile[] SupportedGLProfiles => Window.SupportedGLProfiles; public interface IBatchRenderer { void Flush(); } public IBatchRenderer CurrentBatchRenderer { - get - { - return currentBatchRenderer; - } + get => currentBatchRenderer; set { @@ -469,24 +460,15 @@ namespace OpenRA return Window.SetClipboardText(text); } - public string GLVersion - { - get { return Context.GLVersion; } - } + public string GLVersion => Context.GLVersion; public IFont CreateFont(byte[] data) { return platform.CreateFont(data); } - public int DisplayCount - { - get { return Window.DisplayCount; } - } + public int DisplayCount => Window.DisplayCount; - public int CurrentDisplay - { - get { return Window.CurrentDisplay; } - } + public int CurrentDisplay => Window.CurrentDisplay; } } diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index c28228591d..bf337587de 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -27,7 +27,7 @@ namespace OpenRA.Server public int MostRecentFrame = 0; public bool Validated; - public long TimeSinceLastResponse { get { return Game.RunTime - lastReceivedTime; } } + public long TimeSinceLastResponse => Game.RunTime - lastReceivedTime; public bool TimeoutMessageShown = false; long lastReceivedTime = 0; diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index c37b434970..1d45a15a84 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -78,8 +78,8 @@ namespace OpenRA.Server public ServerState State { - get { return internalState; } - protected set { internalState = value; } + get => internalState; + protected set => internalState = value; } public static void SyncClientToPlayerReference(Session.Client c, PlayerReference pr) diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 7a4e2aba89..fa79e36883 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -200,7 +200,7 @@ namespace OpenRA Action onMusicComplete; public bool MusicPlaying { get; private set; } - public MusicInfo CurrentMusic { get { return currentMusic; } } + public MusicInfo CurrentMusic => currentMusic; public void PlayMusic(MusicInfo m) { @@ -277,10 +277,7 @@ namespace OpenRA float soundVolumeModifier = 1.0f; public float SoundVolumeModifier { - get - { - return soundVolumeModifier; - } + get => soundVolumeModifier; set { @@ -289,13 +286,11 @@ namespace OpenRA } } - float InternalSoundVolume { get { return SoundVolume * soundVolumeModifier; } } + float InternalSoundVolume => SoundVolume * soundVolumeModifier; + public float SoundVolume { - get - { - return Game.Settings.Sound.SoundVolume; - } + get => Game.Settings.Sound.SoundVolume; set { @@ -306,10 +301,7 @@ namespace OpenRA public float MusicVolume { - get - { - return Game.Settings.Sound.MusicVolume; - } + get => Game.Settings.Sound.MusicVolume; set { @@ -321,10 +313,7 @@ namespace OpenRA public float VideoVolume { - get - { - return Game.Settings.Sound.VideoVolume; - } + get => Game.Settings.Sound.VideoVolume; set { @@ -334,15 +323,9 @@ namespace OpenRA } } - public float MusicSeekPosition - { - get { return music != null ? music.SeekPosition : 0; } - } + public float MusicSeekPosition => music != null ? music.SeekPosition : 0; - public float VideoSeekPosition - { - get { return video != null ? video.SeekPosition : 0; } - } + public float VideoSeekPosition => video != null ? video.SeekPosition : 0; // Returns true if played successfully public bool PlayPredefined(SoundType soundType, Ruleset ruleset, Player p, Actor voicedActor, string type, string definition, string variant, diff --git a/OpenRA.Game/Support/Arguments.cs b/OpenRA.Game/Support/Arguments.cs index cbb776679f..e860d45538 100644 --- a/OpenRA.Game/Support/Arguments.cs +++ b/OpenRA.Game/Support/Arguments.cs @@ -18,7 +18,7 @@ namespace OpenRA { Dictionary args = new Dictionary(); - public static Arguments Empty { get { return new Arguments(); } } + public static Arguments Empty => new Arguments(); public Arguments(params string[] src) { diff --git a/OpenRA.Game/Support/PerfTimer.cs b/OpenRA.Game/Support/PerfTimer.cs index 722f3fe70b..27762c5101 100644 --- a/OpenRA.Game/Support/PerfTimer.cs +++ b/OpenRA.Game/Support/PerfTimer.cs @@ -74,7 +74,7 @@ namespace OpenRA.Support Log.Write("perf", FormatString, ElapsedMs, Indentation + name); } - float ElapsedMs { get { return 1000f * ticks / Stopwatch.Frequency; } } + float ElapsedMs => 1000f * ticks / Stopwatch.Frequency; public static void LogLongTick(long startStopwatchTicks, long endStopwatchTicks, string name, object item) { @@ -85,13 +85,7 @@ namespace OpenRA.Support "[" + Game.LocalTick + "] " + name + ": " + label); } - public static long LongTickThresholdInStopwatchTicks - { - get - { - return (long)(Stopwatch.Frequency * Game.Settings.Debug.LongTickThresholdMs / 1000f); - } - } + public static long LongTickThresholdInStopwatchTicks => (long)(Stopwatch.Frequency * Game.Settings.Debug.LongTickThresholdMs / 1000f); #region Formatting helpers static string GetHeader(string indentation, string label) diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index 9224a59213..1b1c085336 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -24,7 +24,7 @@ namespace OpenRA.Support public readonly string Expression; readonly HashSet variables = new HashSet(); - public IEnumerable Variables { get { return variables; } } + public IEnumerable Variables => variables; enum CharClass { Whitespace, Operator, Mixed, Id, Digit } @@ -323,16 +323,16 @@ namespace OpenRA.Support public readonly TokenType Type; public readonly int Index; - public virtual string Symbol { get { return TokenTypeInfos[(int)Type].Symbol; } } + public virtual string Symbol => TokenTypeInfos[(int)Type].Symbol; - public int Precedence { get { return (int)TokenTypeInfos[(int)Type].Precedence; } } - public Sides OperandSides { get { return TokenTypeInfos[(int)Type].OperandSides; } } - public Associativity Associativity { get { return TokenTypeInfos[(int)Type].Associativity; } } - public bool LeftOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Left) != 0; } } - public bool RightOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Right) != 0; } } + public int Precedence => (int)TokenTypeInfos[(int)Type].Precedence; + public Sides OperandSides => TokenTypeInfos[(int)Type].OperandSides; + public Associativity Associativity => TokenTypeInfos[(int)Type].Associativity; + public bool LeftOperand => ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Left) != 0; + public bool RightOperand => ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Right) != 0; - public Grouping Opens { get { return TokenTypeInfos[(int)Type].Opens; } } - public Grouping Closes { get { return TokenTypeInfos[(int)Type].Closes; } } + public Grouping Opens => TokenTypeInfos[(int)Type].Opens; + public Grouping Closes => TokenTypeInfos[(int)Type].Closes; public Token(TokenType type, int index) { @@ -559,7 +559,7 @@ namespace OpenRA.Support { public readonly string Name; - public override string Symbol { get { return Name; } } + public override string Symbol => Name; public VariableToken(int index, string symbol) : base(TokenType.Variable, index) { Name = symbol; } @@ -570,7 +570,7 @@ namespace OpenRA.Support public readonly int Value; readonly string symbol; - public override string Symbol { get { return symbol; } } + public override string Symbol => symbol; public NumberToken(int index, string symbol) : base(TokenType.Number, index) diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index 4d91bba30d..5df5bb91cf 100644 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -208,8 +208,8 @@ namespace OpenRA public void Reset() { index = actors.BinarySearchMany(actor) - 1; } public bool MoveNext() { return ++index < actors.Count && actors[index].ActorID == actor; } - public T Current { get { return traits[index]; } } - object System.Collections.IEnumerator.Current { get { return Current; } } + public T Current => traits[index]; + object System.Collections.IEnumerator.Current => Current; public void Dispose() { } } @@ -272,8 +272,8 @@ namespace OpenRA public void Reset() { index = -1; } public bool MoveNext() { return ++index < actors.Count; } - public TraitPair Current { get { return new TraitPair(actors[index], traits[index]); } } - object System.Collections.IEnumerator.Current { get { return Current; } } + public TraitPair Current => new TraitPair(actors[index], traits[index]); + object System.Collections.IEnumerator.Current => Current; public void Dispose() { } } diff --git a/OpenRA.Game/Traits/DebugPauseState.cs b/OpenRA.Game/Traits/DebugPauseState.cs index 98c2d1553c..c298fef6ad 100644 --- a/OpenRA.Game/Traits/DebugPauseState.cs +++ b/OpenRA.Game/Traits/DebugPauseState.cs @@ -21,7 +21,8 @@ namespace OpenRA.Traits { readonly World world; [Sync] - public bool Paused { get { return world.Paused; } } + public bool Paused => world.Paused; + public DebugPauseState(World world) { this.world = world; } } } diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index ba1fac9c5f..f9cb270e7b 100644 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -43,7 +43,7 @@ namespace OpenRA.Traits public Player Owner { get; private set; } public BitSet TargetTypes { get; private set; } - public IEnumerable TargetablePositions { get { return targetablePositions; } } + public IEnumerable TargetablePositions => targetablePositions; public ITooltipInfo TooltipInfo { get; private set; } public Player TooltipOwner { get; private set; } @@ -108,11 +108,11 @@ namespace OpenRA.Traits UpdateVisibility(); } - public uint ID { get { return actor.ActorID; } } - public bool IsValid { get { return Owner != null; } } - public ActorInfo Info { get { return actor.Info; } } - public Actor Actor { get { return !actor.IsDead ? actor : null; } } - public Player Viewer { get { return viewer; } } + public uint ID => actor.ActorID; + public bool IsValid => Owner != null; + public ActorInfo Info => actor.Info; + public Actor Actor => !actor.IsDead ? actor : null; + public Player Viewer => viewer; public void RefreshState() { @@ -198,7 +198,7 @@ namespace OpenRA.Traits return Renderables; } - public bool HasRenderables { get { return !Shrouded && Renderables.Any(); } } + public bool HasRenderables => !Shrouded && Renderables.Any(); public override string ToString() { diff --git a/OpenRA.Game/Traits/Player/Shroud.cs b/OpenRA.Game/Traits/Player/Shroud.cs index 8946514811..7bc90c8d2d 100644 --- a/OpenRA.Game/Traits/Player/Shroud.cs +++ b/OpenRA.Game/Traits/Player/Shroud.cs @@ -104,10 +104,7 @@ namespace OpenRA.Traits bool disabled; public bool Disabled { - get - { - return disabled; - } + get => disabled; set { @@ -119,7 +116,7 @@ namespace OpenRA.Traits } bool fogEnabled; - public bool FogEnabled { get { return !Disabled && fogEnabled; } } + public bool FogEnabled => !Disabled && fogEnabled; public bool ExploreMapEnabled { get; private set; } public int Hash { get; private set; } diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs index 7ae0cb05b1..5ad42ef806 100644 --- a/OpenRA.Game/Traits/Target.cs +++ b/OpenRA.Game/Traits/Target.cs @@ -88,8 +88,8 @@ namespace OpenRA.Traits public static Target FromActor(Actor a) { return a != null ? new Target(a) : Invalid; } public static Target FromFrozenActor(FrozenActor fa) { return new Target(fa); } - public Actor Actor { get { return actor; } } - public FrozenActor FrozenActor { get { return frozen; } } + public Actor Actor => actor; + public FrozenActor FrozenActor => frozen; public TargetType Type { @@ -225,10 +225,10 @@ namespace OpenRA.Traits } // Expose internal state for serialization by the orders code *only* - internal TargetType SerializableType { get { return type; } } - internal Actor SerializableActor { get { return actor; } } - internal CPos? SerializableCell { get { return cell; } } - internal SubCell? SerializableSubCell { get { return subCell; } } - internal WPos SerializablePos { get { return terrainCenterPosition; } } + internal TargetType SerializableType => type; + internal Actor SerializableActor => actor; + internal CPos? SerializableCell => cell; + internal SubCell? SerializableSubCell => subCell; + internal WPos SerializablePos => terrainCenterPosition; } } diff --git a/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs b/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs index 0b4e4a29ce..034475ee0b 100644 --- a/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs +++ b/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs @@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands { class ClearInvalidModRegistrationsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--clear-invalid-mod-registrations"; } } + string IUtilityCommand.Name => "--clear-invalid-mod-registrations"; + bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]); diff --git a/OpenRA.Game/UtilityCommands/RegisterModCommand.cs b/OpenRA.Game/UtilityCommands/RegisterModCommand.cs index 0b96c11483..7cc9adf529 100644 --- a/OpenRA.Game/UtilityCommands/RegisterModCommand.cs +++ b/OpenRA.Game/UtilityCommands/RegisterModCommand.cs @@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands { class RegisterModCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--register-mod"; } } + string IUtilityCommand.Name => "--register-mod"; + bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 3 && new string[] { "system", "user", "both" }.Contains(args[2]); diff --git a/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs b/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs index 4cab763a77..d858200c32 100644 --- a/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs +++ b/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs @@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands { class UnregisterModCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--unregister-mod"; } } + string IUtilityCommand.Name => "--unregister-mod"; + bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]); diff --git a/OpenRA.Game/WAngle.cs b/OpenRA.Game/WAngle.cs index d38e91d86c..1ba06268b9 100644 --- a/OpenRA.Game/WAngle.cs +++ b/OpenRA.Game/WAngle.cs @@ -22,7 +22,7 @@ namespace OpenRA public struct WAngle : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, IEquatable { public readonly int Angle; - public int AngleSquared { get { return (int)Angle * Angle; } } + public int AngleSquared => (int)Angle * Angle; public WAngle(int a) { @@ -46,7 +46,7 @@ namespace OpenRA public bool Equals(WAngle other) { return other == this; } public override bool Equals(object obj) { return obj is WAngle && Equals((WAngle)obj); } - public int Facing { get { return Angle / 4; } } + public int Facing => Angle / 4; public int Sin() { return new WAngle(Angle - 256).Cos(); } diff --git a/OpenRA.Game/WDist.cs b/OpenRA.Game/WDist.cs index d19218be05..b14c01cac6 100644 --- a/OpenRA.Game/WDist.cs +++ b/OpenRA.Game/WDist.cs @@ -24,7 +24,7 @@ namespace OpenRA public struct WDist : IComparable, IComparable, IEquatable, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding { public readonly int Length; - public long LengthSquared { get { return (long)Length * Length; } } + public long LengthSquared => (long)Length * Length; public WDist(int r) { Length = r; } public static readonly WDist Zero = new WDist(0); @@ -148,10 +148,7 @@ namespace OpenRA } } - set - { - throw new LuaException("WDist is read-only. Use WDist.New to create a new value"); - } + set => throw new LuaException("WDist is read-only. Use WDist.New to create a new value"); } #endregion } diff --git a/OpenRA.Game/WPos.cs b/OpenRA.Game/WPos.cs index d879a9d938..3beb20ef41 100644 --- a/OpenRA.Game/WPos.cs +++ b/OpenRA.Game/WPos.cs @@ -129,10 +129,7 @@ namespace OpenRA } } - set - { - throw new LuaException("WPos is read-only. Use WPos.New to create a new value"); - } + set => throw new LuaException("WPos is read-only. Use WPos.New to create a new value"); } #endregion diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs index 82269111ca..cee6271692 100644 --- a/OpenRA.Game/WVec.cs +++ b/OpenRA.Game/WVec.cs @@ -37,12 +37,12 @@ namespace OpenRA public static bool operator !=(WVec me, WVec other) { return !(me == other); } public static int Dot(WVec a, WVec b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; } - public long LengthSquared { get { return (long)X * X + (long)Y * Y + (long)Z * Z; } } - public int Length { get { return (int)Exts.ISqrt(LengthSquared); } } - public long HorizontalLengthSquared { get { return (long)X * X + (long)Y * Y; } } - public int HorizontalLength { get { return (int)Exts.ISqrt(HorizontalLengthSquared); } } - public long VerticalLengthSquared { get { return (long)Z * Z; } } - public int VerticalLength { get { return (int)Exts.ISqrt(VerticalLengthSquared); } } + public long LengthSquared => (long)X * X + (long)Y * Y + (long)Z * Z; + public int Length => (int)Exts.ISqrt(LengthSquared); + public long HorizontalLengthSquared => (long)X * X + (long)Y * Y; + public int HorizontalLength => (int)Exts.ISqrt(HorizontalLengthSquared); + public long VerticalLengthSquared => (long)Z * Z; + public int VerticalLength => (int)Exts.ISqrt(VerticalLengthSquared); public WVec Rotate(in WRot rot) { @@ -151,10 +151,7 @@ namespace OpenRA } } - set - { - throw new LuaException("WVec is read-only. Use WVec.New to create a new value"); - } + set => throw new LuaException("WVec is read-only. Use WVec.New to create a new value"); } #endregion diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 1fc210b002..e32c114a9a 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -224,7 +224,7 @@ namespace OpenRA.Widgets } } - public virtual int2 ChildOrigin { get { return RenderOrigin; } } + public virtual int2 ChildOrigin => RenderOrigin; public virtual Rectangle RenderBounds { @@ -279,7 +279,7 @@ namespace OpenRA.Widgets args.Remove("widget"); } - public virtual Rectangle EventBounds { get { return RenderBounds; } } + public virtual Rectangle EventBounds => RenderBounds; public virtual bool EventBoundsContains(int2 location) { @@ -295,8 +295,8 @@ namespace OpenRA.Widgets return false; } - public bool HasMouseFocus { get { return Ui.MouseFocusWidget == this; } } - public bool HasKeyboardFocus { get { return Ui.KeyboardFocusWidget == this; } } + public bool HasMouseFocus => Ui.MouseFocusWidget == this; + public bool HasKeyboardFocus => Ui.KeyboardFocusWidget == this; public virtual bool TakeMouseFocus(MouseInput mi) { diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 2001bf0df2..e0bae82628 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -39,7 +39,7 @@ namespace OpenRA public int Timestep; internal readonly OrderManager OrderManager; - public Session LobbyInfo { get { return OrderManager.LobbyInfo; } } + public Session LobbyInfo => OrderManager.LobbyInfo; public readonly MersenneTwister SharedRandom; public readonly MersenneTwister LocalRandom; @@ -79,10 +79,7 @@ namespace OpenRA Player renderPlayer; public Player RenderPlayer { - get - { - return renderPlayer; - } + get => renderPlayer; set { @@ -103,20 +100,11 @@ namespace OpenRA public bool ShroudObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(pos); } public bool ShroudObscures(PPos uv) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(uv); } - public bool IsReplay - { - get { return OrderManager.Connection is ReplayConnection; } - } + public bool IsReplay => OrderManager.Connection is ReplayConnection; - public bool IsLoadingGameSave - { - get { return OrderManager.NetFrameNumber <= OrderManager.GameSaveLastFrame; } - } + public bool IsLoadingGameSave => OrderManager.NetFrameNumber <= OrderManager.GameSaveLastFrame; - public int GameSaveLoadingPercentage - { - get { return OrderManager.NetFrameNumber * 100 / OrderManager.GameSaveLastFrame; } - } + public int GameSaveLoadingPercentage => OrderManager.NetFrameNumber * 100 / OrderManager.GameSaveLastFrame; void SetLocalPlayer(Player localPlayer) { @@ -153,10 +141,7 @@ namespace OpenRA IOrderGenerator orderGenerator; public IOrderGenerator OrderGenerator { - get - { - return orderGenerator; - } + get => orderGenerator; set { @@ -452,10 +437,10 @@ namespace OpenRA ScreenMap.TickRender(); } - public IEnumerable Actors { get { return actors.Values; } } - public IEnumerable Effects { get { return effects; } } - public IEnumerable UnpartitionedEffects { get { return unpartitionedEffects; } } - public IEnumerable SyncedEffects { get { return syncedEffects; } } + public IEnumerable Actors => actors.Values; + public IEnumerable Effects => effects; + public IEnumerable UnpartitionedEffects => unpartitionedEffects; + public IEnumerable SyncedEffects => syncedEffects; public Actor GetActorById(uint actorId) { diff --git a/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs b/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs index 5d652df4ce..662845daa6 100644 --- a/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs +++ b/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs @@ -49,10 +49,10 @@ namespace OpenRA.Mods.Cnc.AudioLoaders public sealed class AudFormat : ISoundFormat { - public int Channels { get { return channels; } } - public int SampleBits { get { return sampleBits; } } - public int SampleRate { get { return sampleRate; } } - public float LengthInSeconds { get { return AudReader.SoundLength(sourceStream); } } + public int Channels => channels; + public int SampleBits => sampleBits; + public int SampleRate => sampleRate; + public float LengthInSeconds => AudReader.SoundLength(sourceStream); public Stream GetPCMInputStream() { return audStreamFactory(); } public void Dispose() { sourceStream.Dispose(); } diff --git a/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs b/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs index ba64eb9a9e..93101ba7e4 100644 --- a/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs +++ b/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs @@ -38,10 +38,10 @@ namespace OpenRA.Mods.Cnc.AudioLoaders public sealed class VocFormat : ISoundFormat { - public int SampleBits { get { return 8; } } - public int Channels { get { return 1; } } + public int SampleBits => 8; + public int Channels => 1; public int SampleRate { get; private set; } - public float LengthInSeconds { get { return (float)totalSamples / SampleRate; } } + public float LengthInSeconds => (float)totalSamples / SampleRate; public Stream GetPCMInputStream() { return new VocStream(new VocFormat(this)); } public void Dispose() { stream.Dispose(); } @@ -289,7 +289,7 @@ namespace OpenRA.Mods.Cnc.AudioLoaders currentBlockEnded = true; } - bool EndOfData { get { return currentBlockEnded && samplesLeftInBlock == 0; } } + bool EndOfData => currentBlockEnded && samplesLeftInBlock == 0; int FillBuffer(int maxSamples) { @@ -358,15 +358,16 @@ namespace OpenRA.Mods.Cnc.AudioLoaders this.format = format; } - public override bool CanRead { get { return format.samplePosition < format.totalSamples; } } - public override bool CanSeek { get { return false; } } - public override bool CanWrite { get { return false; } } + public override bool CanRead => format.samplePosition < format.totalSamples; + public override bool CanSeek => false; + public override bool CanWrite => false; + + public override long Length => format.totalSamples; - public override long Length { get { return format.totalSamples; } } public override long Position { - get { return format.samplePosition; } - set { throw new NotImplementedException(); } + get => format.samplePosition; + set => throw new NotImplementedException(); } public override int Read(byte[] buffer, int offset, int count) diff --git a/OpenRA.Mods.Cnc/FileFormats/AudReader.cs b/OpenRA.Mods.Cnc/FileFormats/AudReader.cs index 0a77c9f885..eaa0c3a158 100644 --- a/OpenRA.Mods.Cnc/FileFormats/AudReader.cs +++ b/OpenRA.Mods.Cnc/FileFormats/AudReader.cs @@ -101,10 +101,7 @@ namespace OpenRA.Mods.Cnc.FileFormats this.dataSize = dataSize; } - public override long Length - { - get { return outputSize; } - } + public override long Length => outputSize; protected override bool BufferData(Stream baseStream, Queue data) { diff --git a/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs b/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs index dfbfa81883..896fdec9cc 100644 --- a/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs +++ b/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs @@ -18,10 +18,10 @@ namespace OpenRA.Mods.Cnc.FileFormats { public class VqaReader : IVideo { - public ushort Frames { get { return frames; } } - public byte Framerate { get { return framerate; } } - public ushort Width { get { return width; } } - public ushort Height { get { return height; } } + public ushort Frames => frames; + public byte Framerate => framerate; + public ushort Width => width; + public ushort Height => height; readonly ushort frames; readonly byte framerate; @@ -65,12 +65,12 @@ namespace OpenRA.Mods.Cnc.FileFormats byte[] audioData; // audio for this frame: 22050Hz 16bit mono pcm, uncompressed. bool hasAudio; - public byte[] AudioData { get { return audioData; } } - public int CurrentFrame { get { return currentFrame; } } - public int SampleRate { get { return sampleRate; } } - public int SampleBits { get { return sampleBits; } } - public int AudioChannels { get { return audioChannels; } } - public bool HasAudio { get { return hasAudio; } } + public byte[] AudioData => audioData; + public int CurrentFrame => currentFrame; + public int SampleRate => sampleRate; + public int SampleBits => sampleBits; + public int AudioChannels => audioChannels; + public bool HasAudio => hasAudio; public VqaReader(Stream stream) { @@ -513,7 +513,7 @@ namespace OpenRA.Mods.Cnc.FileFormats } } - bool IsHqVqa { get { return (videoFlags & 0x10) == 16; } } + bool IsHqVqa => (videoFlags & 0x10) == 16; void WriteBlock(int blockNumber, int count, ref int x, ref int y) { diff --git a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs index a8f5ad22bc..5caef1b213 100644 --- a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.FileSystem sealed class BigFile : IReadOnlyPackage { public string Name { get; private set; } - public IEnumerable Contents { get { return index.Keys; } } + public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); readonly Stream s; diff --git a/OpenRA.Mods.Cnc/FileSystem/MixFile.cs b/OpenRA.Mods.Cnc/FileSystem/MixFile.cs index 884e8771e6..766e95ff00 100644 --- a/OpenRA.Mods.Cnc/FileSystem/MixFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/MixFile.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.FileSystem public sealed class MixFile : IReadOnlyPackage { public string Name { get; private set; } - public IEnumerable Contents { get { return index.Keys; } } + public IEnumerable Contents => index.Keys; readonly Dictionary index; readonly long dataStart; diff --git a/OpenRA.Mods.Cnc/FileSystem/Pak.cs b/OpenRA.Mods.Cnc/FileSystem/Pak.cs index 48ac89351c..5093a92014 100644 --- a/OpenRA.Mods.Cnc/FileSystem/Pak.cs +++ b/OpenRA.Mods.Cnc/FileSystem/Pak.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.FileSystem sealed class PakFile : IReadOnlyPackage { public string Name { get; private set; } - public IEnumerable Contents { get { return index.Keys; } } + public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); readonly Stream stream; diff --git a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs index 69d69d234b..498ab09170 100644 --- a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs +++ b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs @@ -61,10 +61,10 @@ namespace OpenRA.Mods.Cnc.Graphics cache = new IFinalizedRenderable[] { }; } - public WPos Pos { get { return pos; } } - public PaletteReference Palette { get { return null; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => pos; + public PaletteReference Palette => null; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IPalettedRenderable WithPalette(PaletteReference newPalette) { diff --git a/OpenRA.Mods.Cnc/Graphics/Voxel.cs b/OpenRA.Mods.Cnc/Graphics/Voxel.cs index f90d1f3bc2..f09e274210 100644 --- a/OpenRA.Mods.Cnc/Graphics/Voxel.cs +++ b/OpenRA.Mods.Cnc/Graphics/Voxel.cs @@ -32,8 +32,8 @@ namespace OpenRA.Mods.Cnc.Graphics readonly uint frames; readonly uint limbs; - uint IModel.Frames { get { return frames; } } - uint IModel.Sections { get { return limbs; } } + uint IModel.Frames => frames; + uint IModel.Sections => limbs; public Voxel(VoxelLoader loader, VxlReader vxl, HvaReader hva, (string Vxl, string Hva) files) { diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs index d46b1b544a..1283b666d9 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs @@ -114,7 +114,7 @@ namespace OpenRA.Mods.Cnc.Graphics return models[model].ContainsKey(sequence); } - public IVertexBuffer VertexBuffer { get { return loader.VertexBuffer; } } + public IVertexBuffer VertexBuffer => loader.VertexBuffer; public void Dispose() { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs index 2506ba6797..ccc72231ef 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs @@ -30,12 +30,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class ShpD2Frame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } - public Size FrameSize { get { return Size; } } - public float2 Offset { get { return float2.Zero; } } + public Size FrameSize => Size; + public float2 Offset => float2.Zero; public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public ShpD2Frame(Stream s) { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs index ab246d0020..d2ea0c47ca 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs @@ -77,12 +77,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class ImageHeader : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } - public Size Size { get { return reader.Size; } } - public Size FrameSize { get { return reader.Size; } } - public float2 Offset { get { return float2.Zero; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; + public Size Size => reader.Size; + public Size FrameSize => reader.Size; + public float2 Offset => float2.Zero; public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public uint FileOffset; public Format Format; diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs index 76b121a874..a00fde50fd 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs @@ -19,12 +19,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders { class TmpRAFrame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } public Size FrameSize { get; private set; } - public float2 Offset { get { return float2.Zero; } } + public float2 Offset => float2.Zero; public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public TmpRAFrame(byte[] data, Size size) { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs index 97b69b5251..f520923052 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs @@ -19,12 +19,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders { class TmpTDFrame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } public Size FrameSize { get; private set; } - public float2 Offset { get { return float2.Zero; } } + public float2 Offset => float2.Zero; public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public TmpTDFrame(byte[] data, Size size) { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs index 7569fccfff..c7a80ea3e3 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs @@ -21,12 +21,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders { readonly TmpTSFrame parent; - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } - public Size Size { get { return parent.Size; } } - public Size FrameSize { get { return Size; } } - public float2 Offset { get { return parent.Offset; } } - public byte[] Data { get { return parent.DepthData; } } - public bool DisableExportPadding { get { return false; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; + public Size Size => parent.Size; + public Size FrameSize => Size; + public float2 Offset => parent.Offset; + public byte[] Data => parent.DepthData; + public bool DisableExportPadding => false; public TmpTSDepthFrame(TmpTSFrame parent) { @@ -36,13 +36,13 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class TmpTSFrame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } - public Size FrameSize { get { return Size; } } + public Size FrameSize => Size; public float2 Offset { get; private set; } public byte[] Data { get; set; } public byte[] DepthData { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public TmpTSFrame(Stream s, Size size, int u, int v) { diff --git a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs index 1dfb40ad4a..c35214aa95 100644 --- a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs +++ b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs @@ -162,7 +162,7 @@ namespace OpenRA.Mods.Cnc.Traits } Color ISelectionBar.GetColor() { return Info.TimeBarColor; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; void ModifyActorInit(TypeDictionary init) { diff --git a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs index 8e5e432886..809db155ef 100644 --- a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs +++ b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs @@ -254,6 +254,6 @@ namespace OpenRA.Mods.Cnc.Traits } Color ISelectionBar.GetColor() { return info.TimeBarColor; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Cnc/Traits/Disguise.cs b/OpenRA.Mods.Cnc/Traits/Disguise.cs index 481849c405..d83dc8545c 100644 --- a/OpenRA.Mods.Cnc/Traits/Disguise.cs +++ b/OpenRA.Mods.Cnc/Traits/Disguise.cs @@ -37,13 +37,7 @@ namespace OpenRA.Mods.Cnc.Traits disguise = self.Trait(); } - public ITooltipInfo TooltipInfo - { - get - { - return disguise.Disguised ? disguise.AsTooltipInfo : Info; - } - } + public ITooltipInfo TooltipInfo => disguise.Disguised ? disguise.AsTooltipInfo : Info; public Player Owner { @@ -98,7 +92,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string Cursor = "ability"; [GrantedConditionReference] - public IEnumerable LinterConditions { get { return DisguisedAsConditions.Values; } } + public IEnumerable LinterConditions => DisguisedAsConditions.Values; public override object Create(ActorInitializer init) { return new Disguise(init.Self, this); } } @@ -110,8 +104,8 @@ namespace OpenRA.Mods.Cnc.Traits public Player AsPlayer { get; private set; } public ITooltipInfo AsTooltipInfo { get; private set; } - public bool Disguised { get { return AsPlayer != null; } } - public Player Owner { get { return AsPlayer; } } + public bool Disguised => AsPlayer != null; + public Player Owner => AsPlayer; readonly Actor self; readonly DisguiseInfo info; diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index fe1fc0f2e4..673ff77da5 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -337,8 +337,8 @@ namespace OpenRA.Mods.Cnc.Traits class BeginMinefieldOrderTargeter : IOrderTargeter { - public string OrderID { get { return "BeginMinefield"; } } - public int OrderPriority { get { return 5; } } + public string OrderID => "BeginMinefield"; + public int OrderPriority => 5; public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs index 3e276e018d..0b700e471f 100644 --- a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs +++ b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs @@ -149,10 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits chargeTick = Info.ChargeDelay; } - public bool CanTeleport - { - get { return chargeTick <= 0; } - } + public bool CanTeleport => chargeTick <= 0; float ISelectionBar.GetValue() { @@ -160,7 +157,7 @@ namespace OpenRA.Mods.Cnc.Traits } Color ISelectionBar.GetColor() { return Color.Magenta; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } class PortableChronoOrderTargeter : IOrderTargeter @@ -172,8 +169,8 @@ namespace OpenRA.Mods.Cnc.Traits this.targetCursor = targetCursor; } - public string OrderID { get { return "PortableChronoTeleport"; } } - public int OrderPriority { get { return 5; } } + public string OrderID => "PortableChronoTeleport"; + public int OrderPriority => 5; public bool IsQueued { get; protected set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index fdab93dbb8..a788076fa3 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Traits return new ReadOnlyDictionary(occupied); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; // Used to determine if actor can spawn public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) @@ -70,19 +70,19 @@ namespace OpenRA.Mods.Cnc.Traits [Sync] public WAngle Facing { - get { return orientation.Yaw; } - set { orientation = orientation.WithYaw(value); } + get => orientation.Yaw; + set => orientation = orientation.WithYaw(value); } - public WRot Orientation { get { return orientation; } } + public WRot Orientation => orientation; [Sync] public WPos CenterPosition { get; private set; } - public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } } + public CPos TopLeft => self.World.Map.CellContaining(CenterPosition); // Isn't used anyway - public WAngle TurnSpeed { get { return WAngle.Zero; } } + public WAngle TurnSpeed => WAngle.Zero; CPos cachedLocation; @@ -142,10 +142,7 @@ namespace OpenRA.Mods.Cnc.Traits Facing = Facing == Left ? Right : Left; } - int MovementSpeed - { - get { return OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); } - } + int MovementSpeed => OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); public (CPos, SubCell)[] OccupiedCells() { return new[] { (TopLeft, SubCell.FullCell) }; } @@ -223,7 +220,7 @@ namespace OpenRA.Mods.Cnc.Traits public CPos NearestMoveableCell(CPos cell) { return cell; } // Actors with TDGunboat always move - public MovementType CurrentMovementTypes { get { return MovementType.Horizontal; } set { } } + public MovementType CurrentMovementTypes { get => MovementType.Horizontal; set { } } public bool CanEnterTargetNow(Actor self, in Target target) { diff --git a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs index 4aaed5c566..9fcebd8316 100644 --- a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs +++ b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs @@ -58,6 +58,6 @@ namespace OpenRA.Mods.Cnc.Traits this.remaining = remaining; } - string IConditionTimerWatcher.Condition { get { return info.Condition; } } + string IConditionTimerWatcher.Condition => info.Condition; } } diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs index 7430cd45e4..bc37f983ed 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { class ConvertPngToShpCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--shp"; } } + string IUtilityCommand.Name => "--shp"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs index 0e3a895435..ac223e0588 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands public ImportRedAlertLegacyMapCommand() : base(128) { } - string IUtilityCommand.Name { get { return "--import-ra-map"; } } + string IUtilityCommand.Name => "--import-ra-map"; bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); } [Desc("FILENAME", "Convert a legacy Red Alert INI/MPR map to the OpenRA format.")] diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs index 4eea50fb53..3990044d2a 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { class ImportTSMapCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--import-ts-map"; } } + string IUtilityCommand.Name => "--import-ts-map"; bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2; } static readonly Dictionary OverlayToActor = new Dictionary() diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs index d19c783d43..0ec64a0784 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands public ImportTiberianDawnLegacyMapCommand() : base(64) { } - string IUtilityCommand.Name { get { return "--import-td-map"; } } + string IUtilityCommand.Name => "--import-td-map"; bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); } [Desc("FILENAME", "Convert a legacy Tiberian Dawn INI/MPR map to the OpenRA format.")] diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs index f1dfec1aa8..2f61073288 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands return args.Length >= 3; } - string IUtilityCommand.Name { get { return "--rules-import"; } } + string IUtilityCommand.Name => "--rules-import"; IniFile rulesIni; IniFile artIni; diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs index f79298c736..070ca15d33 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands return args.Length >= 2; } - string IUtilityCommand.Name { get { return "--sequence-import"; } } + string IUtilityCommand.Name => "--sequence-import"; IniFile file; MapGrid grid; diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs index 3ba6bfcdaa..cb2fec03c7 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { class ImportLegacyTilesetCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--tileset-import"; } } + string IUtilityCommand.Name => "--tileset-import"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs index 888b20345a..5a6bfd5ce5 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { class ListMixContents : IUtilityCommand { - string IUtilityCommand.Name { get { return "--list-mix"; } } + string IUtilityCommand.Name => "--list-mix"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs index ac44e8c025..c219e83177 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands { class RemapShpCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--remap"; } } + string IUtilityCommand.Name => "--remap"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs index 286d98dd45..70df3029b9 100644 --- a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs +++ b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs @@ -28,13 +28,7 @@ namespace OpenRA.Mods.Common.Activities readonly DomainIndex domainIndex; readonly Color? targetLineColor; - protected Target Target - { - get - { - return useLastVisibleTarget ? lastVisibleTarget : target; - } - } + protected Target Target => useLastVisibleTarget ? lastVisibleTarget : target; Target target; Target lastVisibleTarget; diff --git a/OpenRA.Mods.Common/ActorInitializer.cs b/OpenRA.Mods.Common/ActorInitializer.cs index 03290c9dc3..06ffbfc345 100644 --- a/OpenRA.Mods.Common/ActorInitializer.cs +++ b/OpenRA.Mods.Common/ActorInitializer.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common this.value = (int)value; } - public virtual SubCell Value { get { return (SubCell)value; } } + public virtual SubCell Value => (SubCell)value; public void Initialize(MiniYaml yaml) { diff --git a/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs b/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs index a5f93c4a29..902367619f 100644 --- a/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs +++ b/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs @@ -50,10 +50,10 @@ namespace OpenRA.Mods.Common.AudioLoaders public sealed class WavFormat : ISoundFormat { - public int Channels { get { return channels; } } - public int SampleBits { get { return sampleBits; } } - public int SampleRate { get { return sampleRate; } } - public float LengthInSeconds { get { return WavReader.WaveLength(sourceStream); } } + public int Channels => channels; + public int SampleBits => sampleBits; + public int SampleRate => sampleRate; + public float LengthInSeconds => WavReader.WaveLength(sourceStream); public Stream GetPCMInputStream() { return wavStreamFactory(); } public void Dispose() { sourceStream.Dispose(); } diff --git a/OpenRA.Mods.Common/FileFormats/IniFile.cs b/OpenRA.Mods.Common/FileFormats/IniFile.cs index 063e92240b..6cf500801e 100644 --- a/OpenRA.Mods.Common/FileFormats/IniFile.cs +++ b/OpenRA.Mods.Common/FileFormats/IniFile.cs @@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.FileFormats throw new InvalidOperationException("Section does not exist in map or rules: " + s); } - public IEnumerable Sections { get { return sections.Values; } } + public IEnumerable Sections => sections.Values; } public class IniSection : IEnumerable> diff --git a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs index f679f9eb23..a9576fabf8 100644 --- a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs +++ b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.FileSystem } public string Name { get; private set; } - public IEnumerable Contents { get { return index.Keys; } } + public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); readonly Stream s; @@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.FileSystem return index.ContainsKey(filename); } - public IReadOnlyDictionary Index { get { return new ReadOnlyDictionary(index); } } + public IReadOnlyDictionary Index => new ReadOnlyDictionary(index); public void Dispose() { diff --git a/OpenRA.Mods.Common/Graphics/ActorPreview.cs b/OpenRA.Mods.Common/Graphics/ActorPreview.cs index d12fc85e21..b370dbf70a 100644 --- a/OpenRA.Mods.Common/Graphics/ActorPreview.cs +++ b/OpenRA.Mods.Common/Graphics/ActorPreview.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics { public readonly ActorInfo Actor; public readonly WorldRenderer WorldRenderer; - public World World { get { return WorldRenderer.World; } } + public World World => WorldRenderer.World; readonly ActorReference reference; diff --git a/OpenRA.Mods.Common/Graphics/BeamRenderable.cs b/OpenRA.Mods.Common/Graphics/BeamRenderable.cs index 994d995a90..96e5a02a97 100644 --- a/OpenRA.Mods.Common/Graphics/BeamRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/BeamRenderable.cs @@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics this.color = color; } - public WPos Pos { get { return pos; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => pos; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, shape, width, color); } public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); } diff --git a/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs index 92a8919cae..c32c638d62 100644 --- a/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs @@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics this.filled = filled; } - public WPos Pos { get { return centerPosition; } } - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => centerPosition; + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new CircleAnnotationRenderable(centerPosition, radius, width, color, filled); } public IRenderable OffsetBy(WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); } diff --git a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs index 939fe3c961..c4b2e2ba8c 100644 --- a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Graphics { public class ContrailRenderable : IRenderable, IFinalizedRenderable { - public int Length { get { return trail.Length; } } + public int Length => trail.Length; readonly World world; readonly Color color; @@ -45,9 +45,9 @@ namespace OpenRA.Mods.Common.Graphics this.zOffset = zOffset; } - public WPos Pos { get { return trail[Index(next - 1)]; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => trail[Index(next - 1)]; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, (WPos[])trail.Clone(), width, next, length, skip, color, newOffset); } public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), width, next, length, skip, color, zOffset); } diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 11afc336e4..3c51be8132 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -99,21 +99,21 @@ namespace OpenRA.Mods.Common.Graphics this.exception = exception; } - public string Filename { get { return exception.FileName; } } + public string Filename => exception.FileName; - string ISpriteSequence.Name { get { throw exception; } } - int ISpriteSequence.Start { get { throw exception; } } - int ISpriteSequence.Length { get { throw exception; } } - int ISpriteSequence.Stride { get { throw exception; } } - int ISpriteSequence.Facings { get { throw exception; } } - int ISpriteSequence.Tick { get { throw exception; } } - int ISpriteSequence.ZOffset { get { throw exception; } } - int ISpriteSequence.ShadowStart { get { throw exception; } } - int ISpriteSequence.ShadowZOffset { get { throw exception; } } - int[] ISpriteSequence.Frames { get { throw exception; } } - Rectangle ISpriteSequence.Bounds { get { throw exception; } } - bool ISpriteSequence.IgnoreWorldTint { get { throw exception; } } - float ISpriteSequence.Scale { get { throw exception; } } + string ISpriteSequence.Name => throw exception; + int ISpriteSequence.Start => throw exception; + int ISpriteSequence.Length => throw exception; + int ISpriteSequence.Stride => throw exception; + int ISpriteSequence.Facings => throw exception; + int ISpriteSequence.Tick => throw exception; + int ISpriteSequence.ZOffset => throw exception; + int ISpriteSequence.ShadowStart => throw exception; + int ISpriteSequence.ShadowZOffset => throw exception; + int[] ISpriteSequence.Frames => throw exception; + Rectangle ISpriteSequence.Bounds => throw exception; + bool ISpriteSequence.IgnoreWorldTint => throw exception; + float ISpriteSequence.Scale => throw exception; Sprite ISpriteSequence.GetSprite(int frame) { throw exception; } Sprite ISpriteSequence.GetSprite(int frame, WAngle facing) { throw exception; } Sprite ISpriteSequence.GetShadow(int frame, WAngle facing) { throw exception; } diff --git a/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs index f3a4309f51..b871192330 100644 --- a/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs @@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics this.borderWidth = borderWidth; } - public WPos Pos { get { return centerPosition; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => centerPosition; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs index e16cade155..718f0405ac 100644 --- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs @@ -46,12 +46,12 @@ namespace OpenRA.Mods.Common.Graphics this.bounds = bounds; } - public WPos Pos { get { return pos; } } - public bool DisplayHealth { get { return displayHealth; } } - public bool DisplayExtra { get { return displayExtra; } } + public WPos Pos => pos; + public bool DisplayHealth => displayHealth; + public bool DisplayExtra => displayExtra; - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return this; } public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); } diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs index 6ec5e0f9d6..520d7bead3 100644 --- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs @@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Graphics this.color = color; } - public WPos Pos { get { return pos; } } + public WPos Pos => pos; - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return this; } public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); } diff --git a/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs index b2ae99417e..ffaa20b0a1 100644 --- a/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs @@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics this.endColor = endColor; } - public WPos Pos { get { return start; } } - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => start; + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new LineAnnotationRenderable(start, end, width, startColor, endColor); } public IRenderable OffsetBy(WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); } diff --git a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs index d2443ca639..7f5e3a57ef 100644 --- a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs @@ -65,14 +65,14 @@ namespace OpenRA.Mods.Common.Graphics this.tintModifiers = tintModifiers; } - public WPos Pos { get { return pos; } } - public PaletteReference Palette { get { return palette; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return false; } } + public WPos Pos => pos; + public PaletteReference Palette => palette; + public int ZOffset => zOffset; + public bool IsDecoration => false; - public float Alpha { get { return alpha; } } - public float3 Tint { get { return tint; } } - public TintModifiers TintModifiers { get { return tintModifiers; } } + public float Alpha => alpha; + public float3 Tint => tint; + public TintModifiers TintModifiers => tintModifiers; public IPalettedRenderable WithPalette(PaletteReference newPalette) { diff --git a/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs index 3185e132c9..d70600596f 100644 --- a/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs @@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Graphics this.color = color; } - public WPos Pos { get { return effectivePos; } } - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => effectivePos; + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new PolygonAnnotationRenderable(vertices, effectivePos, width, color); } public IRenderable OffsetBy(WVec vec) { return new PolygonAnnotationRenderable(vertices.Select(v => v + vec).ToArray(), effectivePos + vec, width, color); } diff --git a/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs b/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs index db1f521149..5d6bbda416 100644 --- a/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs @@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Graphics angle = new WAngle(ticks * info.HelixAngleDeltaPerTick.Angle); } - public WPos Pos { get { return pos; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => pos; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new RailgunHelixRenderable(pos, newOffset, railgun, info, ticks); } public IRenderable OffsetBy(WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); } diff --git a/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs index d5e0af5a12..4939e7b60e 100644 --- a/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs @@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics this.borderWidth = borderWidth; } - public WPos Pos { get { return centerPosition; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => centerPosition; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, width, borderColor, borderWidth); } public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); } diff --git a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs index f4f49e510f..626073c0ac 100644 --- a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs @@ -37,12 +37,12 @@ namespace OpenRA.Mods.Common.Graphics this.decorationBounds = decorationBounds; } - public WPos Pos { get { return pos; } } - public bool DisplayHealth { get { return displayHealth; } } - public bool DisplayExtra { get { return displayExtra; } } + public WPos Pos => pos; + public bool DisplayHealth => displayHealth; + public bool DisplayExtra => displayExtra; - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return this; } public IRenderable OffsetBy(WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); } diff --git a/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs index 26f048c351..9ae16c64e3 100644 --- a/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs @@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Graphics this.color = color; } - public WPos Pos { get { return pos; } } + public WPos Pos => pos; - public int ZOffset { get { return 0; } } - public bool IsDecoration { get { return true; } } + public int ZOffset => 0; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return this; } public IRenderable OffsetBy(WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); } diff --git a/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs index 8cdf0861ac..83cb6a405e 100644 --- a/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs @@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics ChromeMetrics.Get("TextContrastColorLight"), text) { } - public WPos Pos { get { return pos; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => pos; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); } public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); } diff --git a/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs b/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs index d17643e5f9..8a549bb9b5 100644 --- a/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs @@ -51,10 +51,10 @@ namespace OpenRA.Mods.Common.Graphics shadowPalette = shadow; } - public WPos Pos { get { return effectiveWorldPos; } } - public PaletteReference Palette { get { return palette; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return false; } } + public WPos Pos => effectiveWorldPos; + public PaletteReference Palette => palette; + public int ZOffset => zOffset; + public bool IsDecoration => false; public IPalettedRenderable WithPalette(PaletteReference newPalette) { diff --git a/OpenRA.Mods.Common/Graphics/UITextRenderable.cs b/OpenRA.Mods.Common/Graphics/UITextRenderable.cs index d8a744ec99..5bc02e494a 100644 --- a/OpenRA.Mods.Common/Graphics/UITextRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/UITextRenderable.cs @@ -44,9 +44,9 @@ namespace OpenRA.Mods.Common.Graphics ChromeMetrics.Get("TextContrastColorLight"), text) { } - public WPos Pos { get { return effectiveWorldPos; } } - public int ZOffset { get { return zOffset; } } - public bool IsDecoration { get { return true; } } + public WPos Pos => effectiveWorldPos; + public int ZOffset => zOffset; + public bool IsDecoration => true; public IRenderable WithZOffset(int newOffset) { return new UITextRenderable(font, effectiveWorldPos, screenPos, zOffset, color, text); } public IRenderable OffsetBy(WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); } diff --git a/OpenRA.Mods.Common/HitShapes/Circle.cs b/OpenRA.Mods.Common/HitShapes/Circle.cs index 25fa6de0fa..03abb8c1c8 100644 --- a/OpenRA.Mods.Common/HitShapes/Circle.cs +++ b/OpenRA.Mods.Common/HitShapes/Circle.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.HitShapes { public class CircleShape : IHitShape { - public WDist OuterRadius { get { return Radius; } } + public WDist OuterRadius => Radius; [FieldLoader.Require] public readonly WDist Radius = new WDist(426); diff --git a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs index 86a20f6a24..7a6e7e42ac 100644 --- a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Orders return true; } - public override bool ClearSelectionOnLeftClick { get { return false; } } + public override bool ClearSelectionOnLeftClick => false; static IEnumerable FriendlyGuardableUnits(World world, MouseInput mi) { diff --git a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs index b081eb6e15..c5e8fbbbe2 100644 --- a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Pathfinder public abstract IEnumerable<(CPos Cell, int Cost)> Considered { get; } - public Player Owner { get { return Graph.Actor.Owner; } } + public Player Owner => Graph.Actor.Owner; public int MaxCost { get; protected set; } public bool Debug { get; set; } protected Func heuristic; @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Pathfinder return isGoal(location); } - public bool CanExpand { get { return !OpenQueue.Empty; } } + public bool CanExpand => !OpenQueue.Empty; public abstract CPos Expand(); protected virtual void Dispose(bool disposing) diff --git a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs index 175a8d06c0..4edb22fd52 100644 --- a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs +++ b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs @@ -222,8 +222,8 @@ namespace OpenRA.Mods.Common.Pathfinder public CellInfo this[CPos pos] { - get { return (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos]; } - set { (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value; } + get => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos]; + set => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value; } public void Dispose() diff --git a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs index 45d6653894..82770e32d6 100644 --- a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs @@ -30,10 +30,7 @@ namespace OpenRA.Mods.Common.Pathfinder return LayerPoolTable.GetValue(world, CreateLayerPool); } - public override IEnumerable<(CPos, int)> Considered - { - get { return considered; } - } + public override IEnumerable<(CPos, int)> Considered => considered; LinkedList<(CPos, int)> considered; diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index cc594caf74..8f14afda46 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -103,13 +103,7 @@ namespace OpenRA.Mods.Common.Projectiles bool isTailTravelling; bool continueTracking = true; - bool IsBeamComplete - { - get - { - return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length; - } - } + bool IsBeamComplete => !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length; public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color) { diff --git a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs index 84d60aba53..7cb39e7bf6 100644 --- a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs +++ b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs @@ -159,6 +159,6 @@ namespace OpenRA.Mods.Common.Effects return anim.Render(pos, wr.Palette(weaponPalette)); } - public float FractionComplete { get { return ticks * 1f / impactDelay; } } + public float FractionComplete => ticks * 1f / impactDelay; } } diff --git a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs index 7815611098..0b54e5358a 100644 --- a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs @@ -19,14 +19,14 @@ namespace OpenRA.Mods.Common.Scripting.Global public AngleGlobal(ScriptContext context) : base(context) { } - public WAngle North { get { return WAngle.Zero; } } - public WAngle NorthWest { get { return new WAngle(128); } } - public WAngle West { get { return new WAngle(256); } } - public WAngle SouthWest { get { return new WAngle(384); } } - public WAngle South { get { return new WAngle(512); } } - public WAngle SouthEast { get { return new WAngle(640); } } - public WAngle East { get { return new WAngle(768); } } - public WAngle NorthEast { get { return new WAngle(896); } } + 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); [Desc("Create an arbitrary angle.")] public WAngle New(int a) { return new WAngle(a); } diff --git a/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs index 66ec0c33b9..6ce1c60a8c 100644 --- a/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs @@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Scripting [Desc("The center of the visible viewport.")] public WPos Position { - get { return Context.WorldRenderer.Viewport.CenterPosition; } - set { Context.WorldRenderer.Viewport.Center(value); } + get => Context.WorldRenderer.Viewport.CenterPosition; + set => Context.WorldRenderer.Viewport.Center(value); } } } diff --git a/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs index e008b3ac82..2b6f9fb337 100644 --- a/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs @@ -51,41 +51,41 @@ namespace OpenRA.Mods.Common.Scripting.Global throw new LuaException("Invalid rrggbb[aa] hex string."); } - public Color Aqua { get { return Color.Aqua; } } - public Color Black { get { return Color.Black; } } - public Color Blue { get { return Color.Blue; } } - public Color Brown { get { return Color.Brown; } } - public Color Cyan { get { return Color.Cyan; } } - public Color DarkBlue { get { return Color.DarkBlue; } } - public Color DarkCyan { get { return Color.DarkCyan; } } - public Color DarkGray { get { return Color.DarkGray; } } - public Color DarkGreen { get { return Color.DarkGreen; } } - public Color DarkOrange { get { return Color.DarkOrange; } } - public Color DarkRed { get { return Color.DarkRed; } } - public Color Fuchsia { get { return Color.Fuchsia; } } - public Color Gold { get { return Color.Gold; } } - public Color Gray { get { return Color.Gray; } } - public Color Green { get { return Color.Green; } } - public Color LawnGreen { get { return Color.LawnGreen; } } - public Color LightBlue { get { return Color.LightBlue; } } - public Color LightCyan { get { return Color.LightCyan; } } - public Color LightGray { get { return Color.LightGray; } } - public Color LightGreen { get { return Color.LightGreen; } } - public Color LightYellow { get { return Color.LightYellow; } } - public Color Lime { get { return Color.Lime; } } - public Color LimeGreen { get { return Color.LimeGreen; } } - public Color Magenta { get { return Color.Magenta; } } - public Color Maroon { get { return Color.Maroon; } } - public Color Navy { get { return Color.Navy; } } - public Color Olive { get { return Color.Olive; } } - public Color Orange { get { return Color.Orange; } } - public Color OrangeRed { get { return Color.OrangeRed; } } - public Color Purple { get { return Color.Purple; } } - public Color Red { get { return Color.Red; } } - public Color Salmon { get { return Color.Salmon; } } - public Color SkyBlue { get { return Color.SkyBlue; } } - public Color Teal { get { return Color.Teal; } } - public Color Yellow { get { return Color.Yellow; } } - public Color White { get { return Color.White; } } + public Color Aqua => Color.Aqua; + public Color Black => Color.Black; + public Color Blue => Color.Blue; + public Color Brown => Color.Brown; + public Color Cyan => Color.Cyan; + public Color DarkBlue => Color.DarkBlue; + public Color DarkCyan => Color.DarkCyan; + public Color DarkGray => Color.DarkGray; + public Color DarkGreen => Color.DarkGreen; + public Color DarkOrange => Color.DarkOrange; + public Color DarkRed => Color.DarkRed; + public Color Fuchsia => Color.Fuchsia; + public Color Gold => Color.Gold; + public Color Gray => Color.Gray; + public Color Green => Color.Green; + public Color LawnGreen => Color.LawnGreen; + public Color LightBlue => Color.LightBlue; + public Color LightCyan => Color.LightCyan; + public Color LightGray => Color.LightGray; + public Color LightGreen => Color.LightGreen; + public Color LightYellow => Color.LightYellow; + public Color Lime => Color.Lime; + public Color LimeGreen => Color.LimeGreen; + public Color Magenta => Color.Magenta; + public Color Maroon => Color.Maroon; + public Color Navy => Color.Navy; + public Color Olive => Color.Olive; + public Color Orange => Color.Orange; + public Color OrangeRed => Color.OrangeRed; + public Color Purple => Color.Purple; + public Color Red => Color.Red; + public Color Salmon => Color.Salmon; + public Color SkyBlue => Color.SkyBlue; + public Color Teal => Color.Teal; + public Color Yellow => Color.Yellow; + public Color White => Color.White; } } diff --git a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs index 7a7f7ed5bd..88e0b6a90c 100644 --- a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs +++ b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting public CPos New(int x, int y) { return new CPos(x, y); } [Desc("The cell coordinate origin.")] - public CPos Zero { get { return CPos.Zero; } } + public CPos Zero => CPos.Zero; } [ScriptGlobal("CVec")] @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Scripting public CVec New(int x, int y) { return new CVec(x, y); } [Desc("The cell zero-vector.")] - public CVec Zero { get { return CVec.Zero; } } + public CVec Zero => CVec.Zero; } [ScriptGlobal("WPos")] @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Scripting public WPos New(int x, int y, int z) { return new WPos(x, y, z); } [Desc("The world coordinate origin.")] - public WPos Zero { get { return WPos.Zero; } } + public WPos Zero => WPos.Zero; } [ScriptGlobal("WVec")] @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Scripting public WVec New(int x, int y, int z) { return new WVec(x, y, z); } [Desc("The world zero-vector.")] - public WVec Zero { get { return WVec.Zero; } } + public WVec Zero => WVec.Zero; } [ScriptGlobal("WDist")] diff --git a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs index 8b8f45435b..5f7e372c96 100644 --- a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs @@ -28,16 +28,10 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("True on the 31st of October.")] - public bool IsHalloween - { - get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; } - } + public bool IsHalloween => DateTime.Today.Month == 10 && DateTime.Today.Day == 31; [Desc("Get the current game time (in ticks).")] - public int GameTime - { - get { return Context.World.WorldTick; } - } + public int GameTime => Context.World.WorldTick; [Desc("Converts the number of seconds into game time (ticks).")] public int Seconds(int seconds) @@ -54,10 +48,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Return or set the time limit (in ticks). When setting, the time limit will count from now. Setting the time limit to 0 will disable it.")] public int TimeLimit { - get - { - return tlm != null ? tlm.TimeLimit : 0; - } + get => tlm != null ? tlm.TimeLimit : 0; set { @@ -71,10 +62,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("The notification string used for custom time limit warnings. See the TimeLimitManager trait documentation for details.")] public string TimeLimitNotification { - get - { - return tlm != null ? tlm.Notification : null; - } + get => tlm != null ? tlm.Notification : null; set { diff --git a/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs index f82a0ab883..4f237f6f77 100644 --- a/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs @@ -40,25 +40,25 @@ namespace OpenRA.Mods.Common.Scripting public double Red { - get { return hasLighting ? lighting.Red : 1d; } + get => hasLighting ? lighting.Red : 1d; set { if (hasLighting) lighting.Red = (float)value; } } public double Green { - get { return hasLighting ? lighting.Green : 1d; } + get => hasLighting ? lighting.Green : 1d; set { if (hasLighting) lighting.Green = (float)value; } } public double Blue { - get { return hasLighting ? lighting.Blue : 1d; } + get => hasLighting ? lighting.Blue : 1d; set { if (hasLighting) lighting.Blue = (float)value; } } public double Ambient { - get { return hasLighting ? lighting.Ambient : 1d; } + get => hasLighting ? lighting.Ambient : 1d; set { if (hasLighting) lighting.Ambient = (float)value; } } } diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs index c85d4f1b6c..92d5b870aa 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs @@ -49,27 +49,15 @@ namespace OpenRA.Mods.Common.Scripting return FilteredObjects(actors, filter).ToArray(); } + // HACK: This api method abuses the coordinate system, and should be removed + // in favour of proper actor queries. See #8549. [Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")] - public WPos TopLeft - { - get - { - // HACK: This api method abuses the coordinate system, and should be removed - // in favour of proper actor queries. See #8549. - return Context.World.Map.ProjectedTopLeft; - } - } + public WPos TopLeft => Context.World.Map.ProjectedTopLeft; + // HACK: This api method abuses the coordinate system, and should be removed + // in favour of proper actor queries. See #8549. [Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")] - public WPos BottomRight - { - get - { - // HACK: This api method abuses the coordinate system, and should be removed - // in favour of proper actor queries. See #8549. - return Context.World.Map.ProjectedBottomRight; - } - } + public WPos BottomRight => Context.World.Map.ProjectedBottomRight; [Desc("Returns a random cell inside the visible region of the map.")] public CPos RandomCell() @@ -109,10 +97,10 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns true if there is only one human player.")] - public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } } + public bool IsSinglePlayer => Context.World.LobbyInfo.NonBotPlayers.Count() == 1; [Desc("Returns true if this is a shellmap and the player has paused animations.")] - public bool IsPausedShellmap { get { return Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; } } + public bool IsPausedShellmap => Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; [Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")] public LuaValue LobbyOption(string id) @@ -127,10 +115,10 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns a table of all the actors that were specified in the map file.")] - public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } } + public Actor[] NamedActors => sma.Actors.Values.ToArray(); [Desc("Returns the actor that was specified with a given name in " + - "the map file (or nil, if the actor is dead or not found).")] + "the map file (or nil, if the actor is dead or not found).")] public Actor NamedActor(string actorName) { if (!sma.Actors.TryGetValue(actorName, out var ret)) @@ -155,6 +143,6 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns a table of all the actors that are currently on the map/in the world.")] - public Actor[] ActorsInWorld { get { return world.Actors.ToArray(); } } + public Actor[] ActorsInWorld => world.Actors.ToArray(); } } diff --git a/OpenRA.Mods.Common/Scripting/LuaScript.cs b/OpenRA.Mods.Common/Scripting/LuaScript.cs index 3259448d73..c6ab301ca8 100644 --- a/OpenRA.Mods.Common/Scripting/LuaScript.cs +++ b/OpenRA.Mods.Common/Scripting/LuaScript.cs @@ -59,6 +59,6 @@ namespace OpenRA.Mods.Common.Scripting disposed = true; } - public bool FatalErrorOccurred { get { return context.FatalErrorOccurred; } } + public bool FatalErrorOccurred => context.FatalErrorOccurred; } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs index d61750ace0..82db17eab8 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs @@ -27,16 +27,16 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("The actor's amount of experience.")] - public int Experience { get { return exp.Experience; } } + public int Experience => exp.Experience; [Desc("The actor's level.")] - public int Level { get { return exp.Level; } } + public int Level => exp.Level; [Desc("The actor's maximum possible level.")] - public int MaxLevel { get { return exp.MaxLevel; } } + public int MaxLevel => exp.MaxLevel; [Desc("Returns true if the actor can gain a level.")] - public bool CanGainLevel { get { return exp.CanGainLevel; } } + public bool CanGainLevel => exp.CanGainLevel; [Desc("Gives the actor experience. If 'silent' is true, no animation or sound will be played if the actor levels up.")] public void GiveExperience(int amount, bool silent = false) diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs index a641b59c81..e9f304a0dc 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs @@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Specifies whether the actor is in the world.")] public bool IsInWorld { - get - { - return Self.IsInWorld; - } + get => Self.IsInWorld; set { @@ -46,18 +43,15 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Specifies whether the actor is alive or dead.")] - public bool IsDead { get { return Self.IsDead; } } + public bool IsDead => Self.IsDead; [Desc("Specifies whether the actor is idle (not performing any activities).")] - public bool IsIdle { get { return Self.IsIdle; } } + public bool IsIdle => Self.IsIdle; [Desc("The player that owns the actor.")] public Player Owner { - get - { - return Self.Owner; - } + get => Self.Owner; set { @@ -70,7 +64,7 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("The type of the actor (e.g. \"e1\").")] - public string Type { get { return Self.Info.Name; } } + public string Type => Self.Info.Name; [Desc("Test whether an actor has a specific property.")] public bool HasProperty(string name) @@ -116,10 +110,10 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("The actor position in cell coordinates.")] - public CPos Location { get { return Self.Location; } } + public CPos Location => Self.Location; [Desc("The actor position in world coordinates.")] - public WPos CenterPosition { get { return Self.CenterPosition; } } + public WPos CenterPosition => Self.CenterPosition; [Desc("The direction that the actor is facing.")] public WAngle Facing @@ -170,10 +164,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Current actor stance. Returns nil if this actor doesn't support stances.")] public string Stance { - get - { - return autotarget?.Stance.ToString(); - } + get => autotarget?.Stance.ToString(); set { @@ -200,7 +191,7 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Specifies whether or not the actor supports 'tags'.")] - public bool IsTaggable { get { return scriptTags != null; } } + public bool IsTaggable => scriptTags != null; [Desc("Add a tag to the actor. Returns true on success, false otherwise (for example the actor may already have the given tag).")] public bool AddTag(string tag) diff --git a/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs index bbe7eed672..2cc33310ab 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs @@ -29,12 +29,12 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Current health of the actor.")] public int Health { - get { return health.HP; } - set { health.InflictDamage(Self, Self, new Damage(health.HP - value), true); } + get => health.HP; + set => health.InflictDamage(Self, Self, new Damage(health.HP - value), true); } [Desc("Maximum health of the actor.")] - public int MaxHealth { get { return health.MaxHP; } } + public int MaxHealth => health.MaxHP; [Desc("Kill the actor. damageTypes may be omitted, specified as a string, or as table of strings.")] public void Kill(object damageTypes = null) diff --git a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs index 6638ff8f32..39dac9bef4 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs @@ -67,6 +67,6 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Whether the actor can move (false if immobilized).")] - public bool IsMobile { get { return !mobile.IsTraitDisabled && !mobile.IsTraitPaused; } } + public bool IsMobile => !mobile.IsTraitDisabled && !mobile.IsTraitPaused; } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs index 841830b113..b896dcbf81 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs @@ -28,15 +28,9 @@ namespace OpenRA.Mods.Common.Scripting public int Experience { - get - { - return exp.Experience; - } + get => exp.Experience; - set - { - exp.GiveExperience(value - exp.Experience); - } + set => exp.GiveExperience(value - exp.Experience); } } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs index 58f516cecc..d5ca90537d 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs @@ -25,22 +25,22 @@ namespace OpenRA.Mods.Common.Scripting : base(context, player) { } [Desc("The player's internal name.")] - public string InternalName { get { return Player.InternalName; } } + public string InternalName => Player.InternalName; [Desc("The player's name.")] - public string Name { get { return Player.PlayerName; } } + public string Name => Player.PlayerName; [Desc("The player's color.")] - public Color Color { get { return Player.Color; } } + public Color Color => Player.Color; [Desc("The player's faction.")] - public string Faction { get { return Player.Faction.InternalName; } } + public string Faction => Player.Faction.InternalName; [Desc("The player's spawnpoint ID.")] - public int Spawn { get { return Player.SpawnPoint; } } + public int Spawn => Player.SpawnPoint; [Desc("The player's home/starting location.")] - public CPos HomeLocation { get { return Player.HomeLocation; } } + public CPos HomeLocation => Player.HomeLocation; [Desc("The player's team ID.")] public int Team @@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns true if the player is a bot.")] - public bool IsBot { get { return Player.IsBot; } } + public bool IsBot => Player.IsBot; [Desc("Returns true if the player is non combatant.")] - public bool IsNonCombatant { get { return Player.NonCombatant; } } + public bool IsNonCombatant => Player.NonCombatant; [Desc("Returns true if the player is the local player.")] - public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } } + public bool IsLocalPlayer => Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); [Desc("Returns all living actors staying inside the world for this player.")] public Actor[] GetActors() diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs index 482a2f8739..d1cb20bfb8 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs @@ -27,21 +27,21 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("The combined value of units killed by this player.")] - public int KillsCost { get { return stats.KillsCost; } } + public int KillsCost => stats.KillsCost; [Desc("The combined value of all units lost by this player.")] - public int DeathsCost { get { return stats.DeathsCost; } } + public int DeathsCost => stats.DeathsCost; [Desc("The total number of units killed by this player.")] - public int UnitsKilled { get { return stats.UnitsKilled; } } + public int UnitsKilled => stats.UnitsKilled; [Desc("The total number of units lost by this player.")] - public int UnitsLost { get { return stats.UnitsDead; } } + public int UnitsLost => stats.UnitsDead; [Desc("The total number of buildings killed by this player.")] - public int BuildingsKilled { get { return stats.BuildingsKilled; } } + public int BuildingsKilled => stats.BuildingsKilled; [Desc("The total number of buildings lost by this player.")] - public int BuildingsLost { get { return stats.BuildingsDead; } } + public int BuildingsLost => stats.BuildingsDead; } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs index f5d483b3bd..099218e2cb 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs @@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns the total of the power the player has.")] - public int PowerProvided - { - get { return pm.PowerProvided; } - } + public int PowerProvided => pm.PowerProvided; [Desc("Returns the power used by the player.")] - public int PowerDrained - { - get { return pm.PowerDrained; } - } + public int PowerDrained => pm.PowerDrained; [Desc("Returns the player's power state " + - "(\"Normal\", \"Low\" or \"Critical\").")] - public string PowerState - { - get { return pm.PowerState.ToString(); } - } + "(\"Normal\", \"Low\" or \"Critical\").")] + public string PowerState => pm.PowerState.ToString(); [Desc("Triggers low power for the chosen amount of ticks.")] public void TriggerPowerOutage(int ticks) diff --git a/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs index 86652c6338..14a710fd29 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs @@ -92,10 +92,7 @@ namespace OpenRA.Mods.Common.Scripting return Self.Location; } - set - { - rp.Path = new List { value }; - } + set => rp.Path = new List { value }; } } @@ -113,8 +110,8 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Query or set the factory's primary building status.")] public bool IsPrimaryBuilding { - get { return pb.IsPrimary; } - set { pb.SetPrimaryProducer(Self, value); } + get => pb.IsPrimary; + set => pb.SetPrimaryProducer(Self, value); } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs index 79b0f779f3..849e9c1243 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs @@ -30,18 +30,18 @@ namespace OpenRA.Mods.Common.Scripting [Desc("The amount of harvestable resources held by the player.")] public int Resources { - get { return pr.Resources; } - set { pr.Resources = value.Clamp(0, pr.ResourceCapacity); } + get => pr.Resources; + set => pr.Resources = value.Clamp(0, pr.ResourceCapacity); } [Desc("The maximum resource storage of the player.")] - public int ResourceCapacity { get { return pr.ResourceCapacity; } } + public int ResourceCapacity => pr.ResourceCapacity; [Desc("The amount of cash held by the player.")] public int Cash { - get { return pr.Cash; } - set { pr.Cash = Math.Max(0, value); } + get => pr.Cash; + set => pr.Cash = Math.Max(0, value); } } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs index da8ddd2e71..9c23c2d583 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs @@ -30,13 +30,13 @@ namespace OpenRA.Mods.Common.Scripting } [Desc("Returns references to passengers inside the transport.")] - public Actor[] Passengers { get { return cargo.Passengers.ToArray(); } } + public Actor[] Passengers => cargo.Passengers.ToArray(); [Desc("Specifies whether transport has any passengers.")] - public bool HasPassengers { get { return cargo.Passengers.Any(); } } + public bool HasPassengers => cargo.Passengers.Any(); [Desc("Specifies the amount of passengers.")] - public int PassengerCount { get { return cargo.Passengers.Count(); } } + public int PassengerCount => cargo.Passengers.Count(); [Desc("Teleport an existing actor inside this transport.")] public void LoadPassenger(Actor a) diff --git a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs index 4a49280d93..246bdfb0f5 100644 --- a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs +++ b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Server static readonly int ConnTimeout = 60000; // Drop unresponsive clients after 60 seconds // TickTimeout is in microseconds - public int TickTimeout { get { return PingInterval * 100; } } + public int TickTimeout => PingInterval * 100; long lastPing = 0; long lastConnReport = 0; diff --git a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs index 60e17383d6..b8320c6cbd 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs @@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.SpriteLoaders { public SpriteFrameType Type { get; private set; } public Size Size { get; private set; } - public Size FrameSize { get { return Size; } } - public float2 Offset { get { return float2.Zero; } } + public Size FrameSize => Size; + public float2 Offset => float2.Zero; public byte[] Data { get; private set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public DdsFrame(Stream stream) { diff --git a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs index cf1da27322..a333c88bd6 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders public Size FrameSize { get; set; } public float2 Offset { get; set; } public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; } public bool TryParseSprite(Stream s, out ISpriteFrame[] frames, out TypeDictionary metadata) diff --git a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs index 062a033826..b0ef64ce36 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs @@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.SpriteLoaders { class ShpTSFrame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } public Size FrameSize { get; private set; } public float2 Offset { get; private set; } public byte[] Data { get; set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public readonly uint FileOffset; public readonly byte Format; diff --git a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs index 4fff9e3be2..098d0117b7 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders public Size FrameSize { get; private set; } public float2 Offset { get; private set; } public byte[] Data { get; private set; } - public bool DisableExportPadding { get { return false; } } + public bool DisableExportPadding => false; public TgaFrame() { diff --git a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs index 3bb33061d0..f2e48d1ebd 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs @@ -118,10 +118,7 @@ namespace OpenRA.Mods.Common.Terrain .Select(y => (TerrainTemplateInfo)new DefaultTerrainTemplateInfo(this, y)).ToDictionary(t => t.Id).AsReadOnly(); } - public TerrainTypeInfo this[byte index] - { - get { return TerrainInfo[index]; } - } + public TerrainTypeInfo this[byte index] => TerrainInfo[index]; public byte GetTerrainIndex(string type) { @@ -157,18 +154,18 @@ namespace OpenRA.Mods.Common.Terrain return info != null; } - string ITerrainInfo.Id { get { return Id; } } - TerrainTypeInfo[] ITerrainInfo.TerrainTypes { get { return TerrainInfo; } } + string ITerrainInfo.Id => Id; + TerrainTypeInfo[] ITerrainInfo.TerrainTypes => TerrainInfo; TerrainTileInfo ITerrainInfo.GetTerrainInfo(TerrainTile r) { return GetTileInfo(r); } bool ITerrainInfo.TryGetTerrainInfo(TerrainTile r, out TerrainTileInfo info) { return TryGetTileInfo(r, out info); } - Color[] ITerrainInfo.HeightDebugColors { get { return HeightDebugColors; } } + Color[] ITerrainInfo.HeightDebugColors => HeightDebugColors; IEnumerable ITerrainInfo.RestrictedPlayerColors { get { return TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color); } } - float ITerrainInfo.MinHeightColorBrightness { get { return MinHeightColorBrightness; } } - float ITerrainInfo.MaxHeightColorBrightness { get { return MaxHeightColorBrightness; } } - TerrainTile ITerrainInfo.DefaultTerrainTile { get { return new TerrainTile(Templates.First().Key, 0); } } + float ITerrainInfo.MinHeightColorBrightness => MinHeightColorBrightness; + float ITerrainInfo.MaxHeightColorBrightness => MaxHeightColorBrightness; + TerrainTile ITerrainInfo.DefaultTerrainTile => new TerrainTile(Templates.First().Key, 0); - string[] ITemplatedTerrainInfo.EditorTemplateOrder { get { return EditorTemplateOrder; } } - IReadOnlyDictionary ITemplatedTerrainInfo.Templates { get { return Templates; } } + string[] ITemplatedTerrainInfo.EditorTemplateOrder => EditorTemplateOrder; + IReadOnlyDictionary ITemplatedTerrainInfo.Templates => Templates; void ITerrainInfoNotifyMapCreated.MapCreated(Map map) { diff --git a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs index cd7bca7672..7317b13316 100644 --- a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs +++ b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs @@ -177,7 +177,7 @@ namespace OpenRA.Mods.Common.Terrain return template.Sprites[start * template.Stride + r.Index]; } - public Sprite MissingTile { get { return missingTile; } } + public Sprite MissingTile => missingTile; public void Dispose() { diff --git a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs index d52909436c..539c650213 100644 --- a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs +++ b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs @@ -88,16 +88,13 @@ namespace OpenRA.Mods.Common.Terrain return tile; } - public TerrainTileInfo this[int index] { get { return tileInfo[index]; } } + public TerrainTileInfo this[int index] => tileInfo[index]; public bool Contains(int index) { return index >= 0 && index < tileInfo.Length; } - public int TilesCount - { - get { return tileInfo.Length; } - } + public int TilesCount => tileInfo.Length; } } diff --git a/OpenRA.Mods.Common/Traits/ActorSpawner.cs b/OpenRA.Mods.Common/Traits/ActorSpawner.cs index bc58ff73ff..bbe961742c 100644 --- a/OpenRA.Mods.Common/Traits/ActorSpawner.cs +++ b/OpenRA.Mods.Common/Traits/ActorSpawner.cs @@ -27,6 +27,6 @@ namespace OpenRA.Mods.Common.Traits public ActorSpawner(ActorSpawnerInfo info) : base(info) { } - public HashSet Types { get { return Info.Types; } } + public HashSet Types => Info.Types; } } diff --git a/OpenRA.Mods.Common/Traits/AffectsShroud.cs b/OpenRA.Mods.Common/Traits/AffectsShroud.cs index cac3031af8..8a5920ed10 100644 --- a/OpenRA.Mods.Common/Traits/AffectsShroud.cs +++ b/OpenRA.Mods.Common/Traits/AffectsShroud.cs @@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits RemoveCellsFromPlayerShroud(self, p); } - public virtual WDist Range { get { return CachedTraitDisabled ? WDist.Zero : Info.Range; } } + public virtual WDist Range => CachedTraitDisabled ? WDist.Zero : Info.Range; void INotifyMoving.MovementTypeChanged(Actor self, MovementType type) { diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 30363c18fd..0dde0d3ea8 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Traits public IReadOnlyDictionary OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary(); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; // Used to determine if an aircraft can spawn landed public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) @@ -232,30 +232,30 @@ namespace OpenRA.Mods.Common.Traits [Sync] public WAngle Facing { - get { return orientation.Yaw; } - set { orientation = orientation.WithYaw(value); } + get => orientation.Yaw; + set => orientation = orientation.WithYaw(value); } public WAngle Pitch { - get { return orientation.Pitch; } - set { orientation = orientation.WithPitch(value); } + get => orientation.Pitch; + set => orientation = orientation.WithPitch(value); } public WAngle Roll { - get { return orientation.Roll; } - set { orientation = orientation.WithRoll(value); } + get => orientation.Roll; + set => orientation = orientation.WithRoll(value); } - public WRot Orientation { get { return orientation; } } + public WRot Orientation => orientation; [Sync] public WPos CenterPosition { get; private set; } - public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } } - public WAngle TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero; } } - public WAngle? IdleTurnSpeed { get { return Info.IdleTurnSpeed; } } + public CPos TopLeft => self.World.Map.CellContaining(CenterPosition); + public WAngle TurnSpeed => !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero; + public WAngle? IdleTurnSpeed => Info.IdleTurnSpeed; public Actor ReservedActor { get; private set; } public bool MayYieldReservation { get; private set; } @@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits return self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(self.CenterPosition)); } - public bool AtLandAltitude { get { return self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude; } } + public bool AtLandAltitude => self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude; bool airborne; bool cruising; @@ -595,10 +595,7 @@ namespace OpenRA.Mods.Common.Traits return allowedToEnterRearmer || allowedToEnterRepairer; } - public int MovementSpeed - { - get { return !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; } - } + public int MovementSpeed => !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; public (CPos Cell, SubCell SubCell)[] OccupiedCells() { @@ -967,10 +964,7 @@ namespace OpenRA.Mods.Common.Traits public MovementType CurrentMovementTypes { - get - { - return movementTypes; - } + get => movementTypes; set { @@ -1247,7 +1241,7 @@ namespace OpenRA.Mods.Common.Traits readonly Aircraft aircraft; public string OrderID { get; protected set; } - public int OrderPriority { get { return 4; } } + public int OrderPriority => 4; public bool IsQueued { get; protected set; } public AircraftMoveOrderTargeter(Aircraft aircraft) diff --git a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs index d350f709d5..bad28a85da 100644 --- a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs +++ b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs @@ -60,8 +60,8 @@ namespace OpenRA.Mods.Common.Traits } // We return init.Self.Owner if there's no effective owner - bool IEffectiveOwner.Disguised { get { return true; } } - Player IEffectiveOwner.Owner { get { return effectiveOwner; } } + bool IEffectiveOwner.Disguised => true; + Player IEffectiveOwner.Owner => effectiveOwner; void INotifyCreated.Created(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs index f4925d0fed..a1a3a92016 100644 --- a/OpenRA.Mods.Common/Traits/AmmoPool.cs +++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs @@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits [Sync] public int CurrentAmmoCount { get; private set; } - public bool HasAmmo { get { return CurrentAmmoCount > 0; } } - public bool HasFullAmmo { get { return CurrentAmmoCount == Info.Ammo; } } + public bool HasAmmo => CurrentAmmoCount > 0; + public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo; public AmmoPool(Actor self, AmmoPoolInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 33912ecf39..1db4bedd01 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -363,7 +363,7 @@ namespace OpenRA.Mods.Common.Traits } } - public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } } + public virtual bool IsReloading => FireDelay > 0 || IsTraitDisabled; public WVec MuzzleOffset(Actor self, Barrel b) { @@ -396,6 +396,6 @@ namespace OpenRA.Mods.Common.Traits return WRot.FromYaw(b.Yaw).Rotate(turret != null ? turret.WorldOrientation : self.Orientation); } - public Actor Actor { get { return self; } } + public Actor Actor => self; } } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index 39b32f310e..2563fe4e5e 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits [Sync] public bool IsAiming { get; set; } - public IEnumerable Armaments { get { return getArmaments(); } } + public IEnumerable Armaments => getArmaments(); protected IFacing facing; protected IPositionable positionable; diff --git a/OpenRA.Mods.Common/Traits/AttackMove.cs b/OpenRA.Mods.Common/Traits/AttackMove.cs index e6f699980c..36dacc6e75 100644 --- a/OpenRA.Mods.Common/Traits/AttackMove.cs +++ b/OpenRA.Mods.Common/Traits/AttackMove.cs @@ -155,6 +155,6 @@ namespace OpenRA.Mods.Common.Traits return true; } - public override bool ClearSelectionOnLeftClick { get { return false; } } + public override bool ClearSelectionOnLeftClick => false; } } diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs index 8a1d7b9397..c4ba66444f 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits this.info = info; } - public WDist MinimumDistance { get { return info.MinDistance; } } + public WDist MinimumDistance => info.MinDistance; // No longer want to be carried void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); } diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index e0d922da4c..6fede19f07 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits [Sync] int nextScanTime = 0; - public UnitStance Stance { get { return stance; } } + public UnitStance Stance => stance; [Sync] public Actor Aggressor; diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index 647e3e5ca3..e26df2d928 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public BlocksProjectiles(Actor self, BlocksProjectilesInfo info) : base(info) { } - WDist IBlocksProjectiles.BlockingHeight { get { return Info.Height; } } + WDist IBlocksProjectiles.BlockingHeight => Info.Height; public static bool AnyBlockingActorAt(World world, WPos pos) { diff --git a/OpenRA.Mods.Common/Traits/BodyOrientation.cs b/OpenRA.Mods.Common/Traits/BodyOrientation.cs index 2a7071644b..edf74258cf 100644 --- a/OpenRA.Mods.Common/Traits/BodyOrientation.cs +++ b/OpenRA.Mods.Common/Traits/BodyOrientation.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits readonly Lazy quantizedFacings; [Sync] - public int QuantizedFacings { get { return quantizedFacings.Value; } } + public int QuantizedFacings => quantizedFacings.Value; public BodyOrientation(ActorInitializer init, BodyOrientationInfo info) { @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits }); } - public WAngle CameraPitch { get { return info.CameraPitch; } } + public WAngle CameraPitch => info.CameraPitch; public WVec LocalToWorld(WVec vec) { diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index 58afdeb2ca..f994069e39 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits return randomConstructionYard != null ? randomConstructionYard.Location : initialBaseCenter; } - public CPos DefenseCenter { get { return defenseCenter; } } + public CPos DefenseCenter => defenseCenter; readonly World world; readonly Player player; @@ -194,10 +194,7 @@ namespace OpenRA.Mods.Common.Traits defenseCenter = newLocation; } - bool IBotRequestPauseUnitProduction.PauseUnitProduction - { - get { return !IsTraitDisabled && !HasAdequateRefineryCount; } - } + bool IBotRequestPauseUnitProduction.PauseUnitProduction => !IsTraitDisabled && !HasAdequateRefineryCount; void IBotTick.BotTick(IBot bot) { @@ -261,25 +258,14 @@ namespace OpenRA.Mods.Common.Traits return info != null && world.IsCellBuildable(x, null, info); } - public bool HasAdequateRefineryCount - { - get - { - // Require at least one refinery, unless we can't build it. - return !Info.RefineryTypes.Any() || - AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount || - AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 || - AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0; - } - } + // Require at least one refinery, unless we can't build it. + public bool HasAdequateRefineryCount => + !Info.RefineryTypes.Any() || + AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount || + AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 || + AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0; - int MinimumRefineryCount - { - get - { - return AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount; - } - } + int MinimumRefineryCount => AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount; List IGameSaveTraitData.IssueTraitData(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs index f65c41b669..21fd6bfc9b 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs @@ -68,23 +68,17 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads FuzzyStateMachine.Update(this); } - public bool IsValid { get { return Units.Any(); } } + public bool IsValid => Units.Any(); public Actor TargetActor { - get { return Target.Actor; } - set { Target = Target.FromActor(value); } + get => Target.Actor; + set => Target = Target.FromActor(value); } - public bool IsTargetValid - { - get { return Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo(); } - } + public bool IsTargetValid => Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo(); - public bool IsTargetVisible - { - get { return TargetActor.CanBeViewedByPlayer(Bot.Player); } - } + public bool IsTargetVisible => TargetActor.CanBeViewedByPlayer(Bot.Player); public WPos CenterPosition { get { return Units.Select(u => u.CenterPosition).Average(); } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs index 81ddcdd276..cc2a512d2f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits return RangeCircleRenderables(wr); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; float ISelectionBar.GetValue() { @@ -130,6 +130,6 @@ namespace OpenRA.Mods.Common.Traits } Color ISelectionBar.GetColor() { return Color.Purple; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs index 64caa81b2d..0196c3dbc9 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits Dictionary footprint; public LegacyBridgeHut Hut { get; private set; } - public bool IsDangling { get { return isDangling.Value; } } + public bool IsDangling => isDangling.Value; public Bridge(Actor self, BridgeInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs index 38aeba4aed..320c53ed51 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs @@ -236,6 +236,6 @@ namespace OpenRA.Mods.Common.Traits } } - public bool Repairing { get { return repairStep < segmentLocations.Count; } } + public bool Repairing => repairStep < segmentLocations.Count; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs index 8dbacf78f1..dea775768b 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs @@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits // Do nothing } - string IBridgeSegment.Type { get { return Info.Type; } } - DamageState IBridgeSegment.DamageState { get { return Info.DamageState; } } - bool IBridgeSegment.Valid { get { return self.IsInWorld; } } - CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } } - CPos IBridgeSegment.Location { get { return self.Location; } } + string IBridgeSegment.Type => Info.Type; + DamageState IBridgeSegment.DamageState => Info.DamageState; + bool IBridgeSegment.Valid => self.IsInWorld; + CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets; + CPos IBridgeSegment.Location => self.Location; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 5a371814f4..6c75f7d1f4 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits return new ReadOnlyDictionary(occupied); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; public IEnumerable RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) { @@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits (CPos, SubCell)[] targetableCells; CPos[] transitOnlyCells; - public CPos TopLeft { get { return topLeft; } } + public CPos TopLeft => topLeft; public WPos CenterPosition { get; private set; } public Building(ActorInitializer init, BuildingInfo info) diff --git a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs index 2abff29f85..2433d2b7a7 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs @@ -129,6 +129,6 @@ namespace OpenRA.Mods.Common.Traits void IPlaceBuildingPreview.Tick() { TickInner(); } - int2 IPlaceBuildingPreview.TopLeftScreenOffset { get { return topLeftScreenOffset; } } + int2 IPlaceBuildingPreview.TopLeftScreenOffset => topLeftScreenOffset; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs index f2bd8a7f66..8b02a5d0b5 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs @@ -136,12 +136,6 @@ namespace OpenRA.Mods.Common.Traits return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self)); } - WDist IBlocksProjectiles.BlockingHeight - { - get - { - return new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition); - } - } + WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition); } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs index 38a31c6e5b..3be328f1f1 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs @@ -30,6 +30,6 @@ namespace OpenRA.Mods.Common.Traits readonly HashSet noAreaTypes = new HashSet(); - public HashSet AreaTypes { get { return !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } } + public HashSet AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs index ee21b15210..d6b5c584e2 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs @@ -117,10 +117,10 @@ namespace OpenRA.Mods.Common.Traits }); } - string IBridgeSegment.Type { get { return Info.Type; } } - DamageState IBridgeSegment.DamageState { get { return self.GetDamageState(); } } - bool IBridgeSegment.Valid { get { return self.IsInWorld; } } - CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } } - CPos IBridgeSegment.Location { get { return self.Location; } } + string IBridgeSegment.Type => Info.Type; + DamageState IBridgeSegment.DamageState => self.GetDamageState(); + bool IBridgeSegment.Valid => self.IsInWorld; + CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets; + CPos IBridgeSegment.Location => self.Location; } } diff --git a/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs index c2eecb3b74..91d41dcb6a 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs @@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Traits { public Bridge FirstBridge { get; private set; } public Bridge Bridge { get; private set; } - public DamageState BridgeDamageState { get { return Bridge.AggregateDamageState(); } } - public bool Repairing { get { return repairDirections > 0; } } + public DamageState BridgeDamageState => Bridge.AggregateDamageState(); + public bool Repairing => repairDirections > 0; int repairDirections = 0; public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info) diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs index d0acfedb9d..fb56ca55a3 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs @@ -132,8 +132,8 @@ namespace OpenRA.Mods.Common.Traits this.cursor = cursor; } - public string OrderID { get { return "SetRallyPoint"; } } - public int OrderPriority { get { return 0; } } + public string OrderID => "SetRallyPoint"; + public int OrderPriority => 0; public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } public bool ForceSet { get; private set; } public bool IsQueued { get; protected set; } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs index 3300f13c15..4e119a474b 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs @@ -69,12 +69,12 @@ namespace OpenRA.Mods.Common.Traits [Sync] bool preventDock = false; - public bool AllowDocking { get { return !preventDock; } } - public CVec DeliveryOffset { get { return info.DockOffset; } } - public WAngle DeliveryAngle { get { return info.DockAngle; } } - public bool IsDragRequired { get { return info.IsDragRequired; } } - public WVec DragOffset { get { return info.DragOffset; } } - public int DragLength { get { return info.DragLength; } } + public bool AllowDocking => !preventDock; + public CVec DeliveryOffset => info.DockOffset; + public WAngle DeliveryAngle => info.DockAngle; + public bool IsDragRequired => info.IsDragRequired; + public WVec DragOffset => info.DragOffset; + public int DragLength => info.DragLength; public Refinery(Actor self, RefineryInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs index 641887ab5d..355b099b6d 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs @@ -186,8 +186,8 @@ namespace OpenRA.Mods.Common.Traits this.aircraft = aircraft; } - public string OrderID { get { return "Move"; } } - public int OrderPriority { get { return 4; } } + public string OrderID => "Move"; + public int OrderPriority => 4; public bool IsQueued { get; protected set; } public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs index 9633a06af3..caba137db0 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs @@ -177,8 +177,8 @@ namespace OpenRA.Mods.Common.Traits rejectMove = !self.AcceptsOrder("Move"); } - public string OrderID { get { return "Move"; } } - public int OrderPriority { get { return 4; } } + public string OrderID => "Move"; + public int OrderPriority => 4; public bool IsQueued { get; protected set; } public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs index f2a4ef2c6f..7ca73af128 100644 --- a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs @@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits } Color ISelectionBar.GetColor() { return Info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs index a013f1dd9b..af0366a51b 100644 --- a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs +++ b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs @@ -48,6 +48,6 @@ namespace OpenRA.Mods.Common.Traits } Color ISelectionBar.GetColor() { return Info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index ae0734b311..cd01c1a921 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Dictionary PassengerConditions = new Dictionary(); [GrantedConditionReference] - public IEnumerable LinterPassengerConditions { get { return PassengerConditions.Values; } } + public IEnumerable LinterPassengerConditions => PassengerConditions.Values; public override object Create(ActorInitializer init) { return new Cargo(init, this); } } @@ -108,13 +108,10 @@ namespace OpenRA.Mods.Common.Traits readonly CachedTransform> currentAdjacentCells; - public IEnumerable CurrentAdjacentCells - { - get { return currentAdjacentCells.Update(self.Location); } - } + public IEnumerable CurrentAdjacentCells => currentAdjacentCells.Update(self.Location); - public IEnumerable Passengers { get { return cargo; } } - public int PassengerCount { get { return cargo.Count; } } + public IEnumerable Passengers => cargo; + public int PassengerCount => cargo.Count; enum State { Free, Locked } State state = State.Free; diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs index c1181390e5..552bc280ea 100644 --- a/OpenRA.Mods.Common/Traits/Carryable.cs +++ b/OpenRA.Mods.Common/Traits/Carryable.cs @@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Traits IDelayCarryallPickup[] delayPickups; public Actor Carrier { get; private set; } - public bool Reserved { get { return state != State.Free; } } + public bool Reserved => state != State.Free; public CPos? Destination { get; protected set; } - public bool WantsTransport { get { return Destination != null && !IsTraitDisabled; } } + public bool WantsTransport => Destination != null && !IsTraitDisabled; protected enum State { Free, Reserved, Locked } protected State state = State.Free; diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs index 2302de181a..fb14c1d4ad 100644 --- a/OpenRA.Mods.Common/Traits/Carryall.cs +++ b/OpenRA.Mods.Common/Traits/Carryall.cs @@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits } } - HashSet IOverrideAircraftLanding.LandableTerrainTypes { get { return landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes; } } + HashSet IOverrideAircraftLanding.LandableTerrainTypes => landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes; public virtual bool AttachCarryable(Actor self, Actor carryable) { @@ -399,8 +399,8 @@ namespace OpenRA.Mods.Common.Traits readonly AircraftInfo aircraftInfo; readonly CarryallInfo info; - public string OrderID { get { return "DeliverUnit"; } } - public int OrderPriority { get { return 6; } } + public string OrderID => "DeliverUnit"; + public int OrderPriority => 6; public bool IsQueued { get; protected set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 5b41024b9f..310dec35bd 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits base.Created(self); } - public bool Cloaked { get { return !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0; } } + public bool Cloaked => !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0; public void Uncloak() { Uncloak(Info.CloakDelay); } diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs index 213683e62f..94b2197e42 100644 --- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits yield return r; } - bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } } + bool IRenderAnnotations.SpatiallyPartitionable => true; IEnumerable RenderArmaments(Actor self, AttackBase attack) { diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index 93f5288610..2e68bddf20 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits int deployedToken = Actor.InvalidConditionToken; int undeployedToken = Actor.InvalidConditionToken; - public DeployState DeployState { get { return deployState; } } + public DeployState DeployState => deployState; public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs index c45e082d97..cb6fcd2d91 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs @@ -79,6 +79,6 @@ namespace OpenRA.Mods.Common.Traits } Color ISelectionBar.GetColor() { return info.SelectionBarColor; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 4691f771ca..97984ea043 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits return new ReadOnlyDictionary(occupied); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits self.Dispose(); } - public CPos TopLeft { get { return Location; } } + public CPos TopLeft => Location; public (CPos, SubCell)[] OccupiedCells() { return new[] { (Location, SubCell.FullCell) }; } public WPos CenterPosition { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs b/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs index b8e76f49ee..ef03985d10 100644 --- a/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs @@ -101,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits } } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true; } } diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index 966bfac323..dcbc8ff058 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Dictionary Conditions = null; [GrantedConditionReference] - public IEnumerable LinterConditions { get { return Conditions.Values; } } + public IEnumerable LinterConditions => Conditions.Values; [Desc("Image for the level up sprite.")] public readonly string LevelUpImage = null; @@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits GiveExperience(initialExperience, info.SuppressLevelupAnimation); } - public bool CanGainLevel { get { return Level < MaxLevel; } } + public bool CanGainLevel => Level < MaxLevel; public void GiveLevels(int numLevels, bool silent = false) { diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index 44b1bc7576..24e28d7006 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -214,9 +214,9 @@ namespace OpenRA.Mods.Common.Traits return null; } - public bool IsFull { get { return contents.Values.Sum() == Info.Capacity; } } - public bool IsEmpty { get { return contents.Values.Sum() == 0; } } - public int Fullness { get { return contents.Values.Sum() * 100 / Info.Capacity; } } + public bool IsFull => contents.Values.Sum() == Info.Capacity; + public bool IsEmpty => contents.Values.Sum() == 0; + public int Fullness => contents.Values.Sum() * 100 / Info.Capacity; void UpdateCondition(Actor self) { @@ -366,8 +366,8 @@ namespace OpenRA.Mods.Common.Traits class HarvestOrderTargeter : IOrderTargeter { - public string OrderID { get { return "Harvest"; } } - public int OrderPriority { get { return 10; } } + public string OrderID => "Harvest"; + public int OrderPriority => 10; public bool IsQueued { get; protected set; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } diff --git a/OpenRA.Mods.Common/Traits/Health.cs b/OpenRA.Mods.Common/Traits/Health.cs index ba402b5b68..ff4d8f505e 100644 --- a/OpenRA.Mods.Common/Traits/Health.cs +++ b/OpenRA.Mods.Common/Traits/Health.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits throw new YamlException("Actors with Health need at least one HitShape trait!"); } - int IHealthInfo.MaxHP { get { return HP; } } + int IHealthInfo.MaxHP => HP; IEnumerable IEditorActorOptions.ActorOptions(ActorInfo ai, World world) { @@ -78,10 +78,10 @@ namespace OpenRA.Mods.Common.Traits DisplayHP = hp; } - public int HP { get { return hp; } } + public int HP => hp; public int MaxHP { get; private set; } - public bool IsDead { get { return hp <= 0; } } + public bool IsDead => hp <= 0; public bool RemoveOnDeath = true; public DamageState DamageState diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs index f590d3c819..b756bacc2d 100644 --- a/OpenRA.Mods.Common/Traits/HitShape.cs +++ b/OpenRA.Mods.Common/Traits/HitShape.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits base.Created(self); } - bool ITargetablePositions.AlwaysEnabled { get { return Info.RequiresCondition == null; } } + bool ITargetablePositions.AlwaysEnabled => Info.RequiresCondition == null; IEnumerable ITargetablePositions.TargetablePositions(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index 60b6ae69e7..4f2e0dda86 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits return new ReadOnlyDictionary(occupied); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { @@ -73,13 +73,13 @@ namespace OpenRA.Mods.Common.Traits [Sync] public WAngle Facing { - get { return orientation.Yaw; } - set { orientation = orientation.WithYaw(value); } + get => orientation.Yaw; + set => orientation = orientation.WithYaw(value); } - public WRot Orientation { get { return orientation; } } + public WRot Orientation => orientation; - public WAngle TurnSpeed { get { return WAngle.Zero; } } + public WAngle TurnSpeed => WAngle.Zero; public Husk(ActorInitializer init, HuskInfo info) { @@ -175,8 +175,8 @@ namespace OpenRA.Mods.Common.Traits } // We return self.Owner if there's no effective owner - bool IEffectiveOwner.Disguised { get { return true; } } - Player IEffectiveOwner.Owner { get { return effectiveOwner; } } + bool IEffectiveOwner.Disguised => true; + Player IEffectiveOwner.Owner => effectiveOwner; } public class HuskSpeedInit : ValueActorInit, ISingleInstanceInit diff --git a/OpenRA.Mods.Common/Traits/Immobile.cs b/OpenRA.Mods.Common/Traits/Immobile.cs index 1d9692c984..e30f43123a 100644 --- a/OpenRA.Mods.Common/Traits/Immobile.cs +++ b/OpenRA.Mods.Common/Traits/Immobile.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits return new ReadOnlyDictionary(occupied); } - bool IOccupySpaceInfo.SharesCell { get { return false; } } + bool IOccupySpaceInfo.SharesCell => false; } class Immobile : IOccupySpace, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld @@ -52,8 +52,8 @@ namespace OpenRA.Mods.Common.Traits occupied = new (CPos, SubCell)[0]; } - public CPos TopLeft { get { return location; } } - public WPos CenterPosition { get { return position; } } + public CPos TopLeft => location; + public WPos CenterPosition => position; public (CPos, SubCell)[] OccupiedCells() { return occupied; } void INotifyAddedToWorld.AddedToWorld(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs index 0f00e48af4..b8171c7721 100644 --- a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs +++ b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs @@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Traits [Sync] int panicStartedTick; - bool Panicking { get { return panicStartedTick > 0; } } + bool Panicking => panicStartedTick > 0; - bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return Panicking; } } - string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.PanicSequencePrefix; } } + bool IRenderInfantrySequenceModifier.IsModifyingSequence => Panicking; + string IRenderInfantrySequenceModifier.SequencePrefix => info.PanicSequencePrefix; public ScaredyCat(Actor self, ScaredyCatInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs index de47497494..e86ea52d70 100644 --- a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs +++ b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs @@ -58,10 +58,10 @@ namespace OpenRA.Mods.Common.Traits [Sync] int remainingDuration = 0; - bool IsProne { get { return !IsTraitDisabled && remainingDuration != 0; } } + bool IsProne => !IsTraitDisabled && remainingDuration != 0; - bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return IsProne; } } - string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.ProneSequencePrefix; } } + bool IRenderInfantrySequenceModifier.IsModifyingSequence => IsProne; + string IRenderInfantrySequenceModifier.SequencePrefix => info.ProneSequencePrefix; public TakeCover(ActorInitializer init, TakeCoverInfo info) : base(init, info) @@ -96,10 +96,7 @@ namespace OpenRA.Mods.Common.Traits localOffset = WVec.Zero; } - public override bool HasAchievedDesiredFacing - { - get { return true; } - } + public override bool HasAchievedDesiredFacing => true; int IDamageModifier.GetDamageModifier(Actor attacker, Damage damage) { diff --git a/OpenRA.Mods.Common/Traits/IsometricSelectable.cs b/OpenRA.Mods.Common/Traits/IsometricSelectable.cs index 3834cb7faf..cbc6681739 100644 --- a/OpenRA.Mods.Common/Traits/IsometricSelectable.cs +++ b/OpenRA.Mods.Common/Traits/IsometricSelectable.cs @@ -54,9 +54,9 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new IsometricSelectable(init.Self, this); } - int ISelectableInfo.Priority { get { return Priority; } } - SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } } - string ISelectableInfo.Voice { get { return Voice; } } + int ISelectableInfo.Priority => Priority; + SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers; + string ISelectableInfo.Voice => Voice; public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai) { @@ -136,6 +136,6 @@ namespace OpenRA.Mods.Common.Traits return Bounds(self, wr); } - string ISelectable.Class { get { return selectionClass; } } + string ISelectable.Class => selectionClass; } } diff --git a/OpenRA.Mods.Common/Traits/JamsMissiles.cs b/OpenRA.Mods.Common/Traits/JamsMissiles.cs index 01ed19f138..d0a61ab555 100644 --- a/OpenRA.Mods.Common/Traits/JamsMissiles.cs +++ b/OpenRA.Mods.Common/Traits/JamsMissiles.cs @@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits public class JamsMissiles : ConditionalTrait { - public WDist Range { get { return IsTraitDisabled ? WDist.Zero : Info.Range; } } - public PlayerRelationship DeflectionStances { get { return Info.DeflectionRelationships; } } - public int Chance { get { return Info.Chance; } } + public WDist Range => IsTraitDisabled ? WDist.Zero : Info.Range; + public PlayerRelationship DeflectionStances => Info.DeflectionRelationships; + public int Chance => Info.Chance; public JamsMissiles(JamsMissilesInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index b40428128b..a50af6b4b3 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits return new ReadOnlyDictionary(new Dictionary() { { location, subCell } }); } - bool IOccupySpaceInfo.SharesCell { get { return LocomotorInfo.SharesCell; } } + bool IOccupySpaceInfo.SharesCell => LocomotorInfo.SharesCell; IEnumerable IEditorActorOptions.ActorOptions(ActorInfo ai, World world) { @@ -159,10 +159,7 @@ namespace OpenRA.Mods.Common.Traits MovementType movementTypes; public MovementType CurrentMovementTypes { - get - { - return movementTypes; - } + get => movementTypes; set { @@ -195,30 +192,28 @@ namespace OpenRA.Mods.Common.Traits public bool TurnToMove; public bool IsBlocking { get; private set; } - public bool IsMovingBetweenCells - { - get { return FromCell != ToCell; } - } + public bool IsMovingBetweenCells => FromCell != ToCell; #region IFacing [Sync] public WAngle Facing { - get { return orientation.Yaw; } - set { orientation = orientation.WithYaw(value); } + get => orientation.Yaw; + set => orientation = orientation.WithYaw(value); } - public WRot Orientation { get { return orientation; } } + public WRot Orientation => orientation; + + public WAngle TurnSpeed => Info.TurnSpeed; - public WAngle TurnSpeed { get { return Info.TurnSpeed; } } #endregion [Sync] - public CPos FromCell { get { return fromCell; } } + public CPos FromCell => fromCell; [Sync] - public CPos ToCell { get { return toCell; } } + public CPos ToCell => toCell; [Sync] public int PathHash; // written by Move.EvalPath, to temporarily debug this crap. @@ -232,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits [Sync] public WPos CenterPosition { get; private set; } - public CPos TopLeft { get { return ToCell; } } + public CPos TopLeft => ToCell; public (CPos, SubCell)[] OccupiedCells() { @@ -989,8 +984,8 @@ namespace OpenRA.Mods.Common.Traits rejectMove = !self.AcceptsOrder("Move"); } - public string OrderID { get { return "Move"; } } - public int OrderPriority { get { return 4; } } + public string OrderID => "Move"; + public int OrderPriority => 4; public bool IsQueued { get; protected set; } public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs index 7a2735d4ce..0c5308fb80 100644 --- a/OpenRA.Mods.Common/Traits/Passenger.cs +++ b/OpenRA.Mods.Common/Traits/Passenger.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Dictionary CargoConditions = new Dictionary(); [GrantedConditionReference] - public IEnumerable LinterCargoConditions { get { return CargoConditions.Values; } } + public IEnumerable LinterCargoConditions => CargoConditions.Values; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs index 4548eb6e4f..ad8806f4f5 100644 --- a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs @@ -95,13 +95,13 @@ namespace OpenRA.Mods.Common.Traits [Sync] bool buildAnywhere; - public bool FastCharge { get { return Enabled && fastCharge; } } - public bool AllTech { get { return Enabled && allTech; } } - public bool FastBuild { get { return Enabled && fastBuild; } } - public bool DisableShroud { get { return Enabled && disableShroud; } } - public bool PathDebug { get { return Enabled && pathDebug; } } - public bool UnlimitedPower { get { return Enabled && unlimitedPower; } } - public bool BuildAnywhere { get { return Enabled && buildAnywhere; } } + public bool FastCharge => Enabled && fastCharge; + public bool AllTech => Enabled && allTech; + public bool FastBuild => Enabled && fastBuild; + public bool DisableShroud => Enabled && disableShroud; + public bool PathDebug => Enabled && pathDebug; + public bool UnlimitedPower => Enabled && unlimitedPower; + public bool BuildAnywhere => Enabled && buildAnywhere; bool enableAll; @@ -275,6 +275,6 @@ namespace OpenRA.Mods.Common.Traits Game.Debug("Cheat used: {0} by {1}{2}", order.OrderString, self.Owner.PlayerName, debugSuffix); } - bool IUnlocksRenderPlayer.RenderPlayerUnlocked { get { return Enabled; } } + bool IUnlocksRenderPlayer.RenderPlayerUnlocked => Enabled; } } diff --git a/OpenRA.Mods.Common/Traits/Player/DummyBot.cs b/OpenRA.Mods.Common/Traits/Player/DummyBot.cs index 9309cdb119..3103025af2 100644 --- a/OpenRA.Mods.Common/Traits/Player/DummyBot.cs +++ b/OpenRA.Mods.Common/Traits/Player/DummyBot.cs @@ -23,9 +23,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Internal id for this bot.")] public readonly string Type = null; - string IBotInfo.Type { get { return Type; } } + string IBotInfo.Type => Type; - string IBotInfo.Name { get { return Name; } } + string IBotInfo.Name => Name; public override object Create(ActorInitializer init) { return new DummyBot(this); } } @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits void IBot.QueueOrder(Order order) { } - IBotInfo IBot.Info { get { return info; } } - Player IBot.Player { get { return player; } } + IBotInfo IBot.Info => info; + Player IBot.Player => player; } } diff --git a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs index ada02395b7..2e126c2d06 100644 --- a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs +++ b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs @@ -276,7 +276,7 @@ namespace OpenRA.Mods.Common.Traits { readonly ObjectivesPanelInfo info; public ObjectivesPanel(ObjectivesPanelInfo info) { this.info = info; } - public string PanelName { get { return info.PanelName; } } - public int ExitDelay { get { return info.ExitDelay; } } + public string PanelName => info.PanelName; + public int ExitDelay => info.ExitDelay; } } diff --git a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs index e558b3e8e9..4595634af2 100644 --- a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs +++ b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs @@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")] public readonly int MinOrderQuotientPerTick = 5; - string IBotInfo.Type { get { return Type; } } + string IBotInfo.Type => Type; - string IBotInfo.Name { get { return Name; } } + string IBotInfo.Name => Name; public override object Create(ActorInitializer init) { return new ModularBot(this, init); } } @@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits IBotTick[] tickModules; IBotRespondToAttack[] attackResponseModules; - IBotInfo IBot.Info { get { return info; } } - Player IBot.Player { get { return player; } } + IBotInfo IBot.Info => info; + Player IBot.Player => player; public ModularBot(ModularBotInfo info, ActorInitializer init) { diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs b/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs index 41a315f1a3..bc5241af7a 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs @@ -81,10 +81,7 @@ namespace OpenRA.Mods.Common.Traits }); } - public (int Left, int Right) this[MPos uv] - { - get { return terrainColor[uv]; } - } + public (int Left, int Right) this[MPos uv] => terrainColor[uv]; public static (int Left, int Right) GetColor(Map map, MPos uv) { diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index 26f6b87774..d140e6f9d4 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -31,13 +31,7 @@ namespace OpenRA.Mods.Common.Traits public int OrderCount; - public int Experience - { - get - { - return experience != null ? experience.Experience : 0; - } - } + 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); diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 09df74d13d..550b0e9927 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits protected DeveloperMode developerMode; protected TechTree techTree; - public Actor Actor { get { return self; } } + public Actor Actor => self; [Sync] public bool Enabled { get; protected set; } @@ -603,14 +603,9 @@ namespace OpenRA.Mods.Common.Traits public int TotalTime { get; private set; } public int RemainingTime { get; private set; } public int RemainingCost { get; private set; } - public int RemainingTimeActual - { - get - { - return (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime : - RemainingTime * Queue.Info.LowPowerModifier / 100; - } - } + public int RemainingTimeActual => + (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime : + RemainingTime * Queue.Info.LowPowerModifier / 100; public bool Paused { get; private set; } public bool Done { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs index 0be4aa671b..c7d836a36c 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs @@ -37,15 +37,9 @@ namespace OpenRA.Mods.Common.Traits static readonly string[] NoPrerequisites = new string[0]; - public string Name { get { return info.Name; } } + public string Name => info.Name; - public IEnumerable ProvidesPrerequisites - { - get - { - return enabled ? info.Prerequisites : NoPrerequisites; - } - } + public IEnumerable ProvidesPrerequisites => enabled ? info.Prerequisites : NoPrerequisites; public ProvidesTechPrerequisite(ProvidesTechPrerequisiteInfo info, ActorInitializer init) { diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index d3d7efc867..00dc4a9dda 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -66,15 +66,12 @@ namespace OpenRA.Mods.Common.Traits shortGame = player.World.WorldActor.Trait().ShortGame; } - public IEnumerable AllPoints - { - get { return player.World.ActorsHavingTrait(); } - } + public IEnumerable AllPoints => player.World.ActorsHavingTrait(); - public int Total { get { return AllPoints.Count(); } } + public int Total => AllPoints.Count(); int Owned { get { return AllPoints.Count(a => a.Owner.RelationshipWith(player) == PlayerRelationship.Ally); } } - public bool Holding { get { return Owned >= info.RatioRequired * Total / 100; } } + public bool Holding => Owned >= info.RatioRequired * Total / 100; void ITick.Tick(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Player/TechTree.cs b/OpenRA.Mods.Common/Traits/Player/TechTree.cs index 02934ef144..4be7b3bfac 100644 --- a/OpenRA.Mods.Common/Traits/Player/TechTree.cs +++ b/OpenRA.Mods.Common/Traits/Player/TechTree.cs @@ -106,12 +106,12 @@ namespace OpenRA.Mods.Common.Traits return ret; } - public Player Owner { get { return player; } } + public Player Owner => player; class Watcher { public readonly string Key; - public ITechTreeElement RegisteredBy { get { return watcher; } } + public ITechTreeElement RegisteredBy => watcher; // Strings may be either actor type, or "alternate name" key readonly string[] prerequisites; diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs index 80acd261d6..ecedfd5112 100644 --- a/OpenRA.Mods.Common/Traits/Pluggable.cs +++ b/OpenRA.Mods.Common/Traits/Pluggable.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int EditorDisplayOrder = 5; [GrantedConditionReference] - public IEnumerable LinterConditions { get { return Conditions.Values; } } + public IEnumerable LinterConditions => Conditions.Values; [ConsumedConditionReference] public IEnumerable ConsumedConditions diff --git a/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs b/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs index 6a9e422fc3..6c93458ab2 100644 --- a/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs +++ b/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits return Color.Yellow; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; public void UpdateStatus(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs index 5b5b00e24c..505d15d1ca 100644 --- a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs +++ b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs @@ -37,14 +37,14 @@ namespace OpenRA.Mods.Common.Traits [Sync] int totalProvided; - public int PowerProvided { get { return totalProvided; } } + public int PowerProvided => totalProvided; [Sync] int totalDrained; - public int PowerDrained { get { return totalDrained; } } + public int PowerDrained => totalDrained; - public int ExcessPower { get { return totalProvided - totalDrained; } } + public int ExcessPower => totalProvided - totalDrained; public int PowerOutageRemainingTicks { get; private set; } public int PowerOutageTotalTicks { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/PowerTooltip.cs b/OpenRA.Mods.Common/Traits/PowerTooltip.cs index 72d6734b92..3e028d64b1 100644 --- a/OpenRA.Mods.Common/Traits/PowerTooltip.cs +++ b/OpenRA.Mods.Common/Traits/PowerTooltip.cs @@ -37,13 +37,7 @@ namespace OpenRA.Mods.Common.Traits return forPlayer == self.Owner; } - public string TooltipText - { - get - { - return "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided); - } - } + public string TooltipText => "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided); public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs index 94a26c2566..afdb8ceb47 100644 --- a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs +++ b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits public class ProximityCapturable : ITick, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged { public readonly Player OriginalOwner; - public bool Captured { get { return Self.Owner != OriginalOwner; } } + public bool Captured => Self.Owner != OriginalOwner; public ProximityCapturableInfo Info; public Actor Self; diff --git a/OpenRA.Mods.Common/Traits/RejectsOrders.cs b/OpenRA.Mods.Common/Traits/RejectsOrders.cs index b374175bfe..79ebfe48bd 100644 --- a/OpenRA.Mods.Common/Traits/RejectsOrders.cs +++ b/OpenRA.Mods.Common/Traits/RejectsOrders.cs @@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits public class RejectsOrders : ConditionalTrait { - public HashSet Reject { get { return Info.Reject; } } - public HashSet Except { get { return Info.Except; } } + public HashSet Reject => Info.Reject; + public HashSet Except => Info.Except; public RejectsOrders(RejectsOrdersInfo info) : base(info) { } diff --git a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs index 50722c01c6..79d94b3b67 100644 --- a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs @@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits.Render } Color ISelectionBar.GetColor() { return info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs index 79ffff1d56..813df37329 100644 --- a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs @@ -78,6 +78,6 @@ namespace OpenRA.Mods.Common.Traits } } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs index 422d2e3943..b7ccabf155 100644 --- a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs +++ b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs @@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits yield return new SpriteRenderable(n.Tile, n.Target.CenterPosition, WVec.Zero, -511, pal, 1f, 1f, float3.Ones, TintModifiers.IgnoreWorldTint, true); } - bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } } + bool IRenderAboveShroud.SpatiallyPartitionable => false; IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr) { @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits return renderableCache.ToArray(); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; } public static class LineTargetExts diff --git a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs index b91fcf795f..a7ebe25e01 100644 --- a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render } Color ISelectionBar.GetColor() { return Info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { diff --git a/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs b/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs index d320898b2c..c746a78fd8 100644 --- a/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs @@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render } Color ISelectionBar.GetColor() { return info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs b/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs index d10cb44ba4..0c8aa38205 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs @@ -98,6 +98,6 @@ namespace OpenRA.Mods.Common.Traits.Render yield return new TextAnnotationRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true; } } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs index d7eaa3e1f4..11b2e1eb61 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits.Render info.BorderWidth); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; void ITick.Tick(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs index 2ccdcedba0..3767b8a742 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs @@ -84,6 +84,6 @@ namespace OpenRA.Mods.Common.Traits } } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs index 4d2b651a00..6b9bc1c45c 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs @@ -123,6 +123,6 @@ namespace OpenRA.Mods.Common.Traits.Render return RangeCircleRenderables(wr); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs index 6b3167d00b..44c491d07b 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs @@ -96,6 +96,6 @@ namespace OpenRA.Mods.Common.Traits return RangeCircleRenderables(self, wr); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index c43042e262..6b656555c7 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -118,13 +118,7 @@ namespace OpenRA.Mods.Common.Traits.Render PaletteReference = null; } - public bool IsVisible - { - get - { - return Animation.DisableFunc == null || !Animation.DisableFunc(); - } - } + public bool IsVisible => Animation.DisableFunc == null || !Animation.DisableFunc(); public bool Tick() { diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs index 2bff688bf5..4693708076 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs @@ -164,7 +164,8 @@ namespace OpenRA.Mods.Common.Traits.Render yield return c.ScreenBounds(pos, wr, Info.Scale); } - public string Image { get { return Info.Image ?? self.Info.Name; } } + public string Image => Info.Image ?? self.Info.Name; + public void Add(ModelAnimation m) { components.Add(m); diff --git a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs index 5b5c480bfe..86f6bc129f 100644 --- a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits.Render return DrawDecorations(self, wr); } - bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } } + bool IRenderAnnotations.SpatiallyPartitionable => true; IEnumerable DrawDecorations(Actor self, WorldRenderer wr) { diff --git a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs index b954209987..900dd2fbae 100644 --- a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render } Color ISelectionBar.GetColor() { return Info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { diff --git a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs index 4eff59a164..efc34fc6f1 100644 --- a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render value = duration > 0 ? remaining * 1f / duration : 0; } - string IConditionTimerWatcher.Condition { get { return info.Condition; } } + string IConditionTimerWatcher.Condition => info.Condition; float ISelectionBar.GetValue() { @@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render } Color ISelectionBar.GetColor() { return info.Color; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs b/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs index 4cc1d24af7..a00f68e901 100644 --- a/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs @@ -69,8 +69,9 @@ namespace OpenRA.Mods.Common.Traits.Render } } - Sprite IProductionIconOverlay.Sprite { get { return sprite; } } - string IProductionIconOverlay.Palette { get { return info.Palette; } } + Sprite IProductionIconOverlay.Sprite => sprite; + string IProductionIconOverlay.Palette => info.Palette; + float2 IProductionIconOverlay.Offset(float2 iconSize) { var x = (sprite.Size.X - iconSize.X) / 2; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs index 84097c9d5f..c8c321326d 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs @@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits.Render return true; } - bool IDecoration.RequiresSelection { get { return Info.RequiresSelection; } } + bool IDecoration.RequiresSelection => Info.RequiresSelection; protected abstract IEnumerable RenderDecoration(Actor self, WorldRenderer wr, int2 pos); diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs index 5baefdb9f7..d194f59b22 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits.Render AnimationState state; IRenderInfantrySequenceModifier rsm; - bool IsModifyingSequence { get { return rsm != null && rsm.IsModifyingSequence; } } + bool IsModifyingSequence => rsm != null && rsm.IsModifyingSequence; bool wasModifying; // Allow subclasses to override the info that we use for rendering diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs index b99bc03a3e..f06e45f599 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs @@ -113,13 +113,13 @@ namespace OpenRA.Mods.Common.Traits.Render return RenderRangeCircle(self, wr, RangeCircleVisibility.WhenSelected); } - bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false; IEnumerable IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr) { return RenderRangeCircle(self, wr, RangeCircleVisibility.Always); } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs index ad15ac5820..da6e6958a9 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits.Render anim = new Animation(self.World, Info.Image); } - bool IDecoration.RequiresSelection { get { return true; } } + bool IDecoration.RequiresSelection => true; IEnumerable IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container) { diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs index 8764a4cf42..e1d2707342 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits.Render label = new CachedTransform(g => g.ToString()); } - bool IDecoration.RequiresSelection { get { return true; } } + bool IDecoration.RequiresSelection => true; IEnumerable IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container) { diff --git a/OpenRA.Mods.Common/Traits/Selectable.cs b/OpenRA.Mods.Common/Traits/Selectable.cs index c35942fdd1..d583090315 100644 --- a/OpenRA.Mods.Common/Traits/Selectable.cs +++ b/OpenRA.Mods.Common/Traits/Selectable.cs @@ -33,9 +33,9 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Selectable(init.Self, this); } - int ISelectableInfo.Priority { get { return Priority; } } - SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } } - string ISelectableInfo.Voice { get { return Voice; } } + int ISelectableInfo.Priority => Priority; + SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers; + string ISelectableInfo.Voice => Voice; } public class Selectable : Interactable, ISelectable @@ -50,6 +50,6 @@ namespace OpenRA.Mods.Common.Traits Info = info; } - string ISelectable.Class { get { return selectionClass; } } + string ISelectable.Class => selectionClass; } } diff --git a/OpenRA.Mods.Common/Traits/StoresResources.cs b/OpenRA.Mods.Common/Traits/StoresResources.cs index ef7edf23b1..a4f618bede 100644 --- a/OpenRA.Mods.Common/Traits/StoresResources.cs +++ b/OpenRA.Mods.Common/Traits/StoresResources.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits PlayerResources player; [Sync] - public int Stored { get { return player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity); } } + public int Stored => player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity); public StoresResources(Actor self, StoresResourcesInfo info) { @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits player = self.Owner.PlayerActor.Trait(); } - int IStoreResources.Capacity { get { return info.Capacity; } } + int IStoreResources.Capacity => info.Capacity; void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index 4513e2db60..6695444c5d 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -112,10 +112,7 @@ namespace OpenRA.Mods.Common.Traits void IOrderGenerator.SelectionChanged(World world, IEnumerable selected) { } - bool IsOutsideDragZone - { - get { return dragStarted && dragDirection.Length > MinDragThreshold; } - } + bool IsOutsideDragZone => dragStarted && dragDirection.Length > MinDragThreshold; IEnumerable IOrderGenerator.Render(WorldRenderer wr, World world) { yield break; } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 5a9dbe95ce..de0f4f6b31 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -147,21 +147,16 @@ namespace OpenRA.Mods.Common.Traits public readonly int TotalTicks; protected int remainingSubTicks; - public int RemainingTicks { get { return remainingSubTicks / 100; } } + public int RemainingTicks => remainingSubTicks / 100; public bool Active { get; private set; } - public bool Disabled - { - get - { - return Manager.Self.Owner.WinState == WinState.Lost || - (!prereqsAvailable && !Manager.DevMode.AllTech) || - !instancesEnabled || - oneShotFired; - } - } + public bool Disabled => + Manager.Self.Owner.WinState == WinState.Lost || + (!prereqsAvailable && !Manager.DevMode.AllTech) || + !instancesEnabled || + oneShotFired; public SupportPowerInfo Info { get { return Instances.Select(i => i.Info).FirstOrDefault(); } } - public bool Ready { get { return Active && RemainingTicks == 0; } } + public bool Ready => Active && RemainingTicks == 0; bool instancesEnabled; bool prereqsAvailable = true; @@ -285,7 +280,7 @@ namespace OpenRA.Mods.Common.Traits readonly string cursor; readonly MouseButton expectedButton; - public string OrderKey { get { return order; } } + public string OrderKey => order; public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button) { diff --git a/OpenRA.Mods.Common/Traits/Targetable.cs b/OpenRA.Mods.Common/Traits/Targetable.cs index 21dd11c4a2..3620796d33 100644 --- a/OpenRA.Mods.Common/Traits/Targetable.cs +++ b/OpenRA.Mods.Common/Traits/Targetable.cs @@ -53,8 +53,8 @@ namespace OpenRA.Mods.Common.Traits return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner)); } - public virtual BitSet TargetTypes { get { return Info.TargetTypes; } } + public virtual BitSet TargetTypes => Info.TargetTypes; - public bool RequiresForceFire { get { return Info.RequiresForceFire; } } + public bool RequiresForceFire => Info.RequiresForceFire; } } diff --git a/OpenRA.Mods.Common/Traits/TemporaryOwnerManager.cs b/OpenRA.Mods.Common/Traits/TemporaryOwnerManager.cs index d0a13e9619..63c4c9da47 100644 --- a/OpenRA.Mods.Common/Traits/TemporaryOwnerManager.cs +++ b/OpenRA.Mods.Common/Traits/TemporaryOwnerManager.cs @@ -81,6 +81,6 @@ namespace OpenRA.Mods.Common.Traits return info.BarColor; } - bool ISelectionBar.DisplayWhenEmpty { get { return false; } } + bool ISelectionBar.DisplayWhenEmpty => false; } } diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index 056c670a27..df2176b669 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits return GenericName; } - public bool IsOwnerRowVisible { get { return ShowOwnerRow; } } + public bool IsOwnerRowVisible => ShowOwnerRow; } public class Tooltip : ConditionalTrait, ITooltip @@ -76,15 +76,9 @@ namespace OpenRA.Mods.Common.Traits readonly Actor self; readonly TooltipInfo info; - public ITooltipInfo TooltipInfo { get { return info; } } + public ITooltipInfo TooltipInfo => info; - public Player Owner - { - get - { - return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner; - } - } + public Player Owner => self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner; public Tooltip(Actor self, TooltipInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/TooltipDescription.cs b/OpenRA.Mods.Common/Traits/TooltipDescription.cs index 9cde8948fe..87e4a159c5 100644 --- a/OpenRA.Mods.Common/Traits/TooltipDescription.cs +++ b/OpenRA.Mods.Common/Traits/TooltipDescription.cs @@ -29,13 +29,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; - public Player Owner - { - get - { - return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner; - } - } + public Player Owner => self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner; public TooltipDescription(Actor self, TooltipDescriptionInfo info) : base(info) @@ -55,12 +49,6 @@ namespace OpenRA.Mods.Common.Traits return Info.ValidRelationships.HasRelationship(Owner.RelationshipWith(forPlayer)); } - public string TooltipText - { - get - { - return Info.Description; - } - } + public string TooltipText => Info.Description; } } diff --git a/OpenRA.Mods.Common/Traits/TunnelEntrance.cs b/OpenRA.Mods.Common/Traits/TunnelEntrance.cs index 0a3a053c1c..b1d5303c20 100644 --- a/OpenRA.Mods.Common/Traits/TunnelEntrance.cs +++ b/OpenRA.Mods.Common/Traits/TunnelEntrance.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public readonly CPos Entrance; public CPos? Exit { get; private set; } - public int NearEnough { get { return info.Margin; } } + public int NearEnough => info.Margin; public TunnelEntrance(Actor self, TunnelEntranceInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Turreted.cs b/OpenRA.Mods.Common/Traits/Turreted.cs index 3e79d126b6..1fd821ca13 100644 --- a/OpenRA.Mods.Common/Traits/Turreted.cs +++ b/OpenRA.Mods.Common/Traits/Turreted.cs @@ -159,8 +159,8 @@ namespace OpenRA.Mods.Common.Traits // For subclasses that want to move the turret relative to the body protected WVec localOffset = WVec.Zero; - public WVec Offset { get { return Info.Offset + localOffset; } } - public string Name { get { return Info.Turret; } } + public WVec Offset => Info.Offset + localOffset; + public string Name => Info.Turret; public Turreted(ActorInitializer init, TurretedInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/Voiced.cs b/OpenRA.Mods.Common/Traits/Voiced.cs index 7f66419844..5e821f0db2 100644 --- a/OpenRA.Mods.Common/Traits/Voiced.cs +++ b/OpenRA.Mods.Common/Traits/Voiced.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits Info = info; } - string IVoiced.VoiceSet { get { return Info.VoiceSet; } } + string IVoiced.VoiceSet => Info.VoiceSet; bool IVoiced.PlayVoice(Actor self, string phrase, string variant) { diff --git a/OpenRA.Mods.Common/Traits/World/ActorMap.cs b/OpenRA.Mods.Common/Traits/World/ActorMap.cs index a81882026c..4df65205f1 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorMap.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorMap.cs @@ -228,12 +228,9 @@ namespace OpenRA.Mods.Common.Traits } public void Reset() { throw new NotSupportedException(); } - public Actor Current - { - get { return current; } - } + public Actor Current => current; - object IEnumerator.Current { get { return current; } } + object IEnumerator.Current => current; public void Dispose() { } public bool MoveNext() { diff --git a/OpenRA.Mods.Common/Traits/World/BridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/BridgeLayer.cs index bf306afde9..55987c194a 100644 --- a/OpenRA.Mods.Common/Traits/World/BridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/BridgeLayer.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits bridges = new CellLayer(world.Map); } - public Actor this[CPos cell] { get { return bridges[cell]; } } + public Actor this[CPos cell] => bridges[cell]; public void Add(Actor b) { diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index 235594df58..a24940090a 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits .SelectMany(p => p.RenderAnnotations()); } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; public EditorActorPreview Add(ActorReference reference) { return Add(NextActorName(), reference); } diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 579e34de50..6db86f7b4c 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -30,16 +30,11 @@ namespace OpenRA.Mods.Common.Traits public readonly Rectangle Bounds; public readonly SelectionBoxAnnotationRenderable SelectionBox; - public string Tooltip - { - get - { - return (tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + Owner.Name + " (" + Owner.Faction + ")" - + "\nID: " + ID + "\nType: " + Info.Name; - } - } + public string Tooltip => + (tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + Owner.Name + " (" + Owner.Faction + ")" + + "\nID: " + ID + "\nType: " + Info.Name; - public string Type { get { return reference.Type; } } + public string Type => reference.Type; public string ID { get; set; } public PlayerReference Owner { get; set; } diff --git a/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs index ed372304c4..0b344be399 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorCursorLayer.cs @@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Traits return NoRenderables; } - bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } } + bool IRenderAboveShroud.SpatiallyPartitionable => false; public IEnumerable RenderAnnotations(Actor self, WorldRenderer wr) { @@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits return Type == EditorCursorType.Actor ? Actor.RenderAnnotations() : NoRenderables; } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; public int SetActor(WorldRenderer wr, ActorInfo actor, PlayerReference owner) { diff --git a/OpenRA.Mods.Common/Traits/World/EditorSelectionLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorSelectionLayer.cs index 711aef147e..2d5dfbefcc 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorSelectionLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorSelectionLayer.cs @@ -106,6 +106,6 @@ namespace OpenRA.Mods.Common.Traits WVec.Zero, -511, palette, 1f, pasteAlpha * info.FootprintAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); } - bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } } + bool IRenderAboveShroud.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs b/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs index c802203803..26cdc81516 100644 --- a/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ElevatedBridgeLayer.cs @@ -70,9 +70,9 @@ namespace OpenRA.Mods.Common.Traits } bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return enabled; } - byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.ElevatedBridge; } } - bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return true; } } - bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return false; } } + byte ICustomMovementLayer.Index => CustomMovementLayerType.ElevatedBridge; + bool ICustomMovementLayer.InteractsWithDefaultLayer => true; + bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => false; WPos ICustomMovementLayer.CenterOfCell(CPos cell) { diff --git a/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs b/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs index 9ac5eccb26..9f331d537d 100644 --- a/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/JumpjetActorLayer.cs @@ -63,9 +63,9 @@ namespace OpenRA.Mods.Common.Traits } bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return li is JumpjetLocomotorInfo; } - byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Jumpjet; } } - bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return true; } } - bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } } + byte ICustomMovementLayer.Index => CustomMovementLayerType.Jumpjet; + bool ICustomMovementLayer.InteractsWithDefaultLayer => true; + bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true; WPos ICustomMovementLayer.CenterOfCell(CPos cell) { diff --git a/OpenRA.Mods.Common/Traits/World/JumpjetLocomotor.cs b/OpenRA.Mods.Common/Traits/World/JumpjetLocomotor.cs index b76a0368ef..1b791e7484 100644 --- a/OpenRA.Mods.Common/Traits/World/JumpjetLocomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/JumpjetLocomotor.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Can this actor transition on slopes?")] public readonly bool JumpjetTransitionOnRamps = true; - public override bool DisableDomainPassabilityCheck { get { return true; } } + public override bool DisableDomainPassabilityCheck => true; public override object Create(ActorInitializer init) { return new JumpjetLocomotor(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/LobbyPrerequisiteCheckbox.cs b/OpenRA.Mods.Common/Traits/World/LobbyPrerequisiteCheckbox.cs index 6e13accae8..b932624f0e 100644 --- a/OpenRA.Mods.Common/Traits/World/LobbyPrerequisiteCheckbox.cs +++ b/OpenRA.Mods.Common/Traits/World/LobbyPrerequisiteCheckbox.cs @@ -72,6 +72,6 @@ namespace OpenRA.Mods.Common.Traits prerequisites = info.Prerequisites; } - IEnumerable ITechTreePrerequisite.ProvidesPrerequisites { get { return prerequisites; } } + IEnumerable ITechTreePrerequisite.ProvidesPrerequisites => prerequisites; } } diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index 18c99cd825..8fa69fb0b9 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits } } - public virtual bool DisableDomainPassabilityCheck { get { return false; } } + public virtual bool DisableDomainPassabilityCheck => false; public override object Create(ActorInitializer init) { return new Locomotor(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs index b3dc45e366..658a863297 100644 --- a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs +++ b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs @@ -54,10 +54,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool IsMusicAvailable; public readonly bool AllowMuteBackgroundMusic; - public bool IsBackgroundMusicMuted - { - get { return AllowMuteBackgroundMusic && Game.Settings.Sound.MuteBackgroundMusic; } - } + public bool IsBackgroundMusicMuted => AllowMuteBackgroundMusic && Game.Settings.Sound.MuteBackgroundMusic; public bool CurrentSongIsBackground { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromEmbeddedSpritePalette.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromEmbeddedSpritePalette.cs index 1dd70652f1..4ba3538bee 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromEmbeddedSpritePalette.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromEmbeddedSpritePalette.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new PaletteFromEmbeddedSpritePalette(this); } - string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } } + string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null; ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs index f6df7a10d9..aa94659d9e 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new PaletteFromFile(init.World, this); } - string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } } + string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null; ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromGimpOrJascFile.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromGimpOrJascFile.cs index c93b63ddcc..4bb0bbc3a6 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromGimpOrJascFile.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromGimpOrJascFile.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new PaletteFromGimpOrJascFile(init.World, this); } - string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } } + string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null; ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromPng.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromPng.cs index eab000b9a9..b4171c5ed1 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromPng.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromPng.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new PaletteFromPng(init.World, this); } - string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } } + string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null; ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem) { diff --git a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs index 1be2637a4f..95b075071f 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits protected readonly CellLayer Content; - public bool IsResourceLayerEmpty { get { return resCells < 1; } } + public bool IsResourceLayerEmpty => resCells < 1; int resCells; diff --git a/OpenRA.Mods.Common/Traits/World/Selection.cs b/OpenRA.Mods.Common/Traits/World/Selection.cs index b03dbb7930..29b95e886d 100644 --- a/OpenRA.Mods.Common/Traits/World/Selection.cs +++ b/OpenRA.Mods.Common/Traits/World/Selection.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public class Selection : ISelection, INotifyCreated, INotifyOwnerChanged, ITick, IGameSaveTraitData { public int Hash { get; private set; } - public IEnumerable Actors { get { return actors; } } + public IEnumerable Actors => actors; readonly HashSet actors = new HashSet(); World world; diff --git a/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs b/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs index 17920550e8..e04b0fafc7 100644 --- a/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SubterraneanActorLayer.cs @@ -62,9 +62,9 @@ namespace OpenRA.Mods.Common.Traits } bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return li is SubterraneanLocomotorInfo; } - byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Subterranean; } } - bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return false; } } - bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } } + byte ICustomMovementLayer.Index => CustomMovementLayerType.Subterranean; + bool ICustomMovementLayer.InteractsWithDefaultLayer => false; + bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true; WPos ICustomMovementLayer.CenterOfCell(CPos cell) { diff --git a/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs b/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs index f20e8ba51c..6a505c9654 100644 --- a/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/SubterraneanLocomotor.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Depth at which the subterranian condition is applied.")] public readonly WDist SubterraneanTransitionDepth = new WDist(-1024); - public override bool DisableDomainPassabilityCheck { get { return true; } } + public override bool DisableDomainPassabilityCheck => true; public override object Create(ActorInitializer init) { return new SubterraneanLocomotor(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs b/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs index 5f0b52f7ce..8610ca6377 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs @@ -95,6 +95,6 @@ namespace OpenRA.Mods.Common.Traits } } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/Traits/World/TerrainRenderer.cs b/OpenRA.Mods.Common/Traits/World/TerrainRenderer.cs index d0bac0689e..b60d0179a5 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainRenderer.cs @@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits disposed = true; } - Sprite ITiledTerrainRenderer.MissingTile { get { return tileCache.MissingTile; } } + Sprite ITiledTerrainRenderer.MissingTile => tileCache.MissingTile; Sprite ITiledTerrainRenderer.TileSprite(TerrainTile r, int? variant) { diff --git a/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs b/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs index 361b993dff..0824e75c4b 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainTunnelLayer.cs @@ -69,9 +69,9 @@ namespace OpenRA.Mods.Common.Traits } bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return enabled; } - byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Tunnel; } } - bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return false; } } - bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } } + byte ICustomMovementLayer.Index => CustomMovementLayerType.Tunnel; + bool ICustomMovementLayer.InteractsWithDefaultLayer => false; + bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true; WPos ICustomMovementLayer.CenterOfCell(CPos cell) { diff --git a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs index 8eb1467a04..5e1e223315 100644 --- a/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WarheadDebugOverlay.cs @@ -34,10 +34,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Color Color; public int Time; - public WDist OuterRange - { - get { return Range[Range.Length - 1]; } - } + public WDist OuterRange => Range[Range.Length - 1]; public WHImpact(WPos pos, WDist[] range, int time, Color color) { @@ -83,6 +80,6 @@ namespace OpenRA.Mods.Common.Traits impacts.RemoveAll(i => i.Time == 0); } - bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } + bool IRenderAnnotations.SpatiallyPartitionable => false; } } diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20191117/ReplaceAttackTypeStrafe.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20191117/ReplaceAttackTypeStrafe.cs index b23910f3b5..e5c4ce85dd 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20191117/ReplaceAttackTypeStrafe.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20191117/ReplaceAttackTypeStrafe.cs @@ -16,17 +16,13 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ReplaceAttackTypeStrafe : UpdateRule { - public override string Name { get { return "Replaced AttackAircraft AttackType: Strafe logic."; } } - public override string Description - { - get - { - return "The AttackType: Strafe behaviour on AttackAircraft has been renamed to Default,\n" - + "and AttackTurnDelay has been removed. A new AttackType: Strafe has been added, with a\n" - + "new StrafeRunLength parameter, designed for use with the FirstBurstTargetOffset and\n" - + "FollowingBurstTargetOffset weapon parameters."; - } - } + public override string Name => "Replaced AttackAircraft AttackType: Strafe logic."; + + public override string Description => + "The AttackType: Strafe behaviour on AttackAircraft has been renamed to Default,\n" + + "and AttackTurnDelay has been removed. A new AttackType: Strafe has been added, with a\n" + + "new StrafeRunLength parameter, designed for use with the FirstBurstTargetOffset and\n" + + "FollowingBurstTargetOffset weapon parameters."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs index c0f0a527a5..0dc47ffb96 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/AddResourceRenderer.cs @@ -16,15 +16,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class AddResourceRenderer : UpdateRule { - public override string Name - { - get { return "Add ResourceRenderer trait"; } - } + public override string Name => "Add ResourceRenderer trait"; - public override string Description - { - get { return "The rendering parts of ResourceLayer have been moved to a new trait"; } - } + public override string Description => "The rendering parts of ResourceLayer have been moved to a new trait"; readonly List locations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs index cb62482d7a..cc5223c6b9 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/CreateScreenShakeWarhead.cs @@ -17,15 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class CreateScreenShakeWarhead : UpdateRule { - public override string Name { get { return "Create ScreenShakeWarhead to replace hardcoded shaking."; } } + public override string Name => "Create ScreenShakeWarhead to replace hardcoded shaking."; - public override string Description - { - get - { - return "The traits MadTank and NukePower (via the NukeLaunch projectile that it uses) no longer have built-in screen shaking."; - } - } + public override string Description => "The traits MadTank and NukePower (via the NukeLaunch projectile that it uses) no longer have built-in screen shaking."; readonly List> weaponsToUpdate = new List>(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs index 3b6f920288..0be1fe7df9 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/ReformatChromeProvider.cs @@ -18,16 +18,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ReformatChromeProvider : UpdateRule { - public override string Name { get { return "Reformat UI image definitions."; } } + public override string Name => "Reformat UI image definitions."; - public override string Description - { - get - { - return "The format of the chrome.yaml file defining image regions for the UI has\n" + - "changed to support additional metadata fields. "; - } - } + public override string Description => + "The format of the chrome.yaml file defining image regions for the UI has\n" + + "changed to support additional metadata fields. "; readonly List overrideLocations = new List(); readonly List panelLocations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs index 5a491dd349..6ac0546317 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveAirdropActorTypeDefault.cs @@ -17,14 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveAirdropActorTypeDefault : UpdateRule { - public override string Name { get { return "Removed internal default of ProductionAirdrop.ActorType"; } } - public override string Description - { - get - { - return "Removed internal default of 'c17' from ProductionAirdrop.ActorType."; - } - } + public override string Name => "Removed internal default of ProductionAirdrop.ActorType"; + + public override string Description => "Removed internal default of 'c17' from ProductionAirdrop.ActorType."; readonly List> missingActorTypes = new List>(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs index d92abf5cce..82446d33bc 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveInitialFacingHardcoding.cs @@ -17,14 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveInitialFacingHardcoding : UpdateRule { - public override string Name { get { return "Removed InitialFacing hardcoding for non-VTOLs"; } } - public override string Description - { - get - { - return "Removed hardcoding of InitialFacing to 192 for aircraft with VTOL: false."; - } - } + public override string Name => "Removed InitialFacing hardcoding for non-VTOLs"; + + public override string Description => "Removed hardcoding of InitialFacing to 192 for aircraft with VTOL: false."; readonly List> nonVTOLs = new List>(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs index 4709ee59fc..ed49b96da8 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveWithPermanentInjury.cs @@ -16,16 +16,12 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveWithPermanentInjury : UpdateRule { - public override string Name { get { return "WithPermanentInjury trait has been removed."; } } - public override string Description - { - get - { - return "The WithPermanentInjury trait has been removed, and should be replaced by\n" + - "TakeCover with negative ProneTime value + GrantConditionOnDamageState/-Health.\n" + - "Affected actors are listed so that these traits can be defined."; - } - } + public override string Name => "WithPermanentInjury trait has been removed."; + + public override string Description => + "The WithPermanentInjury trait has been removed, and should be replaced by\n" + + "TakeCover with negative ProneTime value + GrantConditionOnDamageState/-Health.\n" + + "Affected actors are listed so that these traits can be defined."; readonly List locations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveYesNo.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveYesNo.cs index 3c743aa600..ee43056a41 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveYesNo.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RemoveYesNo.cs @@ -15,16 +15,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveYesNo : UpdateRule { - public override string Name { get { return "Remove 'yes' and 'no' in favor of 'true' and 'false'."; } } + public override string Name => "Remove 'yes' and 'no' in favor of 'true' and 'false'."; - public override string Description - { - get - { - return "'Yes' and 'no' are no longer valid values for booleans. " + - "Use 'true' and 'false' instead."; - } - } + public override string Description => + "'Yes' and 'no' are no longer valid values for booleans. " + + "Use 'true' and 'false' instead."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameProneTime.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameProneTime.cs index 85039061fa..084b4012d7 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameProneTime.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameProneTime.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class RenameProneTime : UpdateRule { - public override string Name { get { return "Renamed ProneTime to Duration"; } } - public override string Description - { - get - { - return "Renamed TakeCover property ProneTime to Duration."; - } - } + public override string Name => "Renamed ProneTime to Duration"; + + public override string Description => "Renamed TakeCover property ProneTime to Duration."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameRallyPointPath.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameRallyPointPath.cs index 0f293ddde4..69353b59d4 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameRallyPointPath.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameRallyPointPath.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class RenameRallyPointPath : UpdateRule { - public override string Name { get { return "Renamed RallyPoint Offset to Path"; } } - public override string Description - { - get - { - return "The RallyPoint Offset property has been renamed to Path and now accepts multiple (or no) values."; - } - } + public override string Name => "Renamed RallyPoint Offset to Path"; + + public override string Description => "The RallyPoint Offset property has been renamed to Path and now accepts multiple (or no) values."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs index 78a72b56cf..54ee7522fa 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameSpins.cs @@ -16,14 +16,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameSpins : UpdateRule { - public override string Name { get { return "FallsToEarth.Spins has been refactored to MaximumSpinSpeed."; } } - public override string Description - { - get - { - return "The FallsToEarth.Spins property has been refactored to MaximumSpinSpeed."; - } - } + public override string Name => "FallsToEarth.Spins has been refactored to MaximumSpinSpeed."; + + public override string Description => "The FallsToEarth.Spins property has been refactored to MaximumSpinSpeed."; readonly List locations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs index 8775944664..60ad7bc3bc 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/AddPipDecorationTraits.cs @@ -16,21 +16,17 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class AddPipDecorationTraits : UpdateRule { - public override string Name { get { return "Add decoration traits for selection pips."; } } - public override string Description - { - get - { - return "The AmmoPool, Cargo, Harvester, and StoresResources traits no longer\n" + - "automatically add pips to the selection box. New traits WithAmmoPipsDecoration,\n" + - "WithCargoPipsDecoration, WithHarvesterPipsDecoration,\n" + - "WithResourceStoragePipsDecoration are added to provide the same functionality.\n\n" + - "Passenger.PipType has been replaced with CustomPipType, which now references a\n" + - "sequence defined in WithCargoDecoration.CustomPipTypeSequences.\n\n" + - "ResourceType.PipColor has been removed and resource pip colours are now defined\n" + - "in WithHarvesterPipsDecoration.ResourceSequences."; - } - } + public override string Name => "Add decoration traits for selection pips."; + + public override string Description => + "The AmmoPool, Cargo, Harvester, and StoresResources traits no longer\n" + + "automatically add pips to the selection box. New traits WithAmmoPipsDecoration,\n" + + "WithCargoPipsDecoration, WithHarvesterPipsDecoration,\n" + + "WithResourceStoragePipsDecoration are added to provide the same functionality.\n\n" + + "Passenger.PipType has been replaced with CustomPipType, which now references a\n" + + "sequence defined in WithCargoDecoration.CustomPipTypeSequences.\n\n" + + "ResourceType.PipColor has been removed and resource pip colours are now defined\n" + + "in WithHarvesterPipsDecoration.ResourceSequences."; static readonly Dictionary PipReplacements = new Dictionary { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ChangeTargetLineDelayToMilliseconds.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ChangeTargetLineDelayToMilliseconds.cs index 1ee410366d..72a017b284 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ChangeTargetLineDelayToMilliseconds.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ChangeTargetLineDelayToMilliseconds.cs @@ -15,15 +15,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class ChangeTargetLineDelayToMilliseconds : UpdateRule { - public override string Name { get { return "Changed DrawLineToTarget.Delay interpretation from ticks to milliseconds."; } } - public override string Description - { - get - { - return "Going forward, the value of the `Delay` attribute of the `DrawLineToTarget` trait will be\n" + - "interpreted as milliseconds instead of ticks.\n"; - } - } + public override string Name => "Changed DrawLineToTarget.Delay interpretation from ticks to milliseconds."; + + public override string Description => + "Going forward, the value of the `Delay` attribute of the `DrawLineToTarget` trait will be\n" + + "interpreted as milliseconds instead of ticks.\n"; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs index 7288323d6f..3b763d66ef 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ConvertSupportPowerRangesToFootprint.cs @@ -16,16 +16,12 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ConvertSupportPowerRangesToFootprint : UpdateRule { - public override string Name { get { return "Convert support power ranges to footprint"; } } - public override string Description - { - get - { - return "ChronoshiftPower and GrantExternalConditionPower use footprint areas\n" + - "instead of a circular range and they no longer have a fallback default area value.\n" + - "The old Range values will be converted to footprints as part of this update."; - } - } + public override string Name => "Convert support power ranges to footprint"; + + public override string Description => + "ChronoshiftPower and GrantExternalConditionPower use footprint areas\n" + + "instead of a circular range and they no longer have a fallback default area value.\n" + + "The old Range values will be converted to footprints as part of this update."; static readonly string[] AffectedTraits = new string[] { "GrantExternalConditionPower", "ChronoshiftPower" }; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs index 8e215ce359..1851ce433a 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/CreateFlashPaletteEffectWarhead.cs @@ -17,15 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class CreateFlashPaletteEffectWarhead : UpdateRule { - public override string Name { get { return "Create FlashPaletteEffectWarhead to replace hardcoded nuke flashing."; } } + public override string Name => "Create FlashPaletteEffectWarhead to replace hardcoded nuke flashing."; - public override string Description - { - get - { - return "The trait NukePower (via the NukeLaunch projectile that it uses) no longer has built-in palette flashing."; - } - } + 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>(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs index 98dfe8e349..129091c54c 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ModernizeDecorationTraits.cs @@ -18,19 +18,15 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ModernizeDecorationTraits : UpdateRule { - public override string Name { get { return "Modernize SelectionDecorations and With*Decoration traits."; } } - public override string Description - { - get - { - return "The configuration properties exposed on the SelectionDecorations and With*Decoration\n" + - "traits have been reworked. RenderSelectionBars and RenderSelectionBox have been removed from\n" + - "SelectionDecorations. The obsolete ZOffset and ScreenOffset has been removed from With*Decoration, and ReferencePoint has\n" + - "been replaced by Position which takes a single value (TopLeft, TopRight, BottomLeft, BottomRight, Center, or Top).\n" + - "A new Margin property is available to control the decoration offset relative to the edges of the selection box.\n" + - "RenderNameTag has been renamed to WithNameTagDecoration and now behaves like a normal decoration trait.\n"; - } - } + public override string Name => "Modernize SelectionDecorations and With*Decoration traits."; + + public override string Description => + "The configuration properties exposed on the SelectionDecorations and With*Decoration\n" + + "traits have been reworked. RenderSelectionBars and RenderSelectionBox have been removed from\n" + + "SelectionDecorations. The obsolete ZOffset and ScreenOffset has been removed from With*Decoration, and ReferencePoint has\n" + + "been replaced by Position which takes a single value (TopLeft, TopRight, BottomLeft, BottomRight, Center, or Top).\n" + + "A new Margin property is available to control the decoration offset relative to the edges of the selection box.\n" + + "RenderNameTag has been renamed to WithNameTagDecoration and now behaves like a normal decoration trait.\n"; static readonly string[] LegacyDecorationTraits = { "WithDecoration", "WithSpriteControlGroupDecoration", "WithTextControlGroupDecoration", "WithTextDecoration", "WithBuildingRepairDecoration", "InfiltrateForDecoration" }; static readonly string[] ModernDecorationTraits = { "WithAmmoPipsDecoration", "WithCargoPipsDecoration", "WithHarvesterPipsDecoration", "WithResourceStoragePipsDecoration", "WithNameTagDecoration" }; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs index 26925826e3..fbeec73ca4 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/MoveClassicFacingFudge.cs @@ -16,15 +16,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class MoveClassicFacingFudge : UpdateRule { - public override string Name { get { return "UseClassicFacingFudge functionality was moved to Cnc-specific sequence/coordinate code."; } } - public override string Description - { - get - { - return "UseClassicFacingFudge has been replaced with ClassicFacingBodyOrientation trait\n" + - "and Classic* variants of *Sequence loaders respectively, both located in Mods.Cnc."; - } - } + public override string Name => "UseClassicFacingFudge functionality was moved to Cnc-specific sequence/coordinate code."; + + public override string Description => + "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(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveConditionManager.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveConditionManager.cs index 4b769d1bc4..e64e0d7e5d 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveConditionManager.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveConditionManager.cs @@ -15,15 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveConditionManager : UpdateRule { - public override string Name { get { return "ConditionManager trait has been removed."; } } + public override string Name => "ConditionManager trait has been removed."; - public override string Description - { - get - { - return "ConditionManager trait has been removed. Its functionality has been integrated into the actor itself."; - } - } + public override string Description => "ConditionManager trait has been removed. Its functionality has been integrated into the actor itself."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveLaysTerrain.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveLaysTerrain.cs index 7ea30530dd..dd41d731a5 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveLaysTerrain.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveLaysTerrain.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveLaysTerrain : UpdateRule { - public override string Name { get { return "'LaysTerrain' has been removed in favor of the new 'D2kBuilding' trait."; } } - public override string Description - { - get - { - return "'LaysTerrain' was removed."; - } - } + public override string Name => "'LaysTerrain' has been removed in favor of the new 'D2kBuilding' trait."; + + public override string Description => "'LaysTerrain' was removed."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveMuzzleSplitFacings.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveMuzzleSplitFacings.cs index 7e8dc7abb1..de14497b91 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveMuzzleSplitFacings.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RemoveMuzzleSplitFacings.cs @@ -15,16 +15,12 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveMuzzleSplitFacings : UpdateRule { - public override string Name { get { return "Remove Armament.MuzzleSplitFacings."; } } - public override string Description - { - get - { - return "The legacy MuzzleSplitFacings option was removed from Armament.\n" + - "The same result can be created by using `Combine` in the sequence definitions to\n" + - "assemble the different facings sprites into a single sequence."; - } - } + public override string Name => "Remove Armament.MuzzleSplitFacings."; + + public override string Description => + "The legacy MuzzleSplitFacings option was removed from Armament.\n" + + "The same result can be created by using `Combine` in the sequence definitions to\n" + + "assemble the different facings sprites into a single sequence."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameCircleOutline.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameCircleOutline.cs index b5022a7e87..f38b8928a1 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameCircleOutline.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameCircleOutline.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameCircleContrast : UpdateRule { - public override string Name { get { return "Rename 'ContrastColor' to 'BorderColor'."; } } - public override string Description - { - get - { - return "RenderDetectionCircle and RenderShroudCircle ContrastColor have been renamed to BorderColor for consistency."; - } - } + public override string Name => "Rename 'ContrastColor' to 'BorderColor'."; + + public override string Description => "RenderDetectionCircle and RenderShroudCircle ContrastColor have been renamed to BorderColor for consistency."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameHealCrateAction.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameHealCrateAction.cs index cbfaddf916..3e3d6a37cb 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameHealCrateAction.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameHealCrateAction.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameHealCrateAction : UpdateRule { - public override string Name { get { return "Rename 'HealUnitsCrateAction' to 'HealActorsCrateAction'."; } } - public override string Description - { - get - { - return "The 'HealUnitsCrateAction' has been renamed to 'HealActorsCrateAction'."; - } - } + public override string Name => "Rename 'HealUnitsCrateAction' to 'HealActorsCrateAction'."; + + public override string Description => "The 'HealUnitsCrateAction' has been renamed to 'HealActorsCrateAction'."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameInfiltrationNotifications.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameInfiltrationNotifications.cs index b12bc0cb44..72ebf0ab8a 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameInfiltrationNotifications.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameInfiltrationNotifications.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class RenameInfiltrationNotifications : UpdateRule { - public override string Name { get { return "Renamed InfiltrateForCash Notification to InfiltratedNotification."; } } - public override string Description - { - get - { - return "The InfiltrateForCash Notification has been renamed to be in line with new notification properties added."; - } - } + public override string Name => "Renamed InfiltrateForCash Notification to InfiltratedNotification."; + + public override string Description => "The InfiltrateForCash Notification has been renamed to be in line with new notification properties added."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameSelfHealing.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameSelfHealing.cs index d35ec6cf5c..637aa66ea7 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameSelfHealing.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameSelfHealing.cs @@ -16,15 +16,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameSelfHealing : UpdateRule { - public override string Name { get { return "SelfHealing was renamed as negative SelfHealing is a common usecase."; } } - public override string Description - { - get - { - return "SelfHealing was renamed to ChangesHealth\n" + - "HealIfBelow was renamed to StartIfBelow."; - } - } + public override string Name => "SelfHealing was renamed as negative SelfHealing is a common usecase."; + + public override string Description => + "SelfHealing was renamed to ChangesHealth\n" + + "HealIfBelow was renamed to StartIfBelow."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameStances.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameStances.cs index cc8f7109ec..e7dcaac785 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameStances.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameStances.cs @@ -15,15 +15,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameStances : UpdateRule { - public override string Name { get { return "Renamed player 'Stances' to 'Relationships'."; } } - public override string Description - { - get - { - return "'Stances' in regards to a player have been renamed to 'Relationships'.\n" + - "The yaml values did not change."; - } - } + public override string Name => "Renamed player 'Stances' to 'Relationships'."; + + public override string Description => + "'Stances' in regards to a player have been renamed to 'Relationships'.\n" + + "The yaml values did not change."; readonly (string TraitName, string OldName, string NewName)[] traits = { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameWithNukeLaunch.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameWithNukeLaunch.cs index e8585c4ad8..bcde4f6245 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameWithNukeLaunch.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/RenameWithNukeLaunch.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class RenameWithNukeLaunch : UpdateRule { - public override string Name { get { return "Renamed WithNukeLaunchAnimation and Overlay"; } } - public override string Description - { - get - { - return "`WithNukeLaunchAnimation` has been renamed to `WithSupportPowerActivationAnimation` and `WithNukeLaunchOverlay` to `WithSupportPowerActivationOverlay`."; - } - } + public override string Name => "Renamed WithNukeLaunchAnimation and Overlay"; + + public override string Description => "`WithNukeLaunchAnimation` has been renamed to `WithSupportPowerActivationAnimation` and `WithNukeLaunchOverlay` to `WithSupportPowerActivationOverlay`."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceBurns.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceBurns.cs index 5fb0f17ef5..b562fbf110 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceBurns.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceBurns.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ReplaceBurns : UpdateRule { - public override string Name { get { return "Replaced Burns with separate render and health change traits."; } } - public override string Description - { - get - { - return "Burns can be replaced using WithIdleOverlay and ChangesHealth."; - } - } + public override string Name => "Replaced Burns with separate render and health change traits."; + + public override string Description => "Burns can be replaced using WithIdleOverlay and ChangesHealth."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs index 16d4e8dde4..7473e89fa8 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/ReplaceFacingAngles.cs @@ -56,7 +56,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { "Missile", new[] { "HorizontalRateOfTurn", "VerticalRateOfTurn" } } }; - public override string Name { get { return "Increase facing angle resolution"; } } + public override string Name => "Increase facing angle resolution"; + public override string Description { get diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SpawnActorPowerDefaultEffect.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SpawnActorPowerDefaultEffect.cs index 44b6839db0..8619fa062b 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SpawnActorPowerDefaultEffect.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SpawnActorPowerDefaultEffect.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class SpawnActorPowerDefaultEffect : UpdateRule { - public override string Name { get { return "Set SpawnActorPower EffectSequence to it's previous default value."; } } - public override string Description - { - get - { - return "The 'EffectSequence' of 'SpawnActorPower' is unset by default."; - } - } + public override string Name => "Set SpawnActorPower EffectSequence to it's previous default value."; + + public override string Description => "The 'EffectSequence' of 'SpawnActorPower' is unset by default."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SplitDamagedByTerrain.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SplitDamagedByTerrain.cs index e4af88d3d6..f0982e61d4 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SplitDamagedByTerrain.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/SplitDamagedByTerrain.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class SplitDamagedByTerrain : UpdateRule { - public override string Name { get { return "Several properties of 'DamagedByTerrain' have been moved to the new 'D2kBuilding' trait."; } } - public override string Description - { - get - { - return "'DamageThreshold' and 'StartOnThreshold' are no longer supported and removed from 'DamagedByTerrain'."; - } - } + public override string Name => "Several properties of 'DamagedByTerrain' have been moved to the new 'D2kBuilding' trait."; + + public override string Description => "'DamageThreshold' and 'StartOnThreshold' are no longer supported and removed from 'DamagedByTerrain'."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateMapInits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateMapInits.cs index 1438fd4028..3b8a6f55d6 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateMapInits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateMapInits.cs @@ -15,7 +15,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class UpdateMapInits : UpdateRule { - public override string Name { get { return "Update map actor definitions"; } } + public override string Name => "Update map actor definitions"; + public override string Description { get diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateTilesetColors.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateTilesetColors.cs index ce9b70e370..e5fa53326f 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateTilesetColors.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200503/UpdateTilesetColors.cs @@ -15,14 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { class UpdateTilesetColors : UpdateRule { - public override string Name { get { return "Rename Tileset LeftColor and RightColor"; } } - public override string Description - { - get - { - return "The LeftColor and RightColor keys in tilesets have been renamed to MinColor and MaxColor to reflect their proper usage."; - } - } + public override string Name => "Rename Tileset LeftColor and RightColor"; + + public override string Description => "The LeftColor and RightColor keys in tilesets have been renamed to MinColor and MaxColor to reflect their proper usage."; public override IEnumerable UpdateTilesetNode(ModData modData, MiniYamlNode tilesetNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs index bfe37d3425..a72853f8f2 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlaceBuildingPalette.cs @@ -16,17 +16,12 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemovePlaceBuildingPalette : UpdateRule { - public override string Name { get { return "*PlaceBuildingPreview palette overrides have been removed."; } } + public override string Name => "*PlaceBuildingPreview palette overrides have been removed."; - public override string Description - { - get - { - return "The palette overrides on the ActorPreviewPlaceBuildingPreview, FootprintPlaceBuildingPreview\n" + - "SequencePlaceBuildingPreview, and D2kActorPreviewPlaceBuildingPreview traits have been removed.\n" + - "New Alpha and LineBuildSegmentAlpha properties have been added in their place."; - } - } + public override string Description => + "The palette overrides on the ActorPreviewPlaceBuildingPreview, FootprintPlaceBuildingPreview\n" + + "SequencePlaceBuildingPreview, and D2kActorPreviewPlaceBuildingPreview traits have been removed.\n" + + "New Alpha and LineBuildSegmentAlpha properties have been added in their place."; readonly List locations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlayerHighlightPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlayerHighlightPalette.cs index 8e7fe02102..190262540f 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlayerHighlightPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemovePlayerHighlightPalette.cs @@ -15,15 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemovePlayerHighlightPalette : UpdateRule { - public override string Name { get { return "PlayerHighlightPalette trait has been removed."; } } + public override string Name => "PlayerHighlightPalette trait has been removed."; - public override string Description - { - get - { - return "PlayerHighlightPalette trait has been removed. Its functionality is now automatically provided by the engine."; - } - } + public override string Description => "PlayerHighlightPalette trait has been removed. Its functionality is now automatically provided by the engine."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveRenderSpritesScale.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveRenderSpritesScale.cs index cd0194f15d..de90451b54 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveRenderSpritesScale.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RemoveRenderSpritesScale.cs @@ -15,15 +15,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveRenderSpritesScale : UpdateRule { - public override string Name { get { return "Remove RenderSprites.Scale."; } } + public override string Name => "Remove RenderSprites.Scale."; - public override string Description - { - get - { - return "The Scale option was removed from RenderSprites. Scale can now be defined on individual sequence definitions."; - } - } + public override string Description => "The Scale option was removed from RenderSprites. Scale can now be defined on individual sequence definitions."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RenameMPTraits.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RenameMPTraits.cs index 3f1d83e0c9..c36235dace 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RenameMPTraits.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/RenameMPTraits.cs @@ -15,16 +15,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameMPTraits : UpdateRule { - public override string Name { get { return "Several traits spawning map actors and players have been renamed."; } } + public override string Name => "Several traits spawning map actors and players have been renamed."; - public override string Description - { - get - { - return "'SpawnMPUnits' was renamed to 'SpawnStartingUnits', 'MPStartUnits' to 'StartingUnits', 'MPStartLocations' to " + - "'MapStartingLocations', and 'CreateMPPlayers' to 'CreateMapPlayers'."; - } - } + public override string Description => + "'SpawnMPUnits' was renamed to 'SpawnStartingUnits', 'MPStartUnits' to 'StartingUnits', 'MPStartLocations' to " + + "'MapStartingLocations', and 'CreateMPPlayers' to 'CreateMapPlayers'."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs index 6df0946baa..45d9eefd8d 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceShadowPalette.cs @@ -16,16 +16,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ReplaceShadowPalette : UpdateRule { - public override string Name { get { return "Removed ShadowPalette from WithShadow and projectiles."; } } + public override string Name => "Removed ShadowPalette from WithShadow and projectiles."; - public override string Description - { - get - { - return "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."; - } - } + public override string Description => + "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(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs index 4156688b55..6d5e8e7376 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20201213/ReplaceWithColoredOverlayPalette.cs @@ -16,15 +16,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class ReplaceWithColoredOverlayPalette : UpdateRule { - public override string Name { get { return "WithColoredOverlay Palette changed to Color."; } } + public override string Name => "WithColoredOverlay Palette changed to Color."; - public override string Description - { - get - { - return "The Palette field has been removed from WithColoredOverlay. You must now specify the Color directly."; - } - } + public override string Description => "The Palette field has been removed from WithColoredOverlay. You must now specify the Color directly."; readonly List locations = new List(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs b/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs index 9d4b8f015e..c2a53531d5 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/CopyIsometricSelectableHeight.cs @@ -17,15 +17,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class CopyIsometricSelectableHeight : UpdateRule { - public override string Name { get { return "Copy IsometricSelectable.Height from art*.ini definitions."; } } - public override string Description - { - get - { - return "Reads building Height entries art.ini/artfs.ini/artmd.ini from the current working directory\n" + - "and adds IsometricSelectable definitions to matching actors."; - } - } + public override string Name => "Copy IsometricSelectable.Height from art*.ini definitions."; + + public override string Description => + "Reads building Height entries art.ini/artfs.ini/artmd.ini from the current working directory\n" + + "and adds IsometricSelectable definitions to matching actors."; static readonly string[] SourceFiles = { "art.ini", "artfs.ini", "artmd.ini" }; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/RemoveTurnToDock.cs b/OpenRA.Mods.Common/UpdateRules/Rules/RemoveTurnToDock.cs index 48a145e99c..ccb3f384ec 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/RemoveTurnToDock.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/RemoveTurnToDock.cs @@ -17,15 +17,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RemoveTurnToDock : UpdateRule { - public override string Name { get { return "TurnToDock is removed from the Aircraft trait."; } } - public override string Description - { - get - { - return "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."; - } - } + public override string Name => "TurnToDock is removed from the Aircraft trait."; + + public override string Description => + "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>(); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/RenameSmudgeSmokeFields.cs b/OpenRA.Mods.Common/UpdateRules/Rules/RenameSmudgeSmokeFields.cs index bc6903134d..e4e03e1a02 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/RenameSmudgeSmokeFields.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/RenameSmudgeSmokeFields.cs @@ -15,15 +15,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public class RenameSmudgeSmokeFields : UpdateRule { - public override string Name { get { return "Renamed smoke-related properties on SmudgeLayer."; } } - public override string Description - { - get - { - return "Renamed smoke-related properties on SmudgeLayer to be in line with comparable properties.\n" + - "Additionally, set the *Chance, *Image and *Sequences defaults to null."; - } - } + public override string Name => "Renamed smoke-related properties on SmudgeLayer."; + + public override string Description => + "Renamed smoke-related properties on SmudgeLayer to be in line with comparable properties.\n" + + "Additionally, set the *Chance, *Image and *Sequences defaults to null."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) { diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs b/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs index 4a352ebe9f..2d6a16ad75 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class CheckConditionalTraitInterfaceOverrides : IUtilityCommand { - string IUtilityCommand.Name { get { return "--check-conditional-trait-interface-overrides"; } } + string IUtilityCommand.Name => "--check-conditional-trait-interface-overrides"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckExplicitInterfacesCommand.cs b/OpenRA.Mods.Common/UtilityCommands/CheckExplicitInterfacesCommand.cs index bbd71f16e8..5fb9cca503 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckExplicitInterfacesCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckExplicitInterfacesCommand.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class CheckExplicitInterfacesCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--check-explicit-interfaces"; } } + string IUtilityCommand.Name => "--check-explicit-interfaces"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckMissingSprites.cs b/OpenRA.Mods.Common/UtilityCommands/CheckMissingSprites.cs index 5435ce6749..7a8eb251f7 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckMissingSprites.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckMissingSprites.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class CheckMissingSprites : IUtilityCommand { - string IUtilityCommand.Name { get { return "--check-missing-sprites"; } } + string IUtilityCommand.Name => "--check-missing-sprites"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs index 495e24fa4d..853ab975b5 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckYaml.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class CheckYaml : IUtilityCommand { - string IUtilityCommand.Name { get { return "--check-yaml"; } } + string IUtilityCommand.Name => "--check-yaml"; static int errors = 0; diff --git a/OpenRA.Mods.Common/UtilityCommands/ConvertSpriteToPngCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ConvertSpriteToPngCommand.cs index c9ef635645..ce73153686 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ConvertSpriteToPngCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ConvertSpriteToPngCommand.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ConvertSpriteToPngCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--png"; } } + string IUtilityCommand.Name => "--png"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/CreateManPage.cs b/OpenRA.Mods.Common/UtilityCommands/CreateManPage.cs index 23f91c4914..1eadb8789d 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CreateManPage.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CreateManPage.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class CreateManPage : IUtilityCommand { - string IUtilityCommand.Name { get { return "--man-page"; } } + string IUtilityCommand.Name => "--man-page"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs b/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs index 11fe0e4a12..886a445c77 100644 --- a/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs +++ b/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class DebugChromeRegions : IUtilityCommand { - string IUtilityCommand.Name { get { return "--debug-chrome-regions"; } } + string IUtilityCommand.Name => "--debug-chrome-regions"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/DumpSequenceSheetsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/DumpSequenceSheetsCommand.cs index aed5a95931..145d08d864 100644 --- a/OpenRA.Mods.Common/UtilityCommands/DumpSequenceSheetsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/DumpSequenceSheetsCommand.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { static readonly int[] ChannelMasks = { 2, 1, 0, 3 }; - string IUtilityCommand.Name { get { return "--dump-sequence-sheets"; } } + string IUtilityCommand.Name => "--dump-sequence-sheets"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractFilesCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractFilesCommand.cs index ca7ab86782..c870bbdbc2 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractFilesCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractFilesCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ExtractFilesCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--extract"; } } + string IUtilityCommand.Name => "--extract"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs index 038307d127..3368f36e60 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ExtractLuaDocsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--lua-docs"; } } + string IUtilityCommand.Name => "--lua-docs"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractMapRules.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractMapRules.cs index 8493c30be8..03af36c835 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractMapRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractMapRules.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class ExtractMapRules : IUtilityCommand { - string IUtilityCommand.Name { get { return "--map-rules"; } } + string IUtilityCommand.Name => "--map-rules"; bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length == 2; } void MergeAndPrint(Map map, string key, MiniYaml value) diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs index 3ec611b816..7196dd062f 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractSettingsDocsCommand.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ExtractSettingsDocsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--settings-docs"; } } + string IUtilityCommand.Name => "--settings-docs"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs index 2e6e223d92..6e847aaa33 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ExtractTraitDocsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--docs"; } } + string IUtilityCommand.Name => "--docs"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs index 5acabd1d31..1ddfa70517 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractWeaponDocsCommand.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ExtractWeaponDocsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--weapon-docs"; } } + string IUtilityCommand.Name => "--weapon-docs"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs index c2ea88ab4d..432d14e30c 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractZeroBraneStudioLuaAPI.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.UtilityCommands // See https://studio.zerobrane.com/doc-api-auto-complete for reference class ExtractZeroBraneStudioLuaAPI : IUtilityCommand { - string IUtilityCommand.Name { get { return "--zbstudio-lua-api"; } } + string IUtilityCommand.Name => "--zbstudio-lua-api"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/GetMapHashCommand.cs b/OpenRA.Mods.Common/UtilityCommands/GetMapHashCommand.cs index b42e8477a7..71d3f388a8 100644 --- a/OpenRA.Mods.Common/UtilityCommands/GetMapHashCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/GetMapHashCommand.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class GetMapHashCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--map-hash"; } } + string IUtilityCommand.Name => "--map-hash"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldCabContentsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldCabContentsCommand.cs index fea41e0cba..3641d0ea05 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldCabContentsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldCabContentsCommand.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ListInstallShieldCabContentsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--list-installshield-cab"; } } + string IUtilityCommand.Name => "--list-installshield-cab"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldContentsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldContentsCommand.cs index ccc658bd7d..ba70df5374 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldContentsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ListInstallShieldContentsCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ListInstallShieldContents : IUtilityCommand { - string IUtilityCommand.Name { get { return "--list-installshield"; } } + string IUtilityCommand.Name => "--list-installshield"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ListMSCabContentsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ListMSCabContentsCommand.cs index 642e19e31f..d4358b1307 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ListMSCabContentsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ListMSCabContentsCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ListMSCabContentsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--list-mscab"; } } + string IUtilityCommand.Name => "--list-mscab"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedRulesCommand.cs b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedRulesCommand.cs index b383e395a5..fdbc1130c8 100644 --- a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedRulesCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedRulesCommand.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class OutputResolvedRulesCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--resolved-rules"; } } + string IUtilityCommand.Name => "--resolved-rules"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedSequencesCommand.cs b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedSequencesCommand.cs index f4d2151562..e666005546 100644 --- a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedSequencesCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedSequencesCommand.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class OutputResolvedSequencesCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--resolved-sequences"; } } + string IUtilityCommand.Name => "--resolved-sequences"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedWeaponsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedWeaponsCommand.cs index 0cd0316b9f..2208c188c0 100644 --- a/OpenRA.Mods.Common/UtilityCommands/OutputResolvedWeaponsCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/OutputResolvedWeaponsCommand.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class OutputResolvedWeaponsCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--resolved-weapons"; } } + string IUtilityCommand.Name => "--resolved-weapons"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/PngSheetExportMetadataCommand.cs b/OpenRA.Mods.Common/UtilityCommands/PngSheetExportMetadataCommand.cs index 4aa5cafe63..c037294337 100644 --- a/OpenRA.Mods.Common/UtilityCommands/PngSheetExportMetadataCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/PngSheetExportMetadataCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class PngSheetExportMetadataCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--png-sheet-export"; } } + string IUtilityCommand.Name => "--png-sheet-export"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/PngSheetImportMetadataCommand.cs b/OpenRA.Mods.Common/UtilityCommands/PngSheetImportMetadataCommand.cs index b828f1b85e..b71d0f7022 100644 --- a/OpenRA.Mods.Common/UtilityCommands/PngSheetImportMetadataCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/PngSheetImportMetadataCommand.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class PngSheetImportMetadataCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--png-sheet-import"; } } + string IUtilityCommand.Name => "--png-sheet-import"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/RefreshMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/RefreshMapCommand.cs index 23f6bc9bbe..d5c29de3f2 100644 --- a/OpenRA.Mods.Common/UtilityCommands/RefreshMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/RefreshMapCommand.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class RefreshMapCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--refresh-map"; } } + string IUtilityCommand.Name => "--refresh-map"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ReplayMetadataCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ReplayMetadataCommand.cs index f6b6514ac6..5a508e207f 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ReplayMetadataCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ReplayMetadataCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class ReplayMetadataCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--replay-metadata"; } } + string IUtilityCommand.Name => "--replay-metadata"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ResizeMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ResizeMapCommand.cs index 8f8aed24c4..ed09fc3691 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ResizeMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ResizeMapCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { public class ResizeMapCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--resize-map"; } } + string IUtilityCommand.Name => "--resize-map"; int width; int height; diff --git a/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs b/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs index 9a79ad6573..b31efd42ed 100644 --- a/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs +++ b/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs @@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.UtilityCommands { class Rgba2Hex : IUtilityCommand { - string IUtilityCommand.Name { get { return "--rgba2hex"; } } + string IUtilityCommand.Name => "--rgba2hex"; static readonly char[] Comma = new char[] { ',' }; @@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.UtilityCommands class Argb2Hex : IUtilityCommand { - string IUtilityCommand.Name { get { return "--argb2hex"; } } + string IUtilityCommand.Name => "--argb2hex"; static readonly char[] Comma = new char[] { ',' }; diff --git a/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs index ddc828e330..744b320129 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpdateMapCommand.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.UtilityCommands class UpdateMapCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--update-map"; } } + string IUtilityCommand.Name => "--update-map"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs index dc051ccab7..a6c93d39a9 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpdateModCommand.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.UtilityCommands class UpdateModCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--update-mod"; } } + string IUtilityCommand.Name => "--update-mod"; bool IUtilityCommand.ValidateArguments(string[] args) { return true; } diff --git a/OpenRA.Mods.Common/Warheads/Warhead.cs b/OpenRA.Mods.Common/Warheads/Warhead.cs index 69b19a2033..743e86274b 100644 --- a/OpenRA.Mods.Common/Warheads/Warhead.cs +++ b/OpenRA.Mods.Common/Warheads/Warhead.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Warheads [Desc("Delay in ticks before applying the warhead effect.", "0 = instant (old model).")] public readonly int Delay = 0; - int IWarhead.Delay { get { return Delay; } } + int IWarhead.Delay => Delay; [Desc("The color used for this warhead's visualization in the world's `WarheadDebugOverlay` trait.")] public readonly Color DebugOverlayColor = Color.Red; diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index 75d03b8def..04a6300ada 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -225,14 +225,9 @@ namespace OpenRA.Mods.Common.Widgets public override string GetCursor(int2 pos) { return Cursor; } - public override int2 ChildOrigin - { - get - { - return RenderOrigin + - (Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); - } - } + public override int2 ChildOrigin => + RenderOrigin + + (Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); public override void Draw() { @@ -282,7 +277,7 @@ namespace OpenRA.Mods.Common.Widgets } public override Widget Clone() { return new ButtonWidget(this); } - public virtual int UsableWidth { get { return Bounds.Width; } } + public virtual int UsableWidth => Bounds.Width; public virtual void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted) { diff --git a/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs b/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs index 77c14bb403..25915c511e 100644 --- a/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets const int LogLength = 9; List recentLines = new List(); - public override Rectangle EventBounds { get { return Rectangle.Empty; } } + public override Rectangle EventBounds => Rectangle.Empty; public override void Draw() { diff --git a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs index fa965d35f9..da3338e5e2 100644 --- a/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ColorMixerWidget.cs @@ -221,7 +221,7 @@ namespace OpenRA.Mods.Common.Widgets return true; } - public Color Color { get { return Color.FromAhsv(H, S, V); } } + public Color Color => Color.FromAhsv(H, S, V); public void Set(float hue) { diff --git a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs index 8c104e2fab..942f20db57 100644 --- a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets public override Widget Clone() { return new DropDownButtonWidget(this); } // This is crap - public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */ + public override int UsableWidth => Bounds.Width - Bounds.Height; /* space for button */ public override void Hidden() { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index b107275097..b839839d77 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -54,10 +54,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic EditorActorPreview CurrentActor { - get - { - return currentActorInner; - } + get => currentActorInner; set { @@ -438,7 +435,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } public bool IsDirty { get; private set; } - public bool ShouldDoOnSave { get { return false; } } + public bool ShouldDoOnSave => false; } public interface IEditActorHandle @@ -554,6 +551,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic } public bool IsDirty { get; private set; } - public bool ShouldDoOnSave { get { return true; } } + public bool ShouldDoOnSave => true; } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 55496b0cff..d1533cba50 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -545,10 +545,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } // HACK The height of the templates and the scrollpanel needs to be kept in synch - bool ShowScrollBar - { - get { return players.Count() + (hasTeams ? teams.Count() : 0) > 10; } - } + bool ShowScrollBar => players.Count() + (hasTeams ? teams.Count() : 0) > 10; class StatsDropDownOption { diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 7debaa0298..3f54faf2cd 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -763,19 +763,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic public string MapName; public string Faction; - public bool IsEmpty - { - get - { - return Type == default(GameType) - && Date == default(DateType) - && Duration == default(DurationType) - && Outcome == default(WinState) - && string.IsNullOrEmpty(PlayerName) - && string.IsNullOrEmpty(MapName) - && string.IsNullOrEmpty(Faction); - } - } + public bool IsEmpty => + Type == default(GameType) + && Date == default(DateType) + && Duration == default(DurationType) + && Outcome == default(WinState) + && string.IsNullOrEmpty(PlayerName) + && string.IsNullOrEmpty(MapName) + && string.IsNullOrEmpty(Faction); } enum GameType diff --git a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs index ca2887f93f..3e52b255d7 100644 --- a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs @@ -224,6 +224,6 @@ namespace OpenRA.Mods.Common.Widgets } } - public bool Loaded { get { return minimap != null; } } + public bool Loaded => minimap != null; } } diff --git a/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs b/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs index 360184fdd0..68bb31dab1 100644 --- a/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MouseAttachmentWidget.cs @@ -57,6 +57,6 @@ namespace OpenRA.Mods.Common.Widgets palette = null; } - public override int2 ChildOrigin { get { return location; } } + public override int2 ChildOrigin => location; } } diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index ebaa3c51ca..04c4870971 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -98,10 +98,7 @@ namespace OpenRA.Mods.Common.Widgets public ProductionQueue CurrentQueue { - get - { - return currentQueue; - } + get => currentQueue; set { currentQueue = value; @@ -112,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets } } - public override Rectangle EventBounds { get { return eventBounds; } } + public override Rectangle EventBounds => eventBounds; Dictionary icons = new Dictionary(); Animation cantBuild, clock; Rectangle eventBounds = Rectangle.Empty; @@ -206,10 +203,7 @@ namespace OpenRA.Mods.Common.Widgets IconRowOffset--; } - public bool CanScrollUp - { - get { return IconRowOffset > 0; } - } + public bool CanScrollUp => IconRowOffset > 0; public void ScrollToTop() { diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs index 9f57694b2f..f636824dc2 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs @@ -147,10 +147,7 @@ namespace OpenRA.Mods.Common.Widgets public string QueueGroup { - get - { - return queueGroup; - } + get => queueGroup; set { @@ -162,10 +159,7 @@ namespace OpenRA.Mods.Common.Widgets public ProductionQueue CurrentQueue { - get - { - return paletteWidget.Value.CurrentQueue; - } + get => paletteWidget.Value.CurrentQueue; set { diff --git a/OpenRA.Mods.Common/Widgets/ScrollPanelWidget.cs b/OpenRA.Mods.Common/Widgets/ScrollPanelWidget.cs index 57c6f93aae..76b4f7d432 100644 --- a/OpenRA.Mods.Common/Widgets/ScrollPanelWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ScrollPanelWidget.cs @@ -230,13 +230,7 @@ namespace OpenRA.Mods.Common.Widgets Game.Renderer.DisableScissor(); } - public override int2 ChildOrigin - { - get - { - return RenderOrigin + new int2(ScrollBar == ScrollBar.Left ? ScrollbarWidth : 0, (int)currentListOffset); - } - } + public override int2 ChildOrigin => RenderOrigin + new int2(ScrollBar == ScrollBar.Left ? ScrollbarWidth : 0, (int)currentListOffset); public override bool EventBoundsContains(int2 location) { @@ -268,10 +262,7 @@ namespace OpenRA.Mods.Common.Widgets SetListOffset(value, smooth); } - public bool ScrolledToBottom - { - get { return targetListOffset == Math.Min(0, Bounds.Height - ContentHeight) || ContentHeight <= Bounds.Height; } - } + public bool ScrolledToBottom => targetListOffset == Math.Min(0, Bounds.Height - ContentHeight) || ContentHeight <= Bounds.Height; void ScrollToItem(Widget item, bool smooth = false) { diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index 2c503df382..619a262f25 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets HotkeyReference[] hotkeys; Rectangle eventBounds; - public override Rectangle EventBounds { get { return eventBounds; } } + public override Rectangle EventBounds => eventBounds; SpriteFont overlayFont; float2 iconOffset, holdOffset, readyOffset, timeOffset; diff --git a/OpenRA.Mods.Common/Widgets/TerrainTemplatePreviewWidget.cs b/OpenRA.Mods.Common/Widgets/TerrainTemplatePreviewWidget.cs index e0d80067ac..96c35cc118 100644 --- a/OpenRA.Mods.Common/Widgets/TerrainTemplatePreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/TerrainTemplatePreviewWidget.cs @@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Widgets public TerrainTemplateInfo Template { - get - { - return template; - } + get => template; set { diff --git a/OpenRA.Mods.Common/Widgets/TextFieldWidget.cs b/OpenRA.Mods.Common/Widgets/TextFieldWidget.cs index 0b0b3be49f..67f1926425 100644 --- a/OpenRA.Mods.Common/Widgets/TextFieldWidget.cs +++ b/OpenRA.Mods.Common/Widgets/TextFieldWidget.cs @@ -23,10 +23,7 @@ namespace OpenRA.Mods.Common.Widgets string text = ""; public string Text { - get - { - return text; - } + get => text; set { @@ -46,10 +43,7 @@ namespace OpenRA.Mods.Common.Widgets TextFieldType type = TextFieldType.General; public TextFieldType Type { - get - { - return type; - } + get => type; set { diff --git a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs index 3c96f24205..2133ce2d9c 100644 --- a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs @@ -24,8 +24,8 @@ namespace OpenRA.Mods.Common.Widgets public bool DrawOverlay = true; public bool Skippable = true; - public bool Paused { get { return paused; } } - public IVideo Video { get { return video; } } + public bool Paused => paused; + public IVideo Video => video; Sprite videoSprite, overlaySprite; Sheet overlaySheet; diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index f67f416ee0..c9d72f605f 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -302,14 +302,9 @@ namespace OpenRA.Mods.Common.Widgets return null; } - bool IsJoystickScrolling - { - get - { - return joystickScrollStart.HasValue && joystickScrollEnd.HasValue && - (joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.MouseScrollDeadzone; - } - } + bool IsJoystickScrolling => + joystickScrollStart.HasValue && joystickScrollEnd.HasValue && + (joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.MouseScrollDeadzone; public override bool HandleMouseInput(MouseInput mi) { diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs index b2d8938c94..d8995e269d 100644 --- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs @@ -35,13 +35,7 @@ namespace OpenRA.Mods.Common.Widgets int2 dragStart, mousePos; bool isDragging = false; - bool IsValidDragbox - { - get - { - return isDragging && (dragStart - mousePos).Length > Game.Settings.Game.SelectionDeadzone; - } - } + bool IsValidDragbox => isDragging && (dragStart - mousePos).Length > Game.Settings.Game.SelectionDeadzone; [ObjectCreator.UseCtor] public WorldInteractionControllerWidget(World world, WorldRenderer worldRenderer) diff --git a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs index 51e733d482..0f0fe5060c 100644 --- a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs +++ b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.D2k.PackageLoaders } public string Name { get; private set; } - public IEnumerable Contents { get { return index.Keys; } } + public IEnumerable Contents => index.Keys; readonly Stream s; readonly Dictionary index = new Dictionary(); diff --git a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs index bff53665e4..38e1700b5e 100644 --- a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs +++ b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs @@ -22,12 +22,12 @@ namespace OpenRA.Mods.D2k.SpriteLoaders { class R8Frame : ISpriteFrame { - public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } } + public SpriteFrameType Type => SpriteFrameType.Indexed8; public Size Size { get; private set; } public Size FrameSize { get; private set; } public float2 Offset { get; private set; } public byte[] Data { get; set; } - public bool DisableExportPadding { get { return true; } } + public bool DisableExportPadding => true; public readonly uint[] Palette = null; diff --git a/OpenRA.Mods.D2k/UtilityCommands/ImportD2kMapCommand.cs b/OpenRA.Mods.D2k/UtilityCommands/ImportD2kMapCommand.cs index 65826145fb..4ee31e14da 100644 --- a/OpenRA.Mods.D2k/UtilityCommands/ImportD2kMapCommand.cs +++ b/OpenRA.Mods.D2k/UtilityCommands/ImportD2kMapCommand.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands { class ImportD2kMapCommand : IUtilityCommand { - string IUtilityCommand.Name { get { return "--import-d2k-map"; } } + string IUtilityCommand.Name => "--import-d2k-map"; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Platforms.Default/DummySoundEngine.cs b/OpenRA.Platforms.Default/DummySoundEngine.cs index 0964e535b0..8b5beb1514 100644 --- a/OpenRA.Platforms.Default/DummySoundEngine.cs +++ b/OpenRA.Platforms.Default/DummySoundEngine.cs @@ -15,7 +15,7 @@ namespace OpenRA.Platforms.Default { sealed class DummySoundEngine : ISoundEngine { - public bool Dummy { get { return true; } } + public bool Dummy => true; public SoundDevice[] AvailableDevices() { @@ -46,7 +46,7 @@ namespace OpenRA.Platforms.Default public float Volume { - get { return 0; } + get => 0; set { } } @@ -67,8 +67,8 @@ namespace OpenRA.Platforms.Default class NullSound : ISound { public float Volume { get; set; } - public float SeekPosition { get { return 0; } } - public bool Complete { get { return false; } } + public float SeekPosition => 0; + public bool Complete => false; public void SetPosition(WPos position) { } } diff --git a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs index 673347e479..7e1c1c0529 100644 --- a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs +++ b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs @@ -23,7 +23,7 @@ namespace OpenRA.Platforms.Default { sealed class OpenAlSoundEngine : ISoundEngine { - public bool Dummy { get { return false; } } + public bool Dummy => false; public SoundDevice[] AvailableDevices() { @@ -272,8 +272,8 @@ namespace OpenRA.Platforms.Default public float Volume { - get { return volume; } - set { AL10.alListenerf(AL10.AL_GAIN, volume = value); } + get => volume; + set => AL10.alListenerf(AL10.AL_GAIN, volume = value); } public void PauseSound(ISound sound, bool paused) @@ -380,7 +380,7 @@ namespace OpenRA.Platforms.Default uint buffer; bool disposed; - public uint Buffer { get { return buffer; } } + public uint Buffer => buffer; public int SampleRate { get; private set; } public OpenAlSoundSource(byte[] data, int byteCount, int channels, int sampleBits, int sampleRate) @@ -442,7 +442,7 @@ namespace OpenRA.Platforms.Default public float Volume { get { AL10.alGetSourcef(Source, AL10.AL_GAIN, out var volume); return volume; } - set { AL10.alSourcef(Source, AL10.AL_GAIN, value); } + set => AL10.alSourcef(Source, AL10.AL_GAIN, value); } public virtual float SeekPosition @@ -602,9 +602,6 @@ namespace OpenRA.Platforms.Default } } - public override bool Complete - { - get { return playTask.IsCompleted; } - } + public override bool Complete => playTask.IsCompleted; } } diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs b/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs index 80287f1dda..0faac1cc85 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs @@ -269,6 +269,6 @@ namespace OpenRA.Platforms.Default } } - public string GLVersion { get { return OpenGL.Version; } } + public string GLVersion => OpenGL.Version; } } diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index f9fc46c23b..b856773f35 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -25,7 +25,7 @@ namespace OpenRA.Platforms.Default readonly IGraphicsContext context; readonly Sdl2Input input; - public IGraphicsContext Context { get { return context; } } + public IGraphicsContext Context => context; readonly IntPtr window; bool disposed; @@ -93,21 +93,9 @@ namespace OpenRA.Platforms.Default } } - public int CurrentDisplay - { - get - { - return SDL.SDL_GetWindowDisplayIndex(window); - } - } + public int CurrentDisplay => SDL.SDL_GetWindowDisplayIndex(window); - public int DisplayCount - { - get - { - return SDL.SDL_GetNumVideoDisplays(); - } - } + public int DisplayCount => SDL.SDL_GetNumVideoDisplays(); public bool HasInputFocus { get; internal set; } diff --git a/OpenRA.Platforms.Default/Texture.cs b/OpenRA.Platforms.Default/Texture.cs index 944a166e0c..75186bd19f 100644 --- a/OpenRA.Platforms.Default/Texture.cs +++ b/OpenRA.Platforms.Default/Texture.cs @@ -20,17 +20,14 @@ namespace OpenRA.Platforms.Default uint texture; TextureScaleFilter scaleFilter; - public uint ID { get { return texture; } } + public uint ID => texture; public Size Size { get; private set; } bool disposed; public TextureScaleFilter ScaleFilter { - get - { - return scaleFilter; - } + get => scaleFilter; set { diff --git a/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs b/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs index 2aef6aae40..a62575793c 100644 --- a/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs +++ b/OpenRA.Platforms.Default/ThreadedGraphicsContext.cs @@ -364,13 +364,7 @@ namespace OpenRA.Platforms.Default renderThread.Join(); } - public string GLVersion - { - get - { - return Send(getGLVersion); - } - } + public string GLVersion => Send(getGLVersion); public void Clear() { @@ -473,13 +467,7 @@ namespace OpenRA.Platforms.Default disableScissor = frameBuffer.DisableScissor; } - public ITexture Texture - { - get - { - return device.Send(getTexture); - } - } + public ITexture Texture => device.Send(getTexture); public void Bind() { @@ -589,34 +577,16 @@ namespace OpenRA.Platforms.Default dispose = texture.Dispose; } - public uint ID - { - get - { - return id; - } - } + public uint ID => id; public TextureScaleFilter ScaleFilter { - get - { - return (TextureScaleFilter)device.Send(getScaleFilter); - } + get => (TextureScaleFilter)device.Send(getScaleFilter); - set - { - device.Post(setScaleFilter, value); - } + set => device.Post(setScaleFilter, value); } - public Size Size - { - get - { - return (Size)device.Send(getSize); - } - } + public Size Size => (Size)device.Send(getSize); public void SetEmpty(int width, int height) {