diff options
author | megamage <none@none> | 2009-04-20 15:07:45 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-20 15:07:45 -0500 |
commit | 0faac2574245df5b32757a933a836959323c6fcb (patch) | |
tree | e8af27d692381b36e35e220e9b4cade8c2288fec /src | |
parent | 8888038f1efb1d0222f4054f75d78bd2ce81d4a8 (diff) |
*Fix a crash caused by grid notification.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Map.cpp | 74 |
1 files changed, 4 insertions, 70 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index ebd88b38c47..e2d457d4dde 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -527,92 +527,26 @@ Map::Add(T *obj) void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self, bool to_possessor) { - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - - if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) - { - sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); - return; - } - - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - - if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) - return; - Trinity::MessageDeliverer post_man(*player, msg, to_possessor, to_self); - TypeContainerVisitor<Trinity::MessageDeliverer, WorldTypeMapContainer > message(post_man); - CellLock<ReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, message, *this); + VisitWorld(player->GetPositionX(), player->GetPositionY(), World::GetMaxVisibleDistance(), post_man); } void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg, bool to_possessor) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - - if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) - { - sLog.outError("Map::MessageBroadcast: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); - return; - } - - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) - return; - Trinity::ObjectMessageDeliverer post_man(*obj, msg, to_possessor); - TypeContainerVisitor<Trinity::ObjectMessageDeliverer, WorldTypeMapContainer > message(post_man); - CellLock<ReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, message, *this); + VisitWorld(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), post_man); } void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, bool to_self, bool to_possessor, bool own_team_only) { - CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - - if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) - { - sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord); - return; - } - - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - - if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) - return; - Trinity::MessageDistDeliverer post_man(*player, msg, to_possessor, dist, to_self, own_team_only); - TypeContainerVisitor<Trinity::MessageDistDeliverer , WorldTypeMapContainer > message(post_man); - CellLock<ReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, message, *this); + VisitWorld(player->GetPositionX(), player->GetPositionY(), World::GetMaxVisibleDistance(), post_man); } void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist, bool to_possessor) { - CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); - - if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) - { - sLog.outError("Map::MessageBroadcast: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); - return; - } - - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) - return; - Trinity::ObjectMessageDistDeliverer post_man(*obj, msg, to_possessor, dist); - TypeContainerVisitor<Trinity::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man); - CellLock<ReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, message, *this); + VisitWorld(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), post_man); } bool Map::loaded(const GridPair &p) const |