From b97d1a4c6c6edb5cfc61cde086aa17866b834162 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Tue, 14 Nov 2023 19:49:11 +0000 Subject: [PATCH] Fix IDE0090 --- OpenRA.Game/CVec.cs | 16 ++++---- OpenRA.Game/Game.cs | 6 +-- OpenRA.Game/GameInformation.cs | 2 +- OpenRA.Game/Map/Map.cs | 40 +++++++++---------- OpenRA.Game/Map/MapGrid.cs | 12 +++--- OpenRA.Game/MiniYaml.cs | 2 +- OpenRA.Game/Network/GameSave.cs | 2 +- OpenRA.Game/Network/GameServer.cs | 2 +- OpenRA.Game/Network/Handshake.cs | 6 +-- OpenRA.Game/Network/LocalizedMessage.cs | 4 +- OpenRA.Game/Network/Session.cs | 2 +- OpenRA.Game/Server/Server.cs | 4 +- OpenRA.Game/World.cs | 2 +- OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs | 12 +++--- OpenRA.Mods.Cnc/Util.cs | 8 ++-- OpenRA.Mods.Common/HitShapes/Rectangle.cs | 32 +++++++-------- .../Orders/PlaceBuildingOrderGenerator.cs | 2 +- OpenRA.Mods.Common/Projectiles/AreaBeam.cs | 4 +- OpenRA.Mods.Common/Projectiles/Bullet.cs | 2 +- .../Traits/BotModules/BaseBuilderBotModule.cs | 4 +- .../Traits/BotModules/McvManagerBotModule.cs | 2 +- .../BotModules/SquadManagerBotModule.cs | 16 ++++---- .../Traits/BotModules/Squads/Squad.cs | 4 +- .../BotModules/SupportPowerBotModule.cs | 2 +- .../Traits/BotModules/UnitBuilderBotModule.cs | 4 +- .../Traits/Player/GameSaveViewportManager.cs | 2 +- .../Traits/World/ControlGroups.cs | 2 +- OpenRA.Mods.Common/Traits/World/Selection.cs | 2 +- .../20230225/ExplicitSequenceFilenames.cs | 26 ++++++------ OpenRA.Mods.Common/UpdateRules/UpdatePath.cs | 6 +-- .../Logic/Ingame/ObserverStatsLogic.cs | 2 +- .../Widgets/Logic/Lobby/LobbyLogic.cs | 2 +- .../Widgets/Logic/Lobby/LobbyUtils.cs | 6 +-- OpenRA.Server/Program.cs | 2 +- OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs | 8 ++-- 35 files changed, 125 insertions(+), 125 deletions(-) diff --git a/OpenRA.Game/CVec.cs b/OpenRA.Game/CVec.cs index e934870fd4..343e14595c 100644 --- a/OpenRA.Game/CVec.cs +++ b/OpenRA.Game/CVec.cs @@ -61,14 +61,14 @@ namespace OpenRA public static readonly CVec[] Directions = { - new CVec(-1, -1), - new CVec(-1, 0), - new CVec(-1, 1), - new CVec(0, -1), - new CVec(0, 1), - new CVec(1, -1), - new CVec(1, 0), - new CVec(1, 1), + new(-1, -1), + new(-1, 0), + new(-1, 1), + new(0, -1), + new(0, 1), + new(1, -1), + new(1, 0), + new(1, 1), }; #region Scripting interface diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 0cb379bfd3..cd94bca283 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -928,8 +928,8 @@ namespace OpenRA { var endpoints = new List { - new IPEndPoint(IPAddress.IPv6Any, settings.ListenPort), - new IPEndPoint(IPAddress.Any, settings.ListenPort) + new(IPAddress.IPv6Any, settings.ListenPort), + new(IPAddress.Any, settings.ListenPort) }; server = new Server.Server(endpoints, settings, ModData, ServerType.Multiplayer); @@ -950,7 +950,7 @@ namespace OpenRA // This would break the Restart button, which relies on the PlayerIndex always being the same for local servers var endpoints = new List { - new IPEndPoint(IPAddress.Loopback, 0) + new(IPAddress.Loopback, 0) }; server = new Server.Server(endpoints, settings, ModData, ServerType.Local); diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index 287deaa162..6845ae24f9 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -85,7 +85,7 @@ namespace OpenRA { var nodes = new List { - new MiniYamlNode("Root", FieldSaver.Save(this)) + new("Root", FieldSaver.Save(this)) }; for (var i = 0; i < Players.Count; i++) diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index b35a4a6972..67b610f6b7 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -159,26 +159,26 @@ namespace OpenRA /// Defines the order of the fields in map.yaml. static readonly MapField[] YamlFields = { - new MapField("MapFormat"), - new MapField("RequiresMod"), - new MapField("Title"), - new MapField("Author"), - new MapField("Tileset"), - new MapField("MapSize"), - new MapField("Bounds"), - new MapField("Visibility"), - new MapField("Categories"), - new MapField("LockPreview", required: false, ignoreIfValue: "False"), - new MapField("Players", "PlayerDefinitions"), - new MapField("Actors", "ActorDefinitions"), - new MapField("Rules", "RuleDefinitions", required: false), - new MapField("Translations", "TranslationDefinitions", required: false), - new MapField("Sequences", "SequenceDefinitions", required: false), - new MapField("ModelSequences", "ModelSequenceDefinitions", required: false), - new MapField("Weapons", "WeaponDefinitions", required: false), - new MapField("Voices", "VoiceDefinitions", required: false), - new MapField("Music", "MusicDefinitions", required: false), - new MapField("Notifications", "NotificationDefinitions", required: false), + new("MapFormat"), + new("RequiresMod"), + new("Title"), + new("Author"), + new("Tileset"), + new("MapSize"), + new("Bounds"), + new("Visibility"), + new("Categories"), + new("LockPreview", required: false, ignoreIfValue: "False"), + new("Players", "PlayerDefinitions"), + new("Actors", "ActorDefinitions"), + new("Rules", "RuleDefinitions", required: false), + new("Translations", "TranslationDefinitions", required: false), + new("Sequences", "SequenceDefinitions", required: false), + new("ModelSequences", "ModelSequenceDefinitions", required: false), + new("Weapons", "WeaponDefinitions", required: false), + new("Voices", "VoiceDefinitions", required: false), + new("Music", "MusicDefinitions", required: false), + new("Notifications", "NotificationDefinitions", required: false), }; // Format versions diff --git a/OpenRA.Game/Map/MapGrid.cs b/OpenRA.Game/Map/MapGrid.cs index a806edb150..cfa13b2d22 100644 --- a/OpenRA.Game/Map/MapGrid.cs +++ b/OpenRA.Game/Map/MapGrid.cs @@ -116,12 +116,12 @@ namespace OpenRA public readonly WVec[] SubCellOffsets = { - new WVec(0, 0, 0), // full cell - index 0 - new WVec(-299, -256, 0), // top left - index 1 - new WVec(256, -256, 0), // top right - index 2 - new WVec(0, 0, 0), // center - index 3 - new WVec(-299, 256, 0), // bottom left - index 4 - new WVec(256, 256, 0), // bottom right - index 5 + new(0, 0, 0), // full cell - index 0 + new(-299, -256, 0), // top left - index 1 + new(256, -256, 0), // top right - index 2 + new(0, 0, 0), // center - index 3 + new(-299, 256, 0), // bottom left - index 4 + new(256, 256, 0), // bottom right - index 5 }; public CellRamp[] Ramps { get; } diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index 7807389a7b..2425fc9679 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -209,7 +209,7 @@ namespace OpenRA var result = new List> { - new List() + new() }; var parsedLines = new List<(int Level, string Key, string Value, string Comment, MiniYamlNode.SourceLocation Location)>(); diff --git a/OpenRA.Game/Network/GameSave.cs b/OpenRA.Game/Network/GameSave.cs index 378cc3eca3..c9e81ebcef 100644 --- a/OpenRA.Game/Network/GameSave.cs +++ b/OpenRA.Game/Network/GameSave.cs @@ -238,7 +238,7 @@ namespace OpenRA.Network // Send the trait data first to guarantee that it is available when needed foreach (var kv in TraitData) { - var data = new List() { new MiniYamlNode(kv.Key.ToStringInvariant(), kv.Value) }.WriteToString(); + var data = new List() { new(kv.Key.ToStringInvariant(), kv.Value) }.WriteToString(); packetFn(0, 0, Order.FromTargetString("SaveTraitData", data, true).Serialize()); } diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs index 7e17cfb68a..b9645cd1da 100644 --- a/OpenRA.Game/Network/GameServer.cs +++ b/OpenRA.Game/Network/GameServer.cs @@ -233,7 +233,7 @@ namespace OpenRA.Network public string ToPOSTData(bool lanGame) { - var root = new List() { new MiniYamlNode("Protocol", ProtocolVersion.ToStringInvariant()) }; + var root = new List() { new("Protocol", ProtocolVersion.ToStringInvariant()) }; foreach (var field in SerializeFields) root.Add(FieldSaver.SaveField(this, field)); diff --git a/OpenRA.Game/Network/Handshake.cs b/OpenRA.Game/Network/Handshake.cs index 67d2dcd7af..ecf56b6b84 100644 --- a/OpenRA.Game/Network/Handshake.cs +++ b/OpenRA.Game/Network/Handshake.cs @@ -29,7 +29,7 @@ namespace OpenRA.Network public string Serialize() { - var data = new List { new MiniYamlNode("Handshake", FieldSaver.Save(this)) }; + var data = new List { new("Handshake", FieldSaver.Save(this)) }; return data.WriteToString(); } } @@ -79,9 +79,9 @@ namespace OpenRA.Network { var data = new List { - new MiniYamlNode("Handshake", null, + new("Handshake", null, new[] { "Mod", "Version", "Password", "Fingerprint", "AuthSignature", "OrdersProtocol" }.Select(p => FieldSaver.SaveField(this, p)).ToList()), - new MiniYamlNode("Client", FieldSaver.Save(Client)) + new("Client", FieldSaver.Save(Client)) }; return data.WriteToString(); diff --git a/OpenRA.Game/Network/LocalizedMessage.cs b/OpenRA.Game/Network/LocalizedMessage.cs index 3a0feaa9ca..5b102b497e 100644 --- a/OpenRA.Game/Network/LocalizedMessage.cs +++ b/OpenRA.Game/Network/LocalizedMessage.cs @@ -91,8 +91,8 @@ namespace OpenRA.Network { var root = new List { - new MiniYamlNode("Protocol", ProtocolVersion.ToStringInvariant()), - new MiniYamlNode("Key", key) + new("Protocol", ProtocolVersion.ToStringInvariant()), + new("Key", key) }; if (arguments != null) diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index c916e700c8..d677cd80be 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -265,7 +265,7 @@ namespace OpenRA.Network { var sessionData = new List() { - new MiniYamlNode("DisabledSpawnPoints", FieldSaver.FormatValue(DisabledSpawnPoints)) + new("DisabledSpawnPoints", FieldSaver.FormatValue(DisabledSpawnPoints)) }; foreach (var client in Clients) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 1300738e6e..931f32855e 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -1365,8 +1365,8 @@ namespace OpenRA.Server { startGameData = new List() { - new MiniYamlNode("SaveLastOrdersFrame", GameSave.LastOrdersFrame.ToStringInvariant()), - new MiniYamlNode("SaveSyncFrame", GameSave.LastSyncFrame.ToStringInvariant()) + new("SaveLastOrdersFrame", GameSave.LastOrdersFrame.ToStringInvariant()), + new("SaveSyncFrame", GameSave.LastSyncFrame.ToStringInvariant()) }.WriteToString(); } } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 1fda6873e0..c026b80be8 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -583,7 +583,7 @@ namespace OpenRA var data = tp.Trait.IssueTraitData(tp.Actor); if (data != null) { - var yaml = new List() { new MiniYamlNode(i.ToStringInvariant(), new MiniYaml("", data)) }; + var yaml = new List() { new(i.ToStringInvariant(), new MiniYaml("", data)) }; IssueOrder(Order.FromTargetString("GameSaveTraitData", yaml.WriteToString(), true)); } diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs index 5439763dd1..8c3caec0e8 100644 --- a/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs +++ b/OpenRA.Mods.Cnc/Graphics/VoxelLoader.cs @@ -88,12 +88,12 @@ namespace OpenRA.Mods.Cnc.Graphics var channelC = ChannelSelect[(int)t.Channel]; return new ModelVertex[6] { - new ModelVertex(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC), - new ModelVertex(coord(su, 0), s.Right, s.Top, t.Right, t.Top, channelP, channelC), - new ModelVertex(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC), - new ModelVertex(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC), - new ModelVertex(coord(0, sv), s.Left, s.Bottom, t.Left, t.Bottom, channelP, channelC), - new ModelVertex(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC) + new(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC), + new(coord(su, 0), s.Right, s.Top, t.Right, t.Top, channelP, channelC), + new(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC), + new(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC), + new(coord(0, sv), s.Left, s.Bottom, t.Left, t.Bottom, channelP, channelC), + new(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC) }; } diff --git a/OpenRA.Mods.Cnc/Util.cs b/OpenRA.Mods.Cnc/Util.cs index 53e0e1271f..8ba055611b 100644 --- a/OpenRA.Mods.Cnc/Util.cs +++ b/OpenRA.Mods.Cnc/Util.cs @@ -30,10 +30,10 @@ namespace OpenRA.Mods.Cnc // The actual facing associated with each sprite frame. static readonly WAngle[] SpriteFacings = { - WAngle.Zero, new WAngle(40), new WAngle(74), new WAngle(112), new WAngle(146), new WAngle(172), new WAngle(200), new WAngle(228), - new WAngle(256), new WAngle(284), new WAngle(312), new WAngle(340), new WAngle(370), new WAngle(402), new WAngle(436), new WAngle(472), - new WAngle(512), new WAngle(552), new WAngle(588), new WAngle(626), new WAngle(658), new WAngle(684), new WAngle(712), new WAngle(740), - new WAngle(768), new WAngle(796), new WAngle(824), new WAngle(852), new WAngle(882), new WAngle(914), new WAngle(948), new WAngle(984) + WAngle.Zero, new(40), new(74), new(112), new(146), new(172), new(200), new(228), + new(256), new(284), new(312), new(340), new(370), new(402), new(436), new(472), + new(512), new(552), new(588), new(626), new(658), new(684), new(712), new(740), + new(768), new(796), new(824), new(852), new(882), new(914), new(948), new(984) }; /// diff --git a/OpenRA.Mods.Common/HitShapes/Rectangle.cs b/OpenRA.Mods.Common/HitShapes/Rectangle.cs index 3f2b0f7ea1..0d39bb492a 100644 --- a/OpenRA.Mods.Common/HitShapes/Rectangle.cs +++ b/OpenRA.Mods.Common/HitShapes/Rectangle.cs @@ -73,34 +73,34 @@ namespace OpenRA.Mods.Common.HitShapes combatOverlayVertsTop = new WVec[] { - new WVec(TopLeft.X, TopLeft.Y, VerticalTopOffset), - new WVec(BottomRight.X, TopLeft.Y, VerticalTopOffset), - new WVec(BottomRight.X, BottomRight.Y, VerticalTopOffset), - new WVec(TopLeft.X, BottomRight.Y, VerticalTopOffset), + new(TopLeft.X, TopLeft.Y, VerticalTopOffset), + new(BottomRight.X, TopLeft.Y, VerticalTopOffset), + new(BottomRight.X, BottomRight.Y, VerticalTopOffset), + new(TopLeft.X, BottomRight.Y, VerticalTopOffset), }; combatOverlayVertsBottom = new WVec[] { - new WVec(TopLeft.X, TopLeft.Y, VerticalBottomOffset), - new WVec(BottomRight.X, TopLeft.Y, VerticalBottomOffset), - new WVec(BottomRight.X, BottomRight.Y, VerticalBottomOffset), - new WVec(TopLeft.X, BottomRight.Y, VerticalBottomOffset), + new(TopLeft.X, TopLeft.Y, VerticalBottomOffset), + new(BottomRight.X, TopLeft.Y, VerticalBottomOffset), + new(BottomRight.X, BottomRight.Y, VerticalBottomOffset), + new(TopLeft.X, BottomRight.Y, VerticalBottomOffset), }; combatOverlayVertsSide1 = new WVec[] { - new WVec(TopLeft.X, TopLeft.Y, VerticalBottomOffset), - new WVec(TopLeft.X, TopLeft.Y, VerticalTopOffset), - new WVec(TopLeft.X, BottomRight.Y, VerticalTopOffset), - new WVec(TopLeft.X, BottomRight.Y, VerticalBottomOffset), + new(TopLeft.X, TopLeft.Y, VerticalBottomOffset), + new(TopLeft.X, TopLeft.Y, VerticalTopOffset), + new(TopLeft.X, BottomRight.Y, VerticalTopOffset), + new(TopLeft.X, BottomRight.Y, VerticalBottomOffset), }; combatOverlayVertsSide2 = new WVec[] { - new WVec(BottomRight.X, TopLeft.Y, VerticalBottomOffset), - new WVec(BottomRight.X, TopLeft.Y, VerticalTopOffset), - new WVec(BottomRight.X, BottomRight.Y, VerticalTopOffset), - new WVec(BottomRight.X, BottomRight.Y, VerticalBottomOffset), + new(BottomRight.X, TopLeft.Y, VerticalBottomOffset), + new(BottomRight.X, TopLeft.Y, VerticalTopOffset), + new(BottomRight.X, BottomRight.Y, VerticalTopOffset), + new(BottomRight.X, BottomRight.Y, VerticalBottomOffset), }; } diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs index 90151ed091..29069742e1 100644 --- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs @@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Orders var variants = new List() { - new VariantWrapper(worldRenderer, queue, world.Map.Rules.Actors[name]) + new(worldRenderer, queue, world.Map.Rules.Actors[name]) }; foreach (var v in variants[0].ActorInfo.TraitInfos()) diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index 32955c4b64..8069c0666f 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Projectiles public class AreaBeamInfo : IProjectileInfo { [Desc("Projectile speed in WDist / tick, two values indicate a randomly picked velocity per beam.")] - public readonly WDist[] Speed = { new WDist(128) }; + public readonly WDist[] Speed = { new(128) }; [Desc("The maximum duration (in ticks) of each beam burst.")] public readonly int Duration = 10; @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly int[] Falloff = { 100, 100 }; [Desc("Ranges at which each Falloff step is defined.")] - public readonly WDist[] Range = { WDist.Zero, new WDist(int.MaxValue) }; + public readonly WDist[] Range = { WDist.Zero, new(int.MaxValue) }; [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index c517ba5f59..4861bf4903 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Projectiles public class BulletInfo : IProjectileInfo { [Desc("Projectile speed in WDist / tick, two values indicate variable velocity.")] - public readonly WDist[] Speed = { new WDist(17) }; + public readonly WDist[] Speed = { new(17) }; [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index 67ba202ec0..0cc8e75675 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -320,8 +320,8 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)), - new MiniYamlNode("DefenseCenter", FieldSaver.FormatValue(DefenseCenter)) + new("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)), + new("DefenseCenter", FieldSaver.FormatValue(DefenseCenter)) }; } diff --git a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs index ebb5b8f0ae..6433acfe2d 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs @@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)) + new("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)) }; } diff --git a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs index ca5588f8b3..f414cd66ab 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs @@ -508,20 +508,20 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("Squads", "", Squads.Select(s => new MiniYamlNode("Squad", s.Serialize())).ToList()), - new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)), - new MiniYamlNode("UnitsHangingAroundTheBase", FieldSaver.FormatValue(unitsHangingAroundTheBase + new("Squads", "", Squads.Select(s => new MiniYamlNode("Squad", s.Serialize())).ToList()), + new("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)), + new("UnitsHangingAroundTheBase", FieldSaver.FormatValue(unitsHangingAroundTheBase .Where(a => !unitCannotBeOrdered(a)) .Select(a => a.ActorID) .ToArray())), - new MiniYamlNode("ActiveUnits", FieldSaver.FormatValue(activeUnits + new("ActiveUnits", FieldSaver.FormatValue(activeUnits .Where(a => !unitCannotBeOrdered(a)) .Select(a => a.ActorID) .ToArray())), - new MiniYamlNode("RushTicks", FieldSaver.FormatValue(rushTicks)), - new MiniYamlNode("AssignRolesTicks", FieldSaver.FormatValue(assignRolesTicks)), - new MiniYamlNode("AttackForceTicks", FieldSaver.FormatValue(attackForceTicks)), - new MiniYamlNode("MinAttackForceDelayTicks", FieldSaver.FormatValue(minAttackForceDelayTicks)), + new("RushTicks", FieldSaver.FormatValue(rushTicks)), + new("AssignRolesTicks", FieldSaver.FormatValue(assignRolesTicks)), + new("AttackForceTicks", FieldSaver.FormatValue(attackForceTicks)), + new("MinAttackForceDelayTicks", FieldSaver.FormatValue(minAttackForceDelayTicks)), }; } diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs index 7afe09e31b..ac941d4277 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs @@ -137,8 +137,8 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads { var nodes = new List() { - new MiniYamlNode("Type", FieldSaver.FormatValue(Type)), - new MiniYamlNode("Units", FieldSaver.FormatValue(Units.Select(a => a.ActorID).ToArray())) + new("Type", FieldSaver.FormatValue(Type)), + new("Units", FieldSaver.FormatValue(Units.Select(a => a.ActorID).ToArray())) }; if (Target != Target.Invalid) diff --git a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs index 079fc3c7fd..f247b853b5 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs @@ -219,7 +219,7 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("WaitingPowers", "", waitingPowersNodes) + new("WaitingPowers", "", waitingPowersNodes) }; } diff --git a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs index 7964b320f4..ca0468fb8f 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs @@ -228,8 +228,8 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("QueuedBuildRequests", FieldSaver.FormatValue(queuedBuildRequests.ToArray())), - new MiniYamlNode("IdleUnitCount", FieldSaver.FormatValue(idleUnitCount)) + new("QueuedBuildRequests", FieldSaver.FormatValue(queuedBuildRequests.ToArray())), + new("IdleUnitCount", FieldSaver.FormatValue(idleUnitCount)) }; } diff --git a/OpenRA.Mods.Common/Traits/Player/GameSaveViewportManager.cs b/OpenRA.Mods.Common/Traits/Player/GameSaveViewportManager.cs index 6210d68578..89759b8732 100644 --- a/OpenRA.Mods.Common/Traits/Player/GameSaveViewportManager.cs +++ b/OpenRA.Mods.Common/Traits/Player/GameSaveViewportManager.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits var nodes = new List() { - new MiniYamlNode("Viewport", FieldSaver.FormatValue(worldRenderer.Viewport.CenterPosition)) + new("Viewport", FieldSaver.FormatValue(worldRenderer.Viewport.CenterPosition)) }; var renderPlayer = worldRenderer.World.RenderPlayer; diff --git a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs index 9022d37d30..b9b537bfb5 100644 --- a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs +++ b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs @@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Traits return new List() { - new MiniYamlNode("Groups", new MiniYaml("", groups)) + new("Groups", new MiniYaml("", groups)) }; } diff --git a/OpenRA.Mods.Common/Traits/World/Selection.cs b/OpenRA.Mods.Common/Traits/World/Selection.cs index 0dc0089829..5dfcd0f2e9 100644 --- a/OpenRA.Mods.Common/Traits/World/Selection.cs +++ b/OpenRA.Mods.Common/Traits/World/Selection.cs @@ -181,7 +181,7 @@ namespace OpenRA.Mods.Common.Traits { return new List() { - new MiniYamlNode("Selection", FieldSaver.FormatValue(Actors.Select(a => a.ActorID).ToArray())) + new("Selection", FieldSaver.FormatValue(Actors.Select(a => a.ActorID).ToArray())) }; } diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20230225/ExplicitSequenceFilenames.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20230225/ExplicitSequenceFilenames.cs index 69ea3a2b64..ca4160eb5d 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20230225/ExplicitSequenceFilenames.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20230225/ExplicitSequenceFilenames.cs @@ -103,29 +103,29 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules fromBackup = true; tilesetExtensionsNode = new List() { - new MiniYamlNodeBuilder("TEMPERAT", ".tem"), - new MiniYamlNodeBuilder("SNOW", ".sno"), - new MiniYamlNodeBuilder("INTERIOR", ".int"), - new MiniYamlNodeBuilder("DESERT", ".des"), - new MiniYamlNodeBuilder("JUNGLE", ".jun"), + new("TEMPERAT", ".tem"), + new("SNOW", ".sno"), + new("INTERIOR", ".int"), + new("DESERT", ".des"), + new("JUNGLE", ".jun"), }; break; case "ra": fromBackup = true; tilesetExtensionsNode = new List() { - new MiniYamlNodeBuilder("TEMPERAT", ".tem"), - new MiniYamlNodeBuilder("SNOW", ".sno"), - new MiniYamlNodeBuilder("INTERIOR", ".int"), - new MiniYamlNodeBuilder("DESERT", ".des"), + new("TEMPERAT", ".tem"), + new("SNOW", ".sno"), + new("INTERIOR", ".int"), + new("DESERT", ".des"), }; break; case "ts": fromBackup = true; tilesetExtensionsNode = new List() { - new MiniYamlNodeBuilder("TEMPERATE", ".tem"), - new MiniYamlNodeBuilder("SNOW", ".sno"), + new("TEMPERATE", ".tem"), + new("SNOW", ".sno"), }; break; } @@ -148,8 +148,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules fromBackup = true; tilesetCodesNode = new List() { - new MiniYamlNodeBuilder("TEMPERATE", "t"), - new MiniYamlNodeBuilder("SNOW", "a"), + new("TEMPERATE", "t"), + new("SNOW", "a"), }; } diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index dc5e42eb80..f667d8a5a7 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.UpdateRules // release-to-bleed path. static readonly UpdatePath[] Paths = { - new UpdatePath("release-20210321", "release-20230225", new UpdateRule[] + new("release-20210321", "release-20230225", new UpdateRule[] { new RenameMPTraits(), new RemovePlayerHighlightPalette(), @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.UpdateRules new UnhardcodeBaseBuilderBotModule(), }), - new UpdatePath("release-20230225", "release-20231010", new UpdateRule[] + new("release-20230225", "release-20231010", new UpdateRule[] { new TextNotificationsDisplayWidgetRemoveTime(), new RenameEngineerRepair(), @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.UpdateRules new RemoveNegativeSequenceLength(), }), - new UpdatePath("release-20231010", new UpdateRule[] + new("release-20231010", new UpdateRule[] { // bleed only changes here. new RemoveValidRelationsFromCapturable(), diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 457d7d8ba7..e43e67fc80 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var statsDropDownOptions = new StatsDropDownOption[] { - new StatsDropDownOption + new() { Title = TranslationProvider.GetString(InformationNone), IsSelected = () => activePanel == ObserverStatsPanel.None, diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 611ac12dce..4d0ac90b38 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -280,7 +280,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var botOptions = new List() { - new DropDownOption() + new() { Title = TranslationProvider.GetString(Add), IsSelected = () => false, diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 970ccb5ff7..a9e0da0f9b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -63,8 +63,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { TranslationProvider.GetString(Slot), new List { - new SlotDropDownOption(open, "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null), - new SlotDropDownOption(closed, "slot_close " + slot.PlayerReference, () => slot.Closed) + new(open, "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null), + new(closed, "slot_close " + slot.PlayerReference, () => slot.Closed) } } }; @@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new List { - new DropDownOption + new() { Title = "Kick", OnClick = onClick diff --git a/OpenRA.Server/Program.cs b/OpenRA.Server/Program.cs index 21697e1f06..7f7191f5ce 100644 --- a/OpenRA.Server/Program.cs +++ b/OpenRA.Server/Program.cs @@ -89,7 +89,7 @@ namespace OpenRA.Server // HACK: Related to the above one, initialize the translations so we can load maps with their (translated) lobby options. TranslationProvider.Initialize(modData, modData.DefaultFileSystem); - var endpoints = new List { new IPEndPoint(IPAddress.IPv6Any, settings.ListenPort), new IPEndPoint(IPAddress.Any, settings.ListenPort) }; + var endpoints = new List { new(IPAddress.IPv6Any, settings.ListenPort), new(IPAddress.Any, settings.ListenPort) }; var server = new Server(endpoints, settings, modData, ServerType.Dedicated); GC.Collect(); diff --git a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs index 472ec814c2..de8698b1de 100644 --- a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs +++ b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs @@ -98,7 +98,7 @@ namespace OpenRA.Test { // Rectangle like above, // Note: The calculations don't match for all, but do have a tolerance of 1. - shape = new PolygonShape(new int2[] { new int2(-123, -456), new int2(100, -456), new int2(100, 100), new int2(-123, 100) }); + shape = new PolygonShape(new int2[] { new(-123, -456), new(100, -456), new(100, 100), new(-123, 100) }); shape.Initialize(); Assert.That(shape.DistanceFromEdge(new WVec(10, 10, 0)).Length, @@ -121,7 +121,7 @@ namespace OpenRA.Test // Rectangle like above but reverse order // Note: The calculations don't match for all, but do have a tolerance of 1. - shape = new PolygonShape(new int2[] { new int2(-123, 100), new int2(100, 100), new int2(100, -456), new int2(-123, -456) }); + shape = new PolygonShape(new int2[] { new(-123, 100), new(100, 100), new(100, -456), new(-123, -456) }); shape.Initialize(); Assert.That(shape.DistanceFromEdge(new WVec(10, 10, 0)).Length, @@ -143,7 +143,7 @@ namespace OpenRA.Test Is.EqualTo(877)); // Right triangle taken from above by removing a point - shape = new PolygonShape(new int2[] { new int2(-123, -456), new int2(100, -456), new int2(100, 100) }); + shape = new PolygonShape(new int2[] { new(-123, -456), new(100, -456), new(100, 100) }); shape.Initialize(); Assert.That(shape.DistanceFromEdge(new WVec(10, 10, 0)).Length, @@ -171,7 +171,7 @@ namespace OpenRA.Test Is.EqualTo(878)); // Right triangle taken from above but reverse order - shape = new PolygonShape(new int2[] { new int2(100, 100), new int2(100, -456), new int2(-123, -456) }); + shape = new PolygonShape(new int2[] { new(100, 100), new(100, -456), new(-123, -456) }); shape.Initialize(); Assert.That(shape.DistanceFromEdge(new WVec(10, 10, 0)).Length,