aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index db64c07fa23..c69ae6e8d16 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -147,7 +147,7 @@ m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_resp
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_reactState(REACT_AGGRESSIVE),
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
-m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0), m_formationID(0)
+m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0), m_formation(NULL)
{
m_valuesCount = UNIT_END;
@@ -191,8 +191,8 @@ void Creature::RemoveFromWorld()
///- Remove the creature from the accessor
if(IsInWorld())
{
- if(m_formationID)
- formation_mgr.DestroyGroup(m_formationID, GetGUID());
+ if(m_formation)
+ formation_mgr.RemoveCreatureFromGroup(m_formation, this);
ObjectAccessor::Instance().RemoveObject(this);
Unit::RemoveFromWorld();
}
@@ -204,12 +204,13 @@ void Creature::SearchFormation()
return;
uint32 lowguid = GetDBTableGUIDLow();
+ if(!lowguid)
+ return;
+
+ CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid);
+ if(frmdata != CreatureGroupMap.end())
+ formation_mgr.AddCreatureToGroup(frmdata->second->leaderGUID, this);
- if(lowguid && CreatureGroupMap.find(lowguid) != CreatureGroupMap.end())
- {
- m_formationID = CreatureGroupMap[lowguid]->leaderGUID;
- formation_mgr.UpdateCreatureGroup(m_formationID, this);
- }
}
void Creature::RemoveCorpse()