From 729242058398f197d62585c334244fc9f817fd47 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 12 Aug 2009 23:23:53 -0500 Subject: *Rewrite and simplify sendmessagetoset functions. This fixes the bug that player cannot see dummy aura is cancelled when puppet is far away. --HG-- branch : trunk --- src/game/Player.cpp | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'src/game/Player.cpp') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b43caaa3c40..4f41bb44cda 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5813,43 +5813,30 @@ void Player::SaveRecallPosition() void Player::SendMessageToSet(WorldPacket *data, bool self) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); - if(_map) - { - _map->MessageBroadcast(this, data, self); - return; - } - - //if player is not in world and map in not created/already destroyed - //no need to create one, just send packet for itself! if(self) GetSession()->SendPacket(data); + + // we use World::GetMaxVisibleDistance() because i cannot see why not use a distance + Trinity::MessageDistDeliverer notifier(this, data, World::GetMaxVisibleDistance()); + VisitNearbyWorldObject(World::GetMaxVisibleDistance(), notifier); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); - if(_map) - { - _map->MessageDistBroadcast(this, data, dist, self); - return; - } - if(self) GetSession()->SendPacket(data); + + Trinity::MessageDistDeliverer notifier(this, data, dist); + VisitNearbyWorldObject(dist, notifier); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); - if(_map) - { - _map->MessageDistBroadcast(this, data, dist, self, own_team_only); - return; - } - if(self) GetSession()->SendPacket(data); + + Trinity::MessageDistDeliverer notifier(this, data, dist, own_team_only); + VisitNearbyWorldObject(dist, notifier); } void Player::SendDirectMessage(WorldPacket *data) -- cgit v1.2.3