Core/Maps: Implemented PolygonBoundary
Port From (https://github.com/TrinityCore/TrinityCore/commit/aed08b8a82cd4c14a6831ace7e9c4065ce29c5a4)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Game.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.Maps
|
||||
{
|
||||
@@ -133,7 +134,7 @@ namespace Game.Maps
|
||||
_a = new DoublePosition(pointA);
|
||||
_b = new DoublePosition(pointB);
|
||||
_c = new DoublePosition(pointC);
|
||||
|
||||
|
||||
_abx = _b.GetDoublePositionX() - _a.GetDoublePositionX();
|
||||
_bcx = _c.GetDoublePositionX() - _b.GetDoublePositionX();
|
||||
_cax = _a.GetDoublePositionX() - _c.GetDoublePositionX();
|
||||
@@ -218,6 +219,23 @@ namespace Game.Maps
|
||||
float _maxZ;
|
||||
}
|
||||
|
||||
class PolygonBoundary : AreaBoundary
|
||||
{
|
||||
Position _origin;
|
||||
List<Position> _vertices;
|
||||
|
||||
public PolygonBoundary(Position origin, List<Position> vertices, bool isInverted = false) : base(isInverted)
|
||||
{
|
||||
_origin = origin;
|
||||
_vertices = vertices;
|
||||
}
|
||||
|
||||
public override bool IsWithinBoundaryArea(Position pos)
|
||||
{
|
||||
return pos.IsInPolygon2D(_origin, _vertices);
|
||||
}
|
||||
}
|
||||
|
||||
class BoundaryUnionBoundary : AreaBoundary
|
||||
{
|
||||
public BoundaryUnionBoundary(AreaBoundary b1, AreaBoundary b2, bool isInverted = false) : base(isInverted)
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace Game.Maps
|
||||
CreatureUnitRelocationWorker(i_creature, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class PacketSenderRef : IDoWork<Player>
|
||||
{
|
||||
ServerPacket Data;
|
||||
|
||||
Reference in New Issue
Block a user