Skip to content

Commit

Permalink
Creature: Do not allow calling Creature::SetInCombatWithZone when AI …
Browse files Browse the repository at this point in the history
…is not yet existant

Happens during Creature Create, all calls needs to be after spawning. We can not silently fail Creature::CallAssistance because it will lead to it not working
Closes cmangos/issues#2677
Closes cmangos/mangos-tbc#508
  • Loading branch information
killerwife committed Feb 17, 2022
1 parent d5f95f6 commit f9514a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/game/Entities/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,8 @@ void Creature::CallAssistance()
// FIXME: should player pets call for assistance?
if (!m_AlreadyCallAssistance && GetVictim() && !HasCharmer())
{
MANGOS_ASSERT(AI());

SetNoCallAssistance(true);

if (!CanCallForAssistance())
Expand Down Expand Up @@ -2313,6 +2315,12 @@ void Creature::SetInCombatWithZone(bool checkAttackability)
return;
}

if (!AI())
{
sLog.outError("Creature entry %u call SetInCombatWithZone but creature does not have AI. Possible call during create.", GetEntry());
return;
}

Map* pMap = GetMap();

if (!pMap->IsDungeon())
Expand Down

0 comments on commit f9514a7

Please sign in to comment.