mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[9392] Update creature/gameobject pool at despawn instead spawn prepare.
This let solve problem with not despawned creature/gameobject at pool update in case when related grid not loaded. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
941b2edb10
commit
b2718378ef
6 changed files with 93 additions and 41 deletions
|
|
@ -374,11 +374,7 @@ void Creature::Update(uint32 diff)
|
|||
//Call AI respawn virtual function
|
||||
i_AI->JustRespawned();
|
||||
|
||||
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr.UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
|
||||
else
|
||||
GetMap()->Add(this);
|
||||
GetMap()->Add(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -389,8 +385,16 @@ void Creature::Update(uint32 diff)
|
|||
|
||||
if( m_deathTimer <= diff )
|
||||
{
|
||||
RemoveCorpse();
|
||||
DEBUG_LOG("Removing corpse... %u ", GetEntry());
|
||||
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
|
||||
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||
if (poolid)
|
||||
sPoolMgr.UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
|
||||
|
||||
if (IsInWorld()) // can be despawned by update pool
|
||||
{
|
||||
RemoveCorpse();
|
||||
DEBUG_LOG("Removing corpse... %u ", GetEntry());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -419,8 +423,19 @@ void Creature::Update(uint32 diff)
|
|||
{
|
||||
if( m_deathTimer <= diff )
|
||||
{
|
||||
RemoveCorpse();
|
||||
DEBUG_LOG("Removing alive corpse... %u ", GetEntry());
|
||||
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
|
||||
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||
|
||||
if (poolid)
|
||||
sPoolMgr.UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
|
||||
|
||||
if (IsInWorld()) // can be despawned by update pool
|
||||
{
|
||||
RemoveCorpse();
|
||||
DEBUG_LOG("Removing alive corpse... %u ", GetEntry());
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue