diff options
author | ModoX <moardox@gmail.com> | 2025-02-06 21:07:40 +0100 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2025-02-08 22:05:40 +0100 |
commit | 68bdea005233d1ecf0589f76e5636b0a0fbfcaf8 (patch) | |
tree | 474df113381a8dffad70385d7d54f1741b9d86d9 /src/server/game/Maps/AreaBoundary.cpp | |
parent | f5cf251dede854de8da2e73fe5fed994c18c616d (diff) |
Core/Maps: Implemented PolygonBoundary
(cherry picked from commit aed08b8a82cd4c14a6831ace7e9c4065ce29c5a4)
Diffstat (limited to 'src/server/game/Maps/AreaBoundary.cpp')
-rw-r--r-- | src/server/game/Maps/AreaBoundary.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server/game/Maps/AreaBoundary.cpp b/src/server/game/Maps/AreaBoundary.cpp index 179070fcaed..989c9957546 100644 --- a/src/server/game/Maps/AreaBoundary.cpp +++ b/src/server/game/Maps/AreaBoundary.cpp @@ -90,6 +90,15 @@ bool ZRangeBoundary::IsWithinBoundaryArea(Position const* pos) const return (_minZ <= pos->GetPositionZ() && pos->GetPositionZ() <= _maxZ); } +// ---== POLYGON ==--- +PolygonBoundary::PolygonBoundary(Position origin, std::vector<Position>&& vertices, bool isInverted /* = false*/) : + AreaBoundary(isInverted), _origin(origin), _vertices(std::move(vertices)) { } + +bool PolygonBoundary::IsWithinBoundaryArea(Position const* pos) const +{ + return pos->IsInPolygon2D(_origin, _vertices); +} + // ---== UNION OF 2 BOUNDARIES ==--- BoundaryUnionBoundary::BoundaryUnionBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted) : AreaBoundary(isInverted), _b1(b1), _b2(b2) |