aboutsummaryrefslogtreecommitdiff
path: root/src/common/Collision/Management/VMapManager2.cpp
diff options
context:
space:
mode:
authorJeremy <Golrag@users.noreply.github.com>2018-02-16 20:59:19 +0100
committerjackpoz <giacomopoz@gmail.com>2018-02-16 20:59:19 +0100
commit9e0faace9a5114fc2324c2c601ba943272e0d6ff (patch)
treeee7cb56b687598c96d5e967d8f8857fc5cee8b07 /src/common/Collision/Management/VMapManager2.cpp
parent8aa10f6c65ba7fc8363a663b305fede95d0ccb58 (diff)
Core/Entities: Reduce the probability of units dropping under the map (#21322)
Reduce the probabilty of going under the map
Diffstat (limited to 'src/common/Collision/Management/VMapManager2.cpp')
-rw-r--r--src/common/Collision/Management/VMapManager2.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp
index 5b9cb34874b..922d68140d3 100644
--- a/src/common/Collision/Management/VMapManager2.cpp
+++ b/src/common/Collision/Management/VMapManager2.cpp
@@ -234,6 +234,25 @@ namespace VMAP
return VMAP_INVALID_HEIGHT_VALUE;
}
+ float VMapManager2::getCeil(unsigned int mapId, float x, float y, float z, float maxSearchDist)
+ {
+ if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
+ {
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
+ if (instanceTree != iInstanceMapTrees.end())
+ {
+ Vector3 pos = convertPositionToInternalRep(x, y, z);
+ float height = instanceTree->second->getCeil(pos, maxSearchDist);
+ if (!(height < G3D::finf()))
+ return height = VMAP_INVALID_CEIL_VALUE; // No height
+
+ return height;
+ }
+ }
+
+ return VMAP_INVALID_CEIL_VALUE;
+ }
+
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
{
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))