[9578] Use ObjectGuid in visibility sets

This commit is contained in:
VladimirMangos 2010-03-12 22:52:36 +03:00
parent 29b2c80449
commit acde81fc54
8 changed files with 37 additions and 32 deletions

View file

@ -17664,12 +17664,13 @@ void Player::HandleStealthedUnitsDetection()
{
if(!hasAtClient)
{
ObjectGuid i_guid = (*i)->GetGUID();
(*i)->SendCreateUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
m_clientGUIDs.insert(i_guid);
#ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
sLog.outDebug("%s is detected in stealth by player %u. Distance = %f",i_guid.GetString().c_str(),GetGUIDLow(),GetDistance(*i));
#endif
// target aura duration for caster show only if target exist at caster client
@ -18839,12 +18840,14 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
if (target->GetTypeId()==TYPEID_UNIT)
BeforeVisibilityDestroy<Creature>((Creature*)target,this);
ObjectGuid t_guid = target->GetGUID();
target->DestroyForPlayer(this);
m_clientGUIDs.erase(target->GetGUID());
m_clientGUIDs.erase(t_guid);
#ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),GetGUIDLow(),GetDistance(target));
sLog.outDebug("%s out of range for player %u. Distance = %f",t_guid.GetString().c_str(),GetGUIDLow(),GetDistance(target));
#endif
}
}
@ -18873,13 +18876,13 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
}
template<class T>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target)
inline void UpdateVisibilityOf_helper(std::set<ObjectGuid>& s64, T* target)
{
s64.insert(target->GetGUID());
}
template<>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target)
inline void UpdateVisibilityOf_helper(std::set<ObjectGuid>& s64, GameObject* target)
{
if(!target->IsTransport())
s64.insert(target->GetGUID());
@ -18894,12 +18897,14 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD
{
BeforeVisibilityDestroy<T>(target,this);
ObjectGuid t_guid = target->GetGUID();
target->BuildOutOfRangeUpdateBlock(&data);
m_clientGUIDs.erase(target->GetGUID());
m_clientGUIDs.erase(t_guid);
#ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u, Entry: %u) is out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),target->GetEntry(),GetGUIDLow(),GetDistance(target));
sLog.outDebug("%s is out of range for player %u. Distance = %f",t_guid.GetString().c_str(),GetGUIDLow(),GetDistance(target));
#endif
}
}
@ -19526,13 +19531,12 @@ void Player::UpdateForQuestWorldObjects()
WorldPacket packet;
for(ClientGUIDs::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr)
{
if(IS_GAMEOBJECT_GUID(*itr))
if (itr->IsGameobject())
{
GameObject *obj = GetMap()->GetGameObject(*itr);
if(obj)
if (GameObject *obj = GetMap()->GetGameObject(*itr))
obj->BuildValuesUpdateBlockForPlayer(&udata,this);
}
else if(IS_CREATURE_GUID(*itr) || IS_VEHICLE_GUID(*itr))
else if (itr->IsCreatureOrVehicle())
{
Creature *obj = GetMap()->GetCreatureOrPetOrVehicle(*itr);
if(!obj)