diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 853664df79..a22cdfa67b 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2251,7 +2251,15 @@ float Map::GetWaterOrGroundLevel(std::set const& phases, float x, float LiquidData liquid_status; ZLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status); - return res ? liquid_status.level : ground_z; + switch (res) + { + case LIQUID_MAP_ABOVE_WATER: + return std::max(liquid_status.level, ground_z); + case LIQUID_MAP_NO_WATER: + return ground_z; + default: + return liquid_status.level; + } } return VMAP_INVALID_HEIGHT_VALUE; @@ -2639,7 +2647,7 @@ bool Map::getObjectHitPos(std::set const& phases, float x1, float y1, fl float Map::GetHeight(std::set const& phases, float x, float y, float z, bool vmap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const { - return std::max(GetHeight(x, y, z, vmap, maxSearchDist), _dynamicTree.getHeight(x, y, z, maxSearchDist, phases)); + return std::max(GetHeight(x, y, z, vmap, maxSearchDist), GetGameObjectFloor(phases, x, y, z, maxSearchDist)); } bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 03e4a7a678..72acba3b15 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -522,7 +522,7 @@ class TC_GAME_API Map : public GridRefManager bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);} float GetGameObjectFloor(uint32 phasemask, float x, float y, float z, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const { - return _dynamicTree.getHeight(x, y, z, phasemask, maxSearchDist); + return _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask); } bool getObjectHitPos(std::set const& phases, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);