aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp33
1 files changed, 10 insertions, 23 deletions
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)