diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index a098c3c79..f2d411a89 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -784,7 +784,7 @@ bool GameObject::ActivateToQuest(Player *pTarget)const } case GAMEOBJECT_TYPE_GOOBER: { - if(pTarget->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE) + if (pTarget->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE) return true; break; } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 6df8b3291..58f53c22a 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -538,23 +538,24 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *updateMask, Player *target) const { - if(!target) + if (!target) return; bool IsActivateToQuest = false; bool IsPerCasterAuraState = false; + if (updatetype == UPDATETYPE_CREATE_OBJECT || updatetype == UPDATETYPE_CREATE_OBJECT2) { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { - if ( ((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) + if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) IsActivateToQuest = true; updateMask->SetBit(GAMEOBJECT_DYNAMIC); } else if (isType(TYPEMASK_UNIT)) { - if( ((Unit*)this)->HasAuraState(AURA_STATE_CONFLAGRATE)) + if (((Unit*)this)->HasAuraState(AURA_STATE_CONFLAGRATE)) { IsPerCasterAuraState = true; updateMask->SetBit(UNIT_FIELD_AURASTATE); @@ -565,16 +566,15 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { - if ( ((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) - { + if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) IsActivateToQuest = true; - } + updateMask->SetBit(GAMEOBJECT_DYNAMIC); updateMask->SetBit(GAMEOBJECT_BYTES_1); } else if (isType(TYPEMASK_UNIT)) { - if( ((Unit*)this)->HasAuraState(AURA_STATE_CONFLAGRATE)) + if (((Unit*)this)->HasAuraState(AURA_STATE_CONFLAGRATE)) { IsPerCasterAuraState = true; updateMask->SetBit(UNIT_FIELD_AURASTATE); @@ -585,19 +585,19 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * MANGOS_ASSERT(updateMask && updateMask->GetCount() == m_valuesCount); *data << (uint8)updateMask->GetBlockCount(); - data->append( updateMask->GetMask(), updateMask->GetLength() ); + data->append(updateMask->GetMask(), updateMask->GetLength()); // 2 specialized loops for speed optimization in non-unit case - if(isType(TYPEMASK_UNIT)) // unit (creature/player) case + if (isType(TYPEMASK_UNIT)) // unit (creature/player) case { - for( uint16 index = 0; index < m_valuesCount; ++index ) + for(uint16 index = 0; index < m_valuesCount; ++index) { - if( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { - if( index == UNIT_NPC_FLAGS ) + if (index == UNIT_NPC_FLAGS) { // remove custom flag before sending - uint32 appendValue = m_uint32Values[ index ] & ~UNIT_NPC_FLAG_GUARD; + uint32 appendValue = m_uint32Values[index] & ~UNIT_NPC_FLAG_GUARD; if (GetTypeId() == TYPEID_UNIT) { @@ -621,65 +621,65 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * } else if (index == UNIT_FIELD_AURASTATE) { - if(IsPerCasterAuraState) + if (IsPerCasterAuraState) { // IsPerCasterAuraState set if related pet caster aura state set already if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE,target->GetGUID())) - *data << m_uint32Values[ index ]; + *data << m_uint32Values[index]; else - *data << (m_uint32Values[ index ] & ~(1 << (AURA_STATE_CONFLAGRATE-1))); + *data << (m_uint32Values[index] & ~(1 << (AURA_STATE_CONFLAGRATE-1))); } else - *data << m_uint32Values[ index ]; + *data << m_uint32Values[index]; } // FIXME: Some values at server stored in float format but must be sent to client in uint32 format - else if(index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME) + else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME) { // convert from float to uint32 and send - *data << uint32(m_floatValues[ index ] < 0 ? 0 : m_floatValues[ index ]); + *data << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]); } // there are some float values which may be negative or can't get negative due to other checks - else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) || + else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) || (index >= UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) || (index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) || - (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4)) + (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4)) { - *data << uint32(m_floatValues[ index ]); + *data << uint32(m_floatValues[index]); } // Gamemasters should be always able to select units - remove not selectable flag - else if(index == UNIT_FIELD_FLAGS && target->isGameMaster()) + else if (index == UNIT_FIELD_FLAGS && target->isGameMaster()) { - *data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE); + *data << (m_uint32Values[index] & ~UNIT_FLAG_NOT_SELECTABLE); } // hide lootable animation for unallowed players else if (index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT) { if (!target->isAllowedToLoot((Creature*)this)) - *data << (m_uint32Values[ index ] & ~(UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED_BY_PLAYER)); + *data << (m_uint32Values[index] & ~(UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED_BY_PLAYER)); else { // flag only for original loot recipent if (target->GetObjectGuid() == ((Creature*)this)->GetLootRecipientGuid()) - *data << m_uint32Values[ index ]; + *data << m_uint32Values[index]; else - *data << (m_uint32Values[ index ] & ~(UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER)); + *data << (m_uint32Values[index] & ~(UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER)); } } else { // send in current format (float as float, uint32 as uint32) - *data << m_uint32Values[ index ]; + *data << m_uint32Values[index]; } } } } - else if(isType(TYPEMASK_GAMEOBJECT)) // gameobject case + else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case { - for( uint16 index = 0; index < m_valuesCount; ++index ) + for(uint16 index = 0; index < m_valuesCount; ++index) { - if( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { // send in current format (float as float, uint32 as uint32) if (index == GAMEOBJECT_DYNAMIC) @@ -701,8 +701,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * *data << uint16(-1); break; case GAMEOBJECT_TYPE_CHEST: - // enable quest object. Represent 9, but 1 for client before 2.3.0 - *data << uint16(9); + *data << uint16(9); // 1 for client before 2.3.0 *data << uint16(-1); break; case GAMEOBJECT_TYPE_GENERIC: @@ -732,18 +731,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * } } else - *data << m_uint32Values[ index ]; // other cases + *data << m_uint32Values[index]; // other cases } } } else // other objects case (no special index checks) { - for( uint16 index = 0; index < m_valuesCount; ++index ) + for(uint16 index = 0; index < m_valuesCount; ++index) { - if( updateMask->GetBit( index ) ) + if (updateMask->GetBit(index)) { // send in current format (float as float, uint32 as uint32) - *data << m_uint32Values[ index ]; + *data << m_uint32Values[index]; } } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 0fdc9ca84..8bb61a510 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7698,7 +7698,7 @@ void ObjectMgr::LoadGameObjectForQuests() { mGameObjectForQuestSet.clear(); // need for reload case - if( !sGOStorage.MaxEntry ) + if (!sGOStorage.MaxEntry) { barGoLink bar( 1 ); bar.step(); @@ -7707,7 +7707,7 @@ void ObjectMgr::LoadGameObjectForQuests() return; } - barGoLink bar( sGOStorage.MaxEntry - 1 ); + barGoLink bar(sGOStorage.MaxEntry - 1); uint32 count = 0; // collect GO entries for GO that must activated @@ -7715,7 +7715,7 @@ void ObjectMgr::LoadGameObjectForQuests() { bar.step(); GameObjectInfo const* goInfo = sGOStorage.LookupEntry(go_entry); - if(!goInfo) + if (!goInfo) continue; switch(goInfo->type) @@ -7768,7 +7768,7 @@ void ObjectMgr::LoadGameObjectForQuests() } case GAMEOBJECT_TYPE_GOOBER: { - if(goInfo->goober.questId) //quests objects + if (goInfo->goober.questId) //quests objects { mGameObjectForQuestSet.insert(go_entry); count++; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 26bfec67a..cae02bc37 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10592" + #define REVISION_NR "10593" #endif // __REVISION_NR_H__