diff options
author | ModoX <moardox@gmail.com> | 2024-06-30 02:01:43 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-07-05 04:42:41 +0200 |
commit | d1a903b837a544e0aad89b5df27b25a826ad43ea (patch) | |
tree | 46cfa67d50bd71c8e1b54422ff1cda3cce7735d1 /src | |
parent | a0d6548be36f27a5ccf4c72819c092ba14e2b1d6 (diff) |
Core/Maps: Implemented BoundaryIntersectionBoundary
(cherry picked from commit f077b8608ca7c6aa80663e94f362f01d15041c7b)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Maps/AreaBoundary.cpp | 18 | ||||
-rw-r--r-- | src/server/game/Maps/AreaBoundary.h | 14 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/server/game/Maps/AreaBoundary.cpp b/src/server/game/Maps/AreaBoundary.cpp index b0069da07cd..179070fcaed 100644 --- a/src/server/game/Maps/AreaBoundary.cpp +++ b/src/server/game/Maps/AreaBoundary.cpp @@ -105,3 +105,21 @@ bool BoundaryUnionBoundary::IsWithinBoundaryArea(Position const* pos) const { return (_b1->IsWithinBoundary(pos) || _b2->IsWithinBoundary(pos)); } + +// ---== INTERSECTION OF 2 BOUNDARIES ==--- +BoundaryIntersectionBoundary::BoundaryIntersectionBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted) : + AreaBoundary(isInverted), _b1(b1), _b2(b2) +{ + ASSERT(b1 && b2); +} + +BoundaryIntersectionBoundary::~BoundaryIntersectionBoundary() +{ + delete _b1; + delete _b2; +} + +bool BoundaryIntersectionBoundary::IsWithinBoundaryArea(Position const* pos) const +{ + return (_b1->IsWithinBoundary(pos) && _b2->IsWithinBoundary(pos)); +} diff --git a/src/server/game/Maps/AreaBoundary.h b/src/server/game/Maps/AreaBoundary.h index fcb456261b1..b08c13018d6 100644 --- a/src/server/game/Maps/AreaBoundary.h +++ b/src/server/game/Maps/AreaBoundary.h @@ -164,4 +164,18 @@ class TC_GAME_API BoundaryUnionBoundary : public AreaBoundary AreaBoundary const* const _b2; }; +class TC_GAME_API BoundaryIntersectionBoundary : public AreaBoundary +{ +public: + BoundaryIntersectionBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted = false); + +protected: + virtual ~BoundaryIntersectionBoundary(); + bool IsWithinBoundaryArea(Position const* pos) const override; + +private: + AreaBoundary const* const _b1; + AreaBoundary const* const _b2; +}; + #endif //TRINITY_AREA_BOUNDARY_H |