[10924] Send time diff between Update() calls for object - should help with mob respawn on inactive grids etc. Based on patches by VladimirMangos and cipherCOM. All issues from previous patches should be finally fixed now.

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2010-12-27 22:16:19 +02:00
parent 72b1d30a1c
commit b11820593c
39 changed files with 284 additions and 149 deletions

View file

@ -406,7 +406,7 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *
return display_id;
}
void Creature::Update(uint32 diff)
void Creature::Update(uint32 update_diff, uint32 diff)
{
if (m_needNotify)
{
@ -467,7 +467,7 @@ void Creature::Update(uint32 diff)
if (m_isDeadByDefault)
break;
if (m_corpseDecayTimer <= diff)
if (m_corpseDecayTimer <= update_diff)
{
// 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;
@ -482,11 +482,11 @@ void Creature::Update(uint32 diff)
}
else
{
m_corpseDecayTimer -= diff;
m_corpseDecayTimer -= update_diff;
if (m_groupLootId)
{
if(diff < m_groupLootTimer)
m_groupLootTimer -= diff;
if(update_diff < m_groupLootTimer)
m_groupLootTimer -= update_diff;
else
StopGroupLoot();
}
@ -498,7 +498,7 @@ void Creature::Update(uint32 diff)
{
if (m_isDeadByDefault)
{
if (m_corpseDecayTimer <= diff)
if (m_corpseDecayTimer <= update_diff)
{
// 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;
@ -516,11 +516,11 @@ void Creature::Update(uint32 diff)
}
else
{
m_corpseDecayTimer -= diff;
m_corpseDecayTimer -= update_diff;
}
}
Unit::Update( diff );
Unit::Update( update_diff, diff );
// creature can be dead after Unit::Update call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
@ -531,7 +531,7 @@ void Creature::Update(uint32 diff)
{
// do not allow the AI to be changed during update
m_AI_locked = true;
i_AI->UpdateAI(diff);
i_AI->UpdateAI(diff); // AI not react good at real update delays (while freeze in non-active part of map)
m_AI_locked = false;
}
@ -541,10 +541,10 @@ void Creature::Update(uint32 diff)
break;
if(m_regenTimer > 0)
{
if(diff >= m_regenTimer)
if(update_diff >= m_regenTimer)
m_regenTimer = 0;
else
m_regenTimer -= diff;
m_regenTimer -= update_diff;
}
if (m_regenTimer != 0)
break;