diff options
author | megamage <none@none> | 2009-03-12 14:22:59 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-12 14:22:59 -0600 |
commit | 16ee4a46c271bd7c234ffa7579f5f90cf2007772 (patch) | |
tree | 6d547d8228472fcc97ead5dfcdd8a9aaf8f70233 /src/game/Creature.cpp | |
parent | 6e12d3f1b9f40f3f95390245f3fcbb30fbd8657f (diff) | |
parent | 1fbfc6da645058a6da3073dafde0e6bca621e31c (diff) |
*Merge.
--HG--
branch : trunk
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; } |