diff options
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r-- | src/server/game/Maps/Map.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 20a8a3b32bf..8b72da34de0 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2537,12 +2537,9 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float // find raw .map surface under Z coordinates float mapHeight = VMAP_INVALID_HEIGHT_VALUE; uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, this, x, y); - if (GridMap* gmap = GetGrid(terrainMapId, x, y)) - { - float gridHeight = gmap->getHeight(x, y); - if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) - mapHeight = gridHeight; - } + float gridHeight = GetGridHeight(phaseShift, x, y); + if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) + mapHeight = gridHeight; float vmapHeight = VMAP_INVALID_HEIGHT_VALUE; if (checkVMap) @@ -2564,16 +2561,24 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float // or if the distance of the vmap height is less the land height distance if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z)) return vmapHeight; - else - return mapHeight; // better use .map surface height + + return mapHeight; // better use .map surface height } - else - return vmapHeight; // we have only vmapHeight (if have) + + return vmapHeight; // we have only vmapHeight (if have) } return mapHeight; // explicitly use map data } +float Map::GetGridHeight(PhaseShift const& phaseShift, float x, float y) +{ + if (GridMap* gmap = GetGrid(PhasingHandler::GetTerrainMapId(phaseShift, this, x, y), x, y)) + return gmap->getHeight(x, y); + + return VMAP_INVALID_HEIGHT_VALUE; +} + float Map::GetMinHeight(PhaseShift const& phaseShift, float x, float y) { if (GridMap const* grid = GetGrid(PhasingHandler::GetTerrainMapId(phaseShift, this, x, y), x, y)) |