Fix Traits.Util style issues.

This commit is contained in:
Paul Chote
2013-07-22 22:19:31 +12:00
parent b50ba0bfb9
commit 3d1b7d6d53

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #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 * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -18,16 +18,16 @@ namespace OpenRA.Traits
{ {
public static class Util 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 leftTurn = (facing - desiredFacing) & 0xFF;
var rightTurn = ( desiredFacing - facing ) & 0xFF; var rightTurn = (desiredFacing - facing) & 0xFF;
if( Math.Min( leftTurn, rightTurn ) < rot ) if (Math.Min(leftTurn, rightTurn) < rot)
return desiredFacing & 0xFF; return desiredFacing & 0xFF;
else if( rightTurn < leftTurn ) else if (rightTurn < leftTurn)
return ( facing + rot ) & 0xFF; return (facing + rot) & 0xFF;
else else
return ( facing - rot ) & 0xFF; return (facing - rot) & 0xFF;
} }
public static int GetFacing(WVec d, int currentFacing) public static int GetFacing(WVec d, int currentFacing)
@@ -47,12 +47,12 @@ namespace OpenRA.Traits
return GetFacing(d.ToWVec(), currentFacing); 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; var turn = desiredFacing - facing;
if( turn > 128 ) if (turn > 128)
turn -= 256; turn -= 256;
if( turn < -128 ) if (turn < -128)
turn += 256; turn += 256;
return facing + turn; return facing + turn;
@@ -73,7 +73,7 @@ namespace OpenRA.Traits
public static Activity SequenceActivities(params Activity[] acts) public static Activity SequenceActivities(params Activity[] acts)
{ {
return acts.Reverse().Aggregate( 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) public static Activity RunActivity(Actor self, Activity act)
@@ -91,6 +91,7 @@ namespace OpenRA.Traits
if (prev == act) if (prev == act)
break; break;
} }
return act; return act;
} }
@@ -135,7 +136,7 @@ namespace OpenRA.Traits
{ {
var cells = target.IsActor var cells = target.IsActor
? target.Actor.OccupiesSpace.OccupiedCells().Select(c => c.First).ToArray() ? target.Actor.OccupiesSpace.OccupiedCells().Select(c => c.First).ToArray()
: new CPos[] {}; : new CPos[] { };
if (cells.Length == 0) if (cells.Length == 0)
cells = new CPos[] { target.CenterPosition.ToCPos() }; cells = new CPos[] { target.CenterPosition.ToCPos() };