diff options
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-x | src/server/game/Maps/Map.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index df5ec540427..71fc2ef00a1 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -31,6 +31,7 @@ #include "ObjectMgr.h" #include "Group.h" #include "LFGMgr.h" +#include "DynamicTree.h" union u_map_magic { @@ -368,6 +369,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) // Add resurrectable corpses to world object list in grid sObjectAccessor->AddCorpsesToGrid(GridCoord(cell.GridX(), cell.GridY()), grid->GetGridType(cell.CellX(), cell.CellY()), this); + Balance(); return true; } @@ -498,6 +500,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj void Map::Update(const uint32 t_diff) { + m_dyn_tree.update(t_diff); /// update worldsessions for existing players for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter) { @@ -1544,7 +1547,7 @@ float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NU if (const_cast<Map*>(this)->GetGrid(x, y)) { // we need ground level (including grid height version) for proper return water level in point - float ground_z = GetHeight(x, y, z, true, 50.0f); + float ground_z = GetHeight(PHASEMASK_NORMAL, x, y, z, true, 50.0f); if (ground) *ground = ground_z; @@ -1793,6 +1796,17 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } +bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const +{ + return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2) + && m_dyn_tree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask); +} + +float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=true*/, float maxSearchDist/*=DEFAULT_HEIGHT_SEARCH*/) const +{ + return std::max<float>(GetHeight(x, y, z, vmap, maxSearchDist), m_dyn_tree.getHeight(x, y, z, maxSearchDist, phasemask)); +} + bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const { // Check surface in x, y point for liquid |