[10201] Broadcast packets only if worldobject is in world

There is no sense to do that for objects that not in world - those objects are unknown for clients
and their packets will be ignored

(based on SilverIce's repo commit 6305402)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
SilverIce 2010-07-17 03:26:36 +04:00 committed by VladimirMangos
parent ea4afebff8
commit e47e9a2218
4 changed files with 14 additions and 15 deletions

View file

@ -6068,8 +6068,8 @@ void Player::SaveRecallPosition()
void Player::SendMessageToSet(WorldPacket *data, bool self)
{
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
_map->MessageBroadcast(this, data, false);
if (IsInWorld())
GetMap()->MessageBroadcast(this, data, false);
//if player is not in world and map in not created/already destroyed
//no need to create one, just send packet for itself!
@ -6079,8 +6079,8 @@ void Player::SendMessageToSet(WorldPacket *data, bool self)
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
{
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
_map->MessageDistBroadcast(this, data, dist, false);
if (IsInWorld())
GetMap()->MessageDistBroadcast(this, data, dist, false);
if (self)
GetSession()->SendPacket(data);
@ -6088,8 +6088,8 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only)
{
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
_map->MessageDistBroadcast(this, data, dist, false, own_team_only);
if (IsInWorld())
GetMap()->MessageDistBroadcast(this, data, dist, false, own_team_only);
if (self)
GetSession()->SendPacket(data);