diff options
| author | megamage <none@none> | 2009-06-14 10:06:01 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-06-14 10:06:01 -0500 |
| commit | 85a50c7ce2401c0090725677a790d4617505b7c2 (patch) | |
| tree | e0f5bf4176b843a78cd323a60d2e99a13c0cf181 /src/game/Player.cpp | |
| parent | 39b2f6a5bbdb602d6906c93333c9988db25b8780 (diff) | |
[8007] Do not create empty maps while sending packets. Author: Ambal
--HG--
branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
| -rw-r--r-- | src/game/Player.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 9e86cab3615..02556d4f199 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5681,17 +5681,43 @@ void Player::SaveRecallPosition() void Player::SendMessageToSet(WorldPacket *data, bool self) { - GetMap()->MessageBroadcast(this, data, 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); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) { - GetMap()->MessageDistBroadcast(this, data, dist, self); + Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + if(_map) + { + _map->MessageDistBroadcast(this, data, dist, self); + return; + } + + if(self) + GetSession()->SendPacket(data); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) { - GetMap()->MessageDistBroadcast(this, data, dist, self, 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); } void Player::SendDirectMessage(WorldPacket *data) |
