From 362b4aeaef0b8d1f8300f59c79c78453a7cc9046 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 26 Dec 2014 11:05:22 +1300 Subject: [PATCH] Fix variable ordering. --- OpenRA.Mods.Common/Graphics/ContrailRenderable.cs | 5 ++--- .../Traits/PaletteEffects/LightPaletteRotator.cs | 12 ++++++------ .../Traits/PaletteEffects/WaterPaletteRotation.cs | 3 +-- OpenRA.Mods.Common/Traits/Render/RenderSprites.cs | 5 ++--- OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs | 6 +++--- OpenRA.Mods.Common/Widgets/RadarWidget.cs | 9 ++++----- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs index 6d8cb2f62a..dd1cf9a8d2 100644 --- a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs @@ -19,6 +19,8 @@ namespace OpenRA.Mods.Common.Graphics public int Length { get { return trail.Length; } } readonly World world; + readonly Color color; + readonly int zOffset; // Store trail positions in a circular buffer readonly WPos[] trail; @@ -26,9 +28,6 @@ namespace OpenRA.Mods.Common.Graphics int length; int skip; - readonly Color color; - readonly int zOffset; - public ContrailRenderable(World world, Color color, int length, int skip, int zOffset) : this(world, new WPos[length], 0, 0, skip, color, zOffset) { } diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/LightPaletteRotator.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/LightPaletteRotator.cs index 6eda0e0366..504866fd8e 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/LightPaletteRotator.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/LightPaletteRotator.cs @@ -25,19 +25,19 @@ namespace OpenRA.Mods.Common.Traits class LightPaletteRotator : ITick, IPaletteModifier { - float t = 0; - public void Tick(Actor self) - { - t += .5f; - } - readonly LightPaletteRotatorInfo info; + float t = 0; public LightPaletteRotator(LightPaletteRotatorInfo info) { this.info = info; } + public void Tick(Actor self) + { + t += .5f; + } + public void AdjustPalette(IReadOnlyDictionary palettes) { foreach (var pal in palettes) diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/WaterPaletteRotation.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/WaterPaletteRotation.cs index 5187e09e23..b7db86a5fd 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/WaterPaletteRotation.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/WaterPaletteRotation.cs @@ -25,10 +25,9 @@ namespace OpenRA.Mods.Common.Traits class WaterPaletteRotation : ITick, IPaletteModifier { - float t = 0; - readonly WaterPaletteRotationInfo info; readonly World world; + float t = 0; public WaterPaletteRotation(World world, WaterPaletteRotationInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index 1b4fc5e39b..bd53469bbe 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -88,6 +88,8 @@ namespace OpenRA.Mods.Common.Traits } } + readonly RenderSpritesInfo info; + string cachedImage = null; Dictionary anims = new Dictionary(); public static Func MakeFacingFunc(Actor self) @@ -97,9 +99,6 @@ namespace OpenRA.Mods.Common.Traits return () => facing.Facing; } - readonly RenderSpritesInfo info; - string cachedImage = null; - public RenderSprites(Actor self) { info = self.Info.Traits.Get(); diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs index f505dd9834..78bbfd00a7 100644 --- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs @@ -22,12 +22,12 @@ namespace OpenRA.Mods.Common [Desc("Range between falloff steps.")] public readonly WRange Spread = new WRange(43); - [Desc("Ranges at which each Falloff step is defined. Overrides Spread.")] - public WRange[] Range = null; - [Desc("Damage percentage at each range step")] public readonly int[] Falloff = { 100, 37, 14, 5, 2, 1, 0 }; + [Desc("Ranges at which each Falloff step is defined. Overrides Spread.")] + public WRange[] Range = null; + public void InitializeRange() { if (Range != null) diff --git a/OpenRA.Mods.Common/Widgets/RadarWidget.cs b/OpenRA.Mods.Common/Widgets/RadarWidget.cs index a859fc8607..674073f29e 100644 --- a/OpenRA.Mods.Common/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/RadarWidget.cs @@ -29,6 +29,10 @@ namespace OpenRA.Mods.Common.Widgets public Action AfterClose = () => { }; public Action Animating = _ => { }; + readonly World world; + readonly WorldRenderer worldRenderer; + readonly RadarPings radarPings; + float radarMinimapHeight; int frame; bool hasRadar; @@ -46,11 +50,6 @@ namespace OpenRA.Mods.Common.Widgets Sprite shroudSprite; Shroud renderShroud; - readonly World world; - readonly WorldRenderer worldRenderer; - - readonly RadarPings radarPings; - [ObjectCreator.UseCtor] public RadarWidget(World world, WorldRenderer worldRenderer) {