fix: Cleanup IPoint3D calls (#704)

This commit is contained in:
Kamron Batman 2021-08-19 09:11:48 -07:00 committed by GitHub
parent 788b04b958
commit 3293ffcf06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 158 additions and 264 deletions

View file

@ -21,12 +21,6 @@ namespace Server
private Point2D m_Start;
private Point2D m_End;
public Rectangle2D(IPoint2D start, IPoint2D end)
{
m_Start = new Point2D(start);
m_End = new Point2D(end);
}
public Rectangle2D(Point2D start, Point2D end)
{
m_Start = start;
@ -141,7 +135,8 @@ namespace Server
public readonly bool Contains(Point2D p) =>
m_Start.m_X <= p.m_X && m_Start.m_Y <= p.m_Y && m_End.m_X > p.m_X && m_End.m_Y > p.m_Y;
public readonly bool Contains(IPoint2D p) => m_Start <= p && m_End > p;
public readonly bool Contains(int x, int y) =>
m_Start.m_X <= x && m_Start.m_Y <= y && m_End.m_X > x && m_End.m_Y > y;
public override string ToString() => $"({X}, {Y})+({Width}, {Height})";
}

View file

@ -118,6 +118,18 @@ namespace Server
&& p.m_Z >= m_Start.m_Z
&& p.m_Z < m_End.m_Z;
public bool Contains(Point2D p) =>
p.m_X >= m_Start.m_X
&& p.m_X < m_End.m_X
&& p.m_Y >= m_Start.m_Y
&& p.m_Y < m_End.m_Y;
public bool Contains(IPoint2D p) =>
p.X >= m_Start.m_X
&& p.X < m_End.m_X
&& p.Y >= m_Start.m_Y
&& p.Y < m_End.m_Y;
public bool Contains(IPoint3D p) =>
p.X >= m_Start.m_X
&& p.X < m_End.m_X

View file

@ -66,7 +66,7 @@ namespace Server
{
}
public WorldLocation(IPoint2D p, Map map) : this(p.X, p.Y, 0, map)
public WorldLocation(Point2D p, Map map) : this(p.X, p.Y, 0, map)
{
}
@ -74,7 +74,7 @@ namespace Server
{
}
public WorldLocation(IPoint3D p, Map map) : this(p.X, p.Y, p.Z, map)
public WorldLocation(Point3D p, Map map) : this(p.X, p.Y, p.Z, map)
{
}