Fixed unnecessary zero-length array allocations
Changed all currently present zero-length array allocations in the codebase to use `Array.Empty` instead.
This commit is contained in:
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var modData = Game.ModData = utility.ModData;
|
||||
|
||||
var src = args[1];
|
||||
var shadowIndex = new int[] { };
|
||||
var shadowIndex = Array.Empty<int>();
|
||||
if (args.Contains("--noshadow"))
|
||||
{
|
||||
Array.Resize(ref shadowIndex, shadowIndex.Length + 3);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine(".SH OPTIONS");
|
||||
|
||||
var sections = Game.Settings.Sections;
|
||||
sections.Add("Launch", new LaunchArguments(new Arguments(new string[0])));
|
||||
sections.Add("Launch", new LaunchArguments(new Arguments(Array.Empty<string>())));
|
||||
foreach (var section in sections.OrderBy(s => s.Key))
|
||||
{
|
||||
var fields = section.Value.GetType().GetFields();
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// HACK: The engine code assumes that Game.modData is set.
|
||||
var modData = Game.ModData = utility.ModData;
|
||||
|
||||
var palette = new ImmutablePalette(args[1], new[] { 0 }, new int[0]);
|
||||
var palette = new ImmutablePalette(args[1], new[] { 0 }, Array.Empty<int>());
|
||||
|
||||
SequenceProvider sequences = null;
|
||||
var mapPackage = new Folder(Platform.EngineDir).OpenPackage(args[2], modData.ModFiles);
|
||||
|
||||
Reference in New Issue
Block a user