diff options
| author | jackpoz <giacomopoz@gmail.com> | 2019-04-27 16:32:41 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-02 00:39:20 +0100 |
| commit | 98863659bb308f87f2b344e0c7f3b72985d8c5c4 (patch) | |
| tree | 824741d23173a1987c43d0456ca4c1fbb041b9f6 /src | |
| parent | 519e3c9ab718ce50dbaf66a50d15f5ead2dc9885 (diff) | |
Scripts/Guards: Fix infinite loop in npc_air_force_bots
Fix infinite loop in npc_air_force_bots happening when aura 38067 was removed, triggering MoveInLineOfSight() that would add back the aura. Only 1 aura add/remove for guard for player is allowed now.
(cherry picked from commit 844e7ee9262a5ba035ac9e8a6ffc298fb97fd3a9)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 89d3f1b76eb..fb8e915fb96 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -166,6 +166,13 @@ public: return nullptr; } + void UpdateAI(uint32 diff) override + { + ScriptedAI::UpdateAI(diff); + + inLineOfSightSinceLastUpdate.clear(); + } + void MoveInLineOfSight(Unit* who) override { if (!SpawnAssoc) @@ -189,6 +196,10 @@ public: { case SPAWNTYPE_ALARMBOT: { + // handle only 1 change for world update for each target + if (!inLineOfSightSinceLastUpdate.insert(who->GetGUID()).second) + return; + if (!who->IsWithinDistInMap(me, RANGE_GUARDS_MARK)) return; @@ -240,6 +251,8 @@ public: } } } + + GuidSet inLineOfSightSinceLastUpdate; }; CreatureAI* GetAI(Creature* creature) const override |
