From d42c45042337cf240cf4419a2ac009bd43ffcdaf Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 8 Jun 2025 18:50:11 -0400 Subject: [PATCH] Core/Maps: Implemented PolygonBoundary Port From (https://github.com/TrinityCore/TrinityCore/commit/aed08b8a82cd4c14a6831ace7e9c4065ce29c5a4) --- Source/Game/Maps/AreaBoundary.cs | 20 +++++++++++++++++++- Source/Game/Maps/GridNotifiers.cs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Game/Maps/AreaBoundary.cs b/Source/Game/Maps/AreaBoundary.cs index 6c3278e83..6ce97b2f7 100644 --- a/Source/Game/Maps/AreaBoundary.cs +++ b/Source/Game/Maps/AreaBoundary.cs @@ -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 _vertices; + + public PolygonBoundary(Position origin, List 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) diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index 9134bf30e..5c11f3c92 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -384,7 +384,7 @@ namespace Game.Maps CreatureUnitRelocationWorker(i_creature, player); } } - + public class PacketSenderRef : IDoWork { ServerPacket Data;