diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 49c3298517..c3dcace5ff 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2451,10 +2451,8 @@ float Map::GetWaterOrGroundLevel(PhaseShift const& phaseShift, float x, float y, float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const { // find raw .map surface under Z coordinates - float mapHeight = VMAP_INVALID_HEIGHT_VALUE; uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, this, x, y); - if (GridMap* gmap = m_parentTerrainMap->GetGrid(terrainMapId, x, y)) - float mapHeight = gmap->getHeight(x, y); + float const mapHeight = GetGridHeight(terrainMapId, x, y); float vmapHeight = VMAP_INVALID_HEIGHT_VALUE; if (checkVMap) @@ -2486,6 +2484,14 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float return mapHeight; // explicitly use map data } +float Map::GetGridHeight(uint32 mapId, float x, float y) const +{ + if (GridMap* gmap = m_parentTerrainMap->GetGrid(mapId, x, y)) + return gmap->getHeight(x, y); + + return VMAP_INVALID_HEIGHT_VALUE; +} + static inline bool IsInWMOInterior(uint32 mogpFlags) { return (mogpFlags & 0x2000) != 0; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 9a99d6e3fe..64e2a9e252 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -564,6 +564,7 @@ class TC_GAME_API Map : public GridRefManager BattlegroundMap const* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast(this); return nullptr; } float GetWaterOrGroundLevel(PhaseShift const& phaseShift, float x, float y, float z, float* ground = nullptr, bool swim = false, float collisionHeight = 2.03128f) const; // DEFAULT_COLLISION_HEIGHT in Object.h + float GetGridHeight(uint32 mapId, float x, float y) const; float GetHeight(PhaseShift const& phaseShift, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const { return std::max(GetStaticHeight(phaseShift, x, y, z, vmap, maxSearchDist), GetGameObjectFloor(phaseShift, x, y, z, maxSearchDist)); } float GetHeight(PhaseShift const& phaseShift, Position const& pos, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const { return GetHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), vmap, maxSearchDist); }