[10020] Drop unused member in VisibleNotifier structure and related functions

(based on SilverIce's repo commit e678555)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also applied mangos code style to GridNotifiersImpl.h
This commit is contained in:
SilverIce 2010-06-02 09:36:52 +04:00 committed by VladimirMangos
parent 57ca730a2f
commit d6c5207867
6 changed files with 127 additions and 145 deletions

View file

@ -53,7 +53,7 @@ VisibleNotifier::Notify()
{ {
// ignore far sight case // ignore far sight case
(*itr)->UpdateVisibilityOf((*itr),&i_player); (*itr)->UpdateVisibilityOf((*itr),&i_player);
i_player.UpdateVisibilityOf(&i_player,(*itr),i_data,i_data_updates,i_visibleNow); i_player.UpdateVisibilityOf(&i_player,(*itr),i_data,i_visibleNow);
i_clientGUIDs.erase((*itr)->GetGUID()); i_clientGUIDs.erase((*itr)->GetGUID());
} }
} }
@ -68,17 +68,6 @@ VisibleNotifier::Notify()
DEBUG_FILTER_LOG(LOG_FILTER_VISIBILITY_CHANGES, "%s is out of range (no in active cells set) now for player %u",itr->GetString().c_str(),i_player.GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_VISIBILITY_CHANGES, "%s is out of range (no in active cells set) now for player %u",itr->GetString().c_str(),i_player.GetGUIDLow());
} }
// send update to other players (except player updates that already sent using SendUpdateToPlayer)
for(UpdateDataMapType::iterator iter = i_data_updates.begin(); iter != i_data_updates.end(); ++iter)
{
if(iter->first==&i_player)
continue;
WorldPacket packet;
iter->second.BuildPacket(&packet);
iter->first->GetSession()->SendPacket(&packet);
}
if( i_data.HasData() ) if( i_data.HasData() )
{ {
// send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer) // send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer)

View file

@ -40,7 +40,6 @@ namespace MaNGOS
{ {
Player &i_player; Player &i_player;
UpdateData i_data; UpdateData i_data;
UpdateDataMapType i_data_updates;
ObjectGuidSet i_clientGUIDs; ObjectGuidSet i_clientGUIDs;
std::set<WorldObject*> i_visibleNow; std::set<WorldObject*> i_visibleNow;

View file

@ -29,27 +29,24 @@
#include "DBCEnums.h" #include "DBCEnums.h"
template<class T> template<class T>
inline void inline void MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m)
MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m)
{ {
WorldObject const* viewPoint = i_player.GetViewPoint(); WorldObject const* viewPoint = i_player.GetViewPoint();
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
i_player.UpdateVisibilityOf(viewPoint,iter->getSource(),i_data,i_data_updates,i_visibleNow); i_player.UpdateVisibilityOf(viewPoint,iter->getSource(), i_data, i_visibleNow);
i_clientGUIDs.erase(iter->getSource()->GetGUID()); i_clientGUIDs.erase(iter->getSource()->GetGUID());
} }
} }
inline void inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m)
MaNGOS::ObjectUpdater::Visit(CreatureMapType &m)
{ {
for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
iter->getSource()->Update(i_timeDiff); iter->getSource()->Update(i_timeDiff);
} }
inline void inline void MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m)
MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m)
{ {
for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
@ -61,7 +58,7 @@ MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m)
// Cancel Trade // Cancel Trade
if (i_player.GetTrader()==iter->getSource()) if (i_player.GetTrader()==iter->getSource())
// iteraction distance // iteraction distance
if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) if (!i_player.IsWithinDistInMap(iter->getSource(), INTERACTION_DISTANCE))
i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows
} }
} }
@ -94,8 +91,7 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
} }
} }
inline void inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m)
MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m)
{ {
if (!i_player.isAlive() || i_player.isInFlight()) if (!i_player.isAlive() || i_player.isInFlight())
return; return;
@ -108,8 +104,7 @@ MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m)
} }
template<> template<>
inline void inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m)
MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m)
{ {
if(!i_creature.isAlive()) if(!i_creature.isAlive())
return; return;
@ -121,8 +116,7 @@ MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m)
} }
template<> template<>
inline void inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m)
MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m)
{ {
if (!i_creature.isAlive()) if (!i_creature.isAlive())
return; return;
@ -174,9 +168,11 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId()); SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); SpellEffectIndex eff_index = i_dynobject.GetEffIndex();
// Check target immune to spell or aura // Check target immune to spell or aura
if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index)) if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index))
return; return;
// Apply PersistentAreaAura on target // Apply PersistentAreaAura on target
PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster()); PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster());
target->AddAura(Aur); target->AddAura(Aur);
@ -184,16 +180,14 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
} }
template<> template<>
inline void inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m)
MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m)
{ {
for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
VisitHelper(itr->getSource()); VisitHelper(itr->getSource());
} }
template<> template<>
inline void inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m)
MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m)
{ {
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
VisitHelper(itr->getSource()); VisitHelper(itr->getSource());

View file

@ -19202,7 +19202,7 @@ inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, GameObject* target)
} }
template<class T> template<class T>
void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, UpdateDataMapType& /*data_updates*/, std::set<WorldObject*>& visibleNow) void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, std::set<WorldObject*>& visibleNow)
{ {
if(HaveAtClient(target)) if(HaveAtClient(target))
{ {
@ -19231,11 +19231,11 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD
} }
} }
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Player* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Creature* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
void Player::InitPrimaryProfessions() void Player::InitPrimaryProfessions()
{ {

View file

@ -2201,7 +2201,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target); void UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target);
template<class T> template<class T>
void UpdateVisibilityOf(WorldObject const* viewPoint,T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); void UpdateVisibilityOf(WorldObject const* viewPoint,T* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
// Stealth detection system // Stealth detection system
void HandleStealthedUnitsDetection(); void HandleStealthedUnitsDetection();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10019" #define REVISION_NR "10020"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__