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 71f53cdabb0..115906e94a3 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -45,7 +45,6 @@ #include "CellImpl.h" #include "OutdoorPvPMgr.h" #include "GameEventMgr.h" -#include "PossessedAI.h" #include "CreatureGroups.h" // apply implementation of the singletons #include "Policies/SingletonImp.h" @@ -133,7 +132,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), @@ -414,7 +413,7 @@ void Creature::Update(uint32 diff) setDeathState( JUST_ALIVED ); //Call AI respawn virtual function - i_AI->JustRespawned(); + AI()->JustRespawned(); uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId()); if (poolid) @@ -478,6 +477,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 @@ -590,11 +592,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; } |