From f4cb798c8b594a894af52e13dd4b42f9ec643eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 20 Jun 2012 09:51:00 +0200 Subject: [PATCH] small code optimisations as suggested --- OpenRA.FileFormats/PlayerColorRemap.cs | 5 +---- OpenRA.Game/Traits/World/PlayerColorPalette.cs | 2 +- OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenRA.FileFormats/PlayerColorRemap.cs b/OpenRA.FileFormats/PlayerColorRemap.cs index e318096952..ec07d24235 100755 --- a/OpenRA.FileFormats/PlayerColorRemap.cs +++ b/OpenRA.FileFormats/PlayerColorRemap.cs @@ -21,10 +21,7 @@ namespace OpenRA.FileFormats static int[] GetRemapRamp(int[] Ramp) { - int[] RemapRamp = new int[Ramp.Length]; - for (var i=0; i < Ramp.Length; i++) - RemapRamp[i] = Ramp[i] - Ramp[0]; - + var RemapRamp = Ramp.Select(r => r - Ramp[0]).ToArray(); return RemapRamp; } diff --git a/OpenRA.Game/Traits/World/PlayerColorPalette.cs b/OpenRA.Game/Traits/World/PlayerColorPalette.cs index 6aaf6b5fc8..bb3547aaea 100644 --- a/OpenRA.Game/Traits/World/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/World/PlayerColorPalette.cs @@ -17,7 +17,7 @@ namespace OpenRA.Traits { public readonly string BasePalette = null; public readonly string BaseName = "player"; - public readonly int[] RemapIndex = new[] {}; + public readonly int[] RemapIndex = {}; public object Create( ActorInitializer init ) { return new PlayerColorPalette( init.self.Owner, this ); } } diff --git a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj index eb480236de..8a55f226ee 100644 --- a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj +++ b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj @@ -91,7 +91,4 @@ cd "$(SolutionDir)" OpenRA.Mods.RA - - - \ No newline at end of file