diff options
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 00e826404e6..ed2f3f2ee54 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -46,7 +46,6 @@ #include "CellImpl.h" #include "OutdoorPvPMgr.h" #include "GameEvent.h" -#include "PossessedAI.h" #include "CreatureGroups.h" // apply implementation of the singletons #include "Policies/SingletonImp.h" @@ -141,7 +140,7 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) } Creature::Creature() : -Unit(), i_AI(NULL), +Unit(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), m_lootMoney(0), m_lootRecipient(0), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), @@ -424,7 +423,7 @@ void Creature::Update(uint32 diff) setDeathState( JUST_ALIVED ); //Call AI respawn virtual function - i_AI->JustRespawned(); + AI()->JustRespawned(); GetMap()->Add(this); } @@ -484,6 +483,9 @@ void Creature::Update(uint32 diff) if(!isAlive()) break; + // if creature is charmed, switch to charmed AI + UpdateCharmAI(); + if(!IsInEvadeMode() && IsAIEnabled) { // do not allow the AI to be changed during update @@ -596,11 +598,9 @@ bool Creature::AIM_Initialize(CreatureAI* ai) return false; } - CreatureAI * oldAI = i_AI; - i_motionMaster.Initialize(); + if(i_AI) delete i_AI; i_AI = ai ? ai : FactorySelector::selectAI(this); - if (oldAI) - delete oldAI; + i_motionMaster.Initialize(); IsAIEnabled = true; return true; } |