aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-12 23:23:53 -0500
committermegamage <none@none>2009-08-12 23:23:53 -0500
commit729242058398f197d62585c334244fc9f817fd47 (patch)
tree8cac470fe4070c1c98a6334f32aa7f245c2417a2 /src/game/Player.cpp
parent92769d3ffeda9fbdd12760e453bc99320565ca98 (diff)
*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
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)