From e08445f762e4d8bb8188ed09725a0c0641c598cc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 22 Jul 2013 20:42:33 +1200 Subject: [PATCH] Remove obsolete functions from Traits.Util. --- OpenRA.Game/Traits/Util.cs | 25 ------------------------- OpenRA.Mods.RA/Husk.cs | 3 +-- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/OpenRA.Game/Traits/Util.cs b/OpenRA.Game/Traits/Util.cs index 46b47613bd..a90cc02f07 100755 --- a/OpenRA.Game/Traits/Util.cs +++ b/OpenRA.Game/Traits/Util.cs @@ -84,31 +84,11 @@ namespace OpenRA.Traits return a / step; } - public static float2 RotateVectorByFacing(float2 v, int facing, float ecc) - { - var angle = (facing / 256f) * (2 * (float)Math.PI); - var sinAngle = (float)Math.Sin(angle); - var cosAngle = (float)Math.Cos(angle); - - return new float2( - (cosAngle * v.X + sinAngle * v.Y), - ecc * (cosAngle * v.Y - sinAngle * v.X)); - } - - public static PPos CenterOfCell(CPos loc) - { - return loc.ToPPos() + new PVecInt(Game.CellSize / 2, Game.CellSize / 2); - } - public static WPos BetweenCells(CPos from, CPos to) { return WPos.Lerp(from.CenterPosition, to.CenterPosition, 1, 2); } - public static int2 AsInt2(this int[] xs) { return new int2(xs[0], xs[1]); } - public static float2 RelOffset(this int[] offset) { return new float2(offset[0], offset[1]); } - public static float2 AbsOffset(this int[] offset) { return new float2(offset.ElementAtOrDefault(2), offset.ElementAtOrDefault(3)); } - public static Activity SequenceActivities(params Activity[] acts) { return acts.Reverse().Aggregate( @@ -133,11 +113,6 @@ namespace OpenRA.Traits return act; } - public static Color ArrayToColor(int[] x) { return Color.FromArgb(x[0], x[1], x[2]); } - - [Obsolete("Use ToCPos() method", true)] - public static int2 CellContaining(float2 pos) { return (1f / Game.CellSize * pos).ToInt2(); } - /* pretty crap */ public static IEnumerable Shuffle(this IEnumerable ts, Thirdparty.Random random) { diff --git a/OpenRA.Mods.RA/Husk.cs b/OpenRA.Mods.RA/Husk.cs index a46f577362..8c5a4cd27e 100644 --- a/OpenRA.Mods.RA/Husk.cs +++ b/OpenRA.Mods.RA/Husk.cs @@ -42,8 +42,7 @@ namespace OpenRA.Mods.RA this.self = init.self; TopLeft = init.Get(); - var ppos = init.Contains() ? init.Get() : Util.CenterOfCell(TopLeft); - CenterPosition = ppos.ToWPos(0); + CenterPosition = init.Contains() ? init.Get().ToWPos(0) : TopLeft.CenterPosition; Facing = init.Contains() ? init.Get() : 128; var speed = init.Contains() ? init.Get() : 0;