diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-03-28 01:52:49 -0300 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-04-24 17:18:51 +0200 |
commit | 3f79c9f69674618a7d7e2bf8484f9ec6ce15b2df (patch) | |
tree | e60a82d47f39fe491801dfb0ad1fb9560d11dd9d /src/server/game/AI/CreatureAI.cpp | |
parent | 124b014f403bca147b8a7edaba6e90aee5c57e5f (diff) |
Core/AI: AreaBoundary refactor
- Added an auxiliary function IsInBounds to base CreatureAI
- Changed container to vector. Set had no sense because we're storing new pointers, they have different addresses even if the boundary is the same
(cherry picked from commit 2f99fa09c9bacbad376d7a296c3311f94ec8a552)
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 7fbc8ed2ed5..b9d052cb528 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -368,13 +368,25 @@ bool CreatureAI::CheckBoundary(Position const* who) const who = me; if (_boundary) - for (AreaBoundary const* boundary : *_boundary) - if (!boundary->IsWithinBoundary(who)) + for (AreaBoundary const* areaBoundary : *_boundary) + if (!areaBoundary->IsWithinBoundary(who)) return false; return true; } +bool CreatureAI::IsInBounds(CreatureBoundary const* boundary, Position const* pos) +{ + if (!boundary) + return true; + + for (AreaBoundary const* areaBoundary : *boundary) + if (!areaBoundary->IsWithinBoundary(pos)) + return false; + + return true; +} + void CreatureAI::SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; |