Update UpdateFields.h. Drop redundant powers and happiness.

thx Strawberry

Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-04 02:31:51 +03:00 committed by Antz
parent 53b2e576d1
commit e9bee9b0b0
13 changed files with 602 additions and 660 deletions

View file

@ -411,6 +411,10 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
if (!target)
return;
uint32 valuesCount = m_valuesCount;
if(GetTypeId() == TYPEID_PLAYER && target != this)
valuesCount = PLAYER_END_NOT_SELF;
bool IsActivateToQuest = false;
bool IsPerCasterAuraState = false;
@ -460,7 +464,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
// 2 specialized loops for speed optimization in non-unit case
if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
{
for (uint16 index = 0; index < m_valuesCount; ++index)
for (uint16 index = 0; index < valuesCount; ++index)
{
if (updateMask->GetBit(index))
{
@ -546,7 +550,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
}
else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
{
for (uint16 index = 0; index < m_valuesCount; ++index)
for (uint16 index = 0; index < valuesCount; ++index)
{
if (updateMask->GetBit(index))
{
@ -593,7 +597,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
}
else // other objects case (no special index checks)
{
for (uint16 index = 0; index < m_valuesCount; ++index)
for (uint16 index = 0; index < valuesCount; ++index)
{
if (updateMask->GetBit(index))
{
@ -642,18 +646,26 @@ bool Object::LoadValues(const char* data)
return true;
}
void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
void Object::_SetUpdateBits(UpdateMask *updateMask, Player* target) const
{
for (uint16 index = 0; index < m_valuesCount; ++index)
uint32 valuesCount = m_valuesCount;
if(GetTypeId() == TYPEID_PLAYER && target != this)
valuesCount = PLAYER_END_NOT_SELF;
for( uint16 index = 0; index < valuesCount; ++index )
{
if (m_uint32Values_mirror[index] != m_uint32Values[index])
updateMask->SetBit(index);
}
}
void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
void Object::_SetCreateBits(UpdateMask *updateMask, Player* target) const
{
for (uint16 index = 0; index < m_valuesCount; ++index)
uint32 valuesCount = m_valuesCount;
if(GetTypeId() == TYPEID_PLAYER && target != this)
valuesCount = PLAYER_END_NOT_SELF;
for (uint16 index = 0; index < valuesCount; ++index)
{
if (GetUInt32Value(index) != 0)
updateMask->SetBit(index);