[10688] New version of patch for send real diff from last update.

In new version last update time stopred for specific Cell that store all world objects
placed in it. All objects of Cell updated (or not updated) in same time.

Original version provided by ciphercom.
This commit is contained in:
VladimirMangos 2010-11-06 19:43:23 +03:00
parent 464908f453
commit e219ee99bb
36 changed files with 183 additions and 151 deletions

View file

@ -482,7 +482,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
}
}
void Pet::Update(uint32 diff)
void Pet::Update(uint32 update_diff, uint32 tick_diff)
{
if(m_removed) // pet already removed, just wait in remove queue, no updates
return;
@ -491,7 +491,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.");
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
@ -520,8 +520,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
{
Remove(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
@ -530,7 +530,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())
{
@ -544,25 +544,25 @@ void Pet::Update(uint32 diff)
m_regenTimer = 4000;
}
else
m_regenTimer -= diff;
m_regenTimer -= update_diff;
if(getPetType() != HUNTER_PET)
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, tick_diff);
}
void Pet::Regenerate(Powers power)