[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

@ -481,7 +481,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
}
}
void Pet::Update(uint32 diff)
void Pet::Update(uint32 update_diff, uint32 diff)
{
if(m_removed) // pet already removed, just wait in remove queue, no updates
return;
@ -490,7 +490,7 @@ void Pet::Update(uint32 diff)
{
case CORPSE:
{
if (m_corpseDecayTimer <= diff)
if (m_corpseDecayTimer <= update_diff)
{
MANGOS_ASSERT(getPetType()!=SUMMON_PET && "Must be already removed.");
Unsummon(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
@ -519,8 +519,8 @@ void Pet::Update(uint32 diff)
if (m_duration > 0)
{
if(m_duration > (int32)diff)
m_duration -= (int32)diff;
if(m_duration > (int32)update_diff)
m_duration -= (int32)update_diff;
else
{
Unsummon(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT, owner);
@ -529,7 +529,7 @@ void Pet::Update(uint32 diff)
}
//regenerate focus for hunter pets or energy for deathknight's ghoul
if(m_regenTimer <= diff)
if(m_regenTimer <= update_diff)
{
switch (getPowerType())
{
@ -543,25 +543,26 @@ void Pet::Update(uint32 diff)
m_regenTimer = 4000;
}
else
m_regenTimer -= diff;
m_regenTimer -= update_diff;
if(getPetType() != HUNTER_PET)
break;
if(m_happinessTimer <= diff)
if(m_happinessTimer <= update_diff)
{
LooseHappiness();
m_happinessTimer = 7500;
}
else
m_happinessTimer -= diff;
m_happinessTimer -= update_diff;
break;
}
default:
break;
}
Creature::Update(diff);
Creature::Update(update_diff, diff);
}
void Pet::Regenerate(Powers power)