mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[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:
parent
ea4afebff8
commit
e47e9a2218
4 changed files with 14 additions and 15 deletions
|
|
@ -1572,25 +1572,24 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
|
|||
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
if(_map)
|
||||
_map->MessageBroadcast(this, data);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageBroadcast(this, data);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->MessageDistBroadcast(this, data, dist);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageDistBroadcast(this, data, dist);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
if (IsInWorld())
|
||||
{
|
||||
MaNGOS::MessageDelivererExcept notifier(this, data, skipped_receiver);
|
||||
Cell::VisitWorldObjects(this, notifier, _map->GetVisibilityDistance());
|
||||
Cell::VisitWorldObjects(this, notifier, GetMap()->GetVisibilityDistance());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue