aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-06-30 02:01:43 +0200
committerModoX <moardox@gmail.com>2024-06-30 02:01:58 +0200
commitf077b8608ca7c6aa80663e94f362f01d15041c7b (patch)
tree2d0067d32b30eb430fe0301327acc8a8ac52333d
parent486641063e9b88d84e38e4cee3bfc2fb3e0bffc6 (diff)
Core/Maps: Implemented BoundaryIntersectionBoundary
-rw-r--r--src/server/game/Maps/AreaBoundary.cpp18
-rw-r--r--src/server/game/Maps/AreaBoundary.h14
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