diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index bf9f76206b..c20625974f 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -85,7 +85,7 @@ namespace OpenRA { var si = Info.Traits.GetOrDefault(); var size = (si != null && si.Bounds != null) ? new int2(si.Bounds[0], si.Bounds[1]) : - TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); + TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); var offset = -size / 2; if (si != null && si.Bounds != null && si.Bounds.Length > 2) diff --git a/OpenRA.Game/FileSystem/MixFile.cs b/OpenRA.Game/FileSystem/MixFile.cs index 3af93550a9..e71ea82b88 100644 --- a/OpenRA.Game/FileSystem/MixFile.cs +++ b/OpenRA.Game/FileSystem/MixFile.cs @@ -69,7 +69,7 @@ namespace OpenRA.FileSystem index = entries.ToDictionaryWithConflictLog(x => x.Hash, "{0} ({1} format, Encrypted: {2}, DataStart: {3})".F(filename, (isCncMix ? "C&C" : "RA/TS/RA2"), isEncrypted, dataStart), - null, x => "(offs={0}, len={1})".F(x.Offset, x.Length) + null, x => "(offs={0}, len={1})".F(x.Offset, x.Length) ); } diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index f0f4baed13..13d35fb9cf 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -185,7 +185,7 @@ namespace OpenRA.GameRules var cellInfo = world.GetTerrainInfo(cell); if (!ValidTargets.Intersect(cellInfo.TargetTypes).Any() - || InvalidTargets.Intersect(cellInfo.TargetTypes).Any()) + || InvalidTargets.Intersect(cellInfo.TargetTypes).Any()) return false; return true; diff --git a/OpenRA.Game/Scripting/ScriptContext.cs b/OpenRA.Game/Scripting/ScriptContext.cs index a05a4d213e..7f3eb45a75 100644 --- a/OpenRA.Game/Scripting/ScriptContext.cs +++ b/OpenRA.Game/Scripting/ScriptContext.cs @@ -71,7 +71,7 @@ namespace OpenRA.Scripting throw new InvalidOperationException("[LuaGlobal] attribute not found for global table '{0}'".F(type)); Name = names.First().Name; - Bind(new [] { this }); + Bind(new[] { this }); } } @@ -143,7 +143,7 @@ namespace OpenRA.Scripting if (ctor == null) throw new InvalidOperationException("{0} must define a constructor that takes a ScriptContext context parameter".F(b.Name)); - var binding = (ScriptGlobal)ctor.Invoke(new [] { this }); + var binding = (ScriptGlobal)ctor.Invoke(new[] { this }); using (var obj = binding.ToLuaValue(this)) registerGlobal.Call(binding.Name, obj).Dispose(); } diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs index db727001b0..e7bf57c274 100755 --- a/OpenRA.Game/Sync.cs +++ b/OpenRA.Game/Sync.cs @@ -50,7 +50,7 @@ namespace OpenRA static void EmitSyncOpcodes(Type type, ILGenerator il) { if (hashFunctions.ContainsKey(type)) - il.EmitCall(OpCodes.Call, hashFunctions[type], null); + il.EmitCall(OpCodes.Call, hashFunctions[type], null); else if (type == typeof(bool)) { var l = il.DefineLabel(); diff --git a/OpenRA.Game/Traits/Render/RenderSprites.cs b/OpenRA.Game/Traits/Render/RenderSprites.cs index 07f75fca42..741f19b1aa 100755 --- a/OpenRA.Game/Traits/Render/RenderSprites.cs +++ b/OpenRA.Game/Traits/Render/RenderSprites.cs @@ -162,8 +162,8 @@ namespace OpenRA.Traits }; foreach (var s in states) - if (state >= s.First && anim.HasSequence(s.Second+baseSequence)) - return s.Second+baseSequence; + if (state >= s.First && anim.HasSequence(s.Second + baseSequence)) + return s.Second + baseSequence; return baseSequence; } diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index c8cc65888a..db0043765c 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -113,7 +113,7 @@ namespace OpenRA.Traits void DrawTags(WorldRenderer wr, Actor self, int2 basePosition) { if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) - return; + return; var tagImages = new Animation(self.World, "pips"); var pal = wr.Palette(Info.Palette); diff --git a/OpenRA.Game/Widgets/WidgetUtils.cs b/OpenRA.Game/Widgets/WidgetUtils.cs index f355abe934..7ff7aaaf7c 100644 --- a/OpenRA.Game/Widgets/WidgetUtils.cs +++ b/OpenRA.Game/Widgets/WidgetUtils.cs @@ -107,7 +107,7 @@ namespace OpenRA.Widgets if (ps.HasFlags(PanelSides.Center) && ss[8] != null) FillRectWithSprite(new Rectangle(bounds.Left + marginLeft, bounds.Top + marginTop, bounds.Width - marginWidth, bounds.Height - marginHeight), - ss[8]); + ss[8]); // Left border if (ps.HasFlags(PanelSides.Left) && ss[2] != null) diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index a553dcf1e5..88f0cae74e 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -881,7 +881,7 @@ namespace OpenRA.Mods.RA.AI // Protected harvesters or building if ((self.HasTrait() || self.HasTrait()) && - p.Stances[e.Attacker.Owner] == Stance.Enemy) + p.Stances[e.Attacker.Owner] == Stance.Enemy) { defenseCenter = e.Attacker.Location; ProtectOwn(e.Attacker); diff --git a/OpenRA.Mods.RA/Air/HeliLand.cs b/OpenRA.Mods.RA/Air/HeliLand.cs index 0842b7201f..2b7d4ee67d 100755 --- a/OpenRA.Mods.RA/Air/HeliLand.cs +++ b/OpenRA.Mods.RA/Air/HeliLand.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Air return this; if (HeliFly.AdjustAltitude(self, helicopter, helicopter.Info.LandAltitude)) - return this; + return this; return NextActivity; } diff --git a/OpenRA.Mods.RA/AttackBomber.cs b/OpenRA.Mods.RA/AttackBomber.cs index 32716e57ad..48a219642b 100644 --- a/OpenRA.Mods.RA/AttackBomber.cs +++ b/OpenRA.Mods.RA/AttackBomber.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns)) { if (!target.IsInRange(self.CenterPosition, a.Weapon.Range)) - continue; + continue; var t = Target.FromPos(cp - new WVec(0, a.Weapon.Range.Range / 2, cp.Z).Rotate(WRot.FromFacing(f))); inAttackRange = true; diff --git a/OpenRA.Mods.RA/BridgeLayer.cs b/OpenRA.Mods.RA/BridgeLayer.cs index 2507c312a7..e09fbd2330 100644 --- a/OpenRA.Mods.RA/BridgeLayer.cs +++ b/OpenRA.Mods.RA/BridgeLayer.cs @@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA // This isn't the bridge you're looking for if (!w.Map.IsInMap(x, y) || w.Map.MapTiles.Value[x, y].Type != tile || - w.Map.MapTiles.Value[x, y].Index != ind) + w.Map.MapTiles.Value[x, y].Index != ind) continue; subTiles.Add(new CPos(x, y), ind); diff --git a/OpenRA.Mods.RA/InfiltrateForExploration.cs b/OpenRA.Mods.RA/InfiltrateForExploration.cs index ef007a59f6..42d8a0443f 100644 --- a/OpenRA.Mods.RA/InfiltrateForExploration.cs +++ b/OpenRA.Mods.RA/InfiltrateForExploration.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA // Steal and reset the owners exploration infiltrator.Owner.Shroud.Explore(self.Owner.Shroud); if (!self.Owner.HasFogVisibility()) - self.Owner.Shroud.ResetExploration(); + self.Owner.Shroud.ResetExploration(); } } } diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index 0ede504b3f..3766c103a9 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -217,7 +217,7 @@ namespace OpenRA.Mods.RA.Move public void SetPosition(Actor self, CPos cell) { - SetLocation(cell,fromSubCell, cell,fromSubCell); + SetLocation(cell, fromSubCell, cell, fromSubCell); SetVisualPosition(self, fromCell.CenterPosition + MobileInfo.SubCellOffsets[fromSubCell]); FinishedMoving(self); } @@ -225,7 +225,7 @@ namespace OpenRA.Mods.RA.Move public void SetPosition(Actor self, WPos pos) { var cell = pos.ToCPos(); - SetLocation(cell,fromSubCell, cell,fromSubCell); + SetLocation(cell, fromSubCell, cell, fromSubCell); SetVisualPosition(self, pos); FinishedMoving(self); } @@ -355,14 +355,14 @@ namespace OpenRA.Mods.RA.Move public string VoicePhraseForOrder(Actor self, Order order) { - switch( order.OrderString ) + switch (order.OrderString) { - case "Move": - case "Scatter": - case "Stop": - return "Move"; - default: - return null; + case "Move": + case "Scatter": + case "Stop": + return "Move"; + default: + return null; } } @@ -390,7 +390,7 @@ namespace OpenRA.Mods.RA.Move return new[]{ fromSubCell, SubCell.TopLeft, SubCell.TopRight, SubCell.Center, SubCell.BottomLeft, SubCell.BottomRight}.First(b => { - var blockingActors = self.World.ActorMap.GetUnitsAt(a,b).Where(c => c != ignoreActor); + var blockingActors = self.World.ActorMap.GetUnitsAt(a, b).Where(c => c != ignoreActor); if (blockingActors.Any()) { // Non-sharable unit can enter a cell with shareable units only if it can crush all of them @@ -577,5 +577,5 @@ namespace OpenRA.Mods.RA.Move var facing = Util.GetFacing(toPos - fromPos, Facing); return Util.SequenceActivities(new Turn(facing), new Drag(fromPos, toPos, length)); } - } + } } diff --git a/OpenRA.Mods.RA/PlayerExts.cs b/OpenRA.Mods.RA/PlayerExts.cs index 72c4acde42..84d2248d28 100644 --- a/OpenRA.Mods.RA/PlayerExts.cs +++ b/OpenRA.Mods.RA/PlayerExts.cs @@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA { public static bool HasFogVisibility( this Player a ) { - var gpsWatcher = a.PlayerActor.TraitOrDefault(); + var gpsWatcher = a.PlayerActor.TraitOrDefault(); return gpsWatcher != null && (gpsWatcher.Granted || gpsWatcher.GrantedAllies); } diff --git a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs index 4678af3399..0cf4587222 100644 --- a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA { var position = self.CenterPosition; if (position.Z > 0 && self.GetDamageState() >= info.MinDamage && - !self.World.FogObscures(position.ToCPos())) + !self.World.FogObscures(position.ToCPos())) { var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation)); var pos = position + body.LocalToWorld(offset); diff --git a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs index aab32e1ba1..6b8dd1a4ce 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs @@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic panel.Get("TIME_LABEL").GetText = () => (currentSong == null) ? "" : "{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60, - currentSong.Length / 60, currentSong.Length % 60); + currentSong.Length / 60, currentSong.Length % 60); var musicSlider = panel.Get("MUSIC_SLIDER"); musicSlider.OnChange += x => Sound.MusicVolume = x; diff --git a/OpenRA.TilesetBuilder/FormBuilder.cs b/OpenRA.TilesetBuilder/FormBuilder.cs index af555844f3..9370d91a69 100644 --- a/OpenRA.TilesetBuilder/FormBuilder.cs +++ b/OpenRA.TilesetBuilder/FormBuilder.cs @@ -36,43 +36,43 @@ namespace OpenRA.TilesetBuilder return Math.Abs(color.R - curr.R) + Math.Abs(color.G - curr.G) + Math.Abs(color.B - curr.B); } - public void CreateNewTileset() - { - this.Show(); - using (var formNew = new FormNew { }) - if (DialogResult.OK == formNew.ShowDialog()) + public void CreateNewTileset() { - PaletteFromImage = formNew.PaletteFromImage; - PaletteFile = formNew.PaletteFile; - ImageFile = formNew.ImageFile; - TileSize = formNew.TileSize; - - srcfile = ImageFile; - this.size = TileSize; - surface1.TileSize = TileSize; - - Bitmap fbitmap = new Bitmap(ImageFile); - Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height), - fbitmap.PixelFormat); - - int[] shadowIndex = { }; - - if (!PaletteFromImage) + this.Show(); + using (var formNew = new FormNew { }) + if (DialogResult.OK == formNew.ShowDialog()) { - TerrainPalette = Palette.Load(PaletteFile, shadowIndex); - rbitmap.Palette = TerrainPalette.AsSystemPalette(); - } + PaletteFromImage = formNew.PaletteFromImage; + PaletteFile = formNew.PaletteFile; + ImageFile = formNew.ImageFile; + TileSize = formNew.TileSize; + + srcfile = ImageFile; + this.size = TileSize; + surface1.TileSize = TileSize; + + Bitmap fbitmap = new Bitmap(ImageFile); + Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height), + fbitmap.PixelFormat); + + int[] shadowIndex = { }; + + if (!PaletteFromImage) + { + TerrainPalette = Palette.Load(PaletteFile, shadowIndex); + rbitmap.Palette = TerrainPalette.AsSystemPalette(); + } - surface1.Image = (Bitmap)rbitmap; - surface1.TilesPerRow = surface1.Image.Size.Width / surface1.TileSize; - surface1.Image.SetResolution(96, 96); // people keep being noobs about DPI, and GDI+ cares. - surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */ - surface1.Templates = new List