diff --git a/OpenRA.Game/Traits/Util.cs b/OpenRA.Game/Traits/Util.cs index cb52bd3bac..02f1bd4d9d 100755 --- a/OpenRA.Game/Traits/Util.cs +++ b/OpenRA.Game/Traits/Util.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -18,16 +18,16 @@ namespace OpenRA.Traits { public static class Util { - public static int TickFacing( int facing, int desiredFacing, int rot ) + public static int TickFacing(int facing, int desiredFacing, int rot) { - var leftTurn = ( facing - desiredFacing ) & 0xFF; - var rightTurn = ( desiredFacing - facing ) & 0xFF; - if( Math.Min( leftTurn, rightTurn ) < rot ) + var leftTurn = (facing - desiredFacing) & 0xFF; + var rightTurn = (desiredFacing - facing) & 0xFF; + if (Math.Min(leftTurn, rightTurn) < rot) return desiredFacing & 0xFF; - else if( rightTurn < leftTurn ) - return ( facing + rot ) & 0xFF; + else if (rightTurn < leftTurn) + return (facing + rot) & 0xFF; else - return ( facing - rot ) & 0xFF; + return (facing - rot) & 0xFF; } public static int GetFacing(WVec d, int currentFacing) @@ -47,12 +47,12 @@ namespace OpenRA.Traits return GetFacing(d.ToWVec(), currentFacing); } - public static int GetNearestFacing( int facing, int desiredFacing ) + public static int GetNearestFacing(int facing, int desiredFacing) { var turn = desiredFacing - facing; - if( turn > 128 ) + if (turn > 128) turn -= 256; - if( turn < -128 ) + if (turn < -128) turn += 256; return facing + turn; @@ -73,7 +73,7 @@ namespace OpenRA.Traits public static Activity SequenceActivities(params Activity[] acts) { return acts.Reverse().Aggregate( - (next, a) => { a.Queue( next ); return a; }); + (next, a) => { a.Queue(next); return a; }); } public static Activity RunActivity(Actor self, Activity act) @@ -91,6 +91,7 @@ namespace OpenRA.Traits if (prev == act) break; } + return act; } @@ -135,7 +136,7 @@ namespace OpenRA.Traits { var cells = target.IsActor ? target.Actor.OccupiesSpace.OccupiedCells().Select(c => c.First).ToArray() - : new CPos[] {}; + : new CPos[] { }; if (cells.Length == 0) cells = new CPos[] { target.CenterPosition.ToCPos() };