Remove CVec -> WVec conversion.

This commit is contained in:
Paul Chote
2014-04-26 00:10:40 +12:00
parent a256e722d5
commit d7f1b1c9e2
15 changed files with 23 additions and 27 deletions

View File

@@ -44,8 +44,6 @@ namespace OpenRA
public int LengthSquared { get { return X * X + Y * Y; } }
public int Length { get { return (int)Math.Sqrt(LengthSquared); } }
public WVec ToWVec() { return new WVec(X*1024, Y*1024, 0); }
public CVec Clamp(Rectangle r)
{
return new CVec(
@@ -115,7 +113,6 @@ namespace OpenRA
{
case "X": return X;
case "Y": return Y;
case "Facing": return Traits.Util.GetFacing(this, 0);
default: throw new LuaException("CVec does not define a member '{0}'".F(key));
}
}

View File

@@ -476,6 +476,11 @@ namespace OpenRA
return new CPos(pos.X / 1024, pos.Y / 1024);
}
public int FacingBetween(CPos cell, CPos towards, int fallbackfacing)
{
return Traits.Util.GetFacing(CenterOfCell(towards) - CenterOfCell(cell), fallbackfacing);
}
public void Resize(int width, int height) // editor magic.
{
var oldMapTiles = MapTiles.Value;

View File

@@ -42,11 +42,6 @@ namespace OpenRA.Traits
return (angle / 4 - 0x40) & 0xFF;
}
public static int GetFacing(CVec d, int currentFacing)
{
return GetFacing(d.ToWVec(), currentFacing);
}
public static int GetNearestFacing(int facing, int desiredFacing)
{
var turn = desiredFacing - facing;