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 f847fca56e2..2cefeb63532 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2443,12 +2443,9 @@ float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float { // find raw .map surface under Z coordinates float mapHeight = VMAP_INVALID_HEIGHT_VALUE; - if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) - { - float gridHeight = gmap->getHeight(x, y); - if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) - mapHeight = gridHeight; - } + float gridHeight = GetGridHeight(x, y); + if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) + mapHeight = gridHeight; float vmapHeight = VMAP_INVALID_HEIGHT_VALUE; if (checkVMap) @@ -2470,16 +2467,24 @@ float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, 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(float x, float y) const +{ + if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) + return gmap->getHeight(x, y); + + return VMAP_INVALID_HEIGHT_VALUE; +} + float Map::GetMinHeight(float x, float y) const { if (GridMap const* grid = const_cast<Map*>(this)->GetGrid(x, y)) |