aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-xsrc/server/game/Maps/Map.cpp40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 34bc5f141f2..46c0ca1d8f5 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -1528,41 +1528,28 @@ inline GridMap* Map::GetGrid(float x, float y)
return GridMaps[gx][gy];
}
-float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchDist) const
+float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
{
// find raw .map surface under Z coordinates
- float mapHeight;
+ float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
{
- float _mapheight = gmap->getHeight(x, y);
-
+ float gridHeight = gmap->getHeight(x, y);
// look from a bit higher pos to find the floor, ignore under surface case
- if (z + 2.0f > _mapheight)
- mapHeight = _mapheight;
- else
- mapHeight = VMAP_INVALID_HEIGHT_VALUE;
+ if (z + 2.0f > gridHeight)
+ mapHeight = gridHeight;
}
- else
- mapHeight = VMAP_INVALID_HEIGHT_VALUE;
- float vmapHeight;
- if (pUseVmaps)
+ float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
+ if (checkVMap)
{
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
if (vmgr->isHeightCalcEnabled())
- {
- // look from a bit higher pos to find the floor
- vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f, maxSearchDist);
- }
- else
- vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
+ vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f, maxSearchDist); // look from a bit higher pos to find the floor
}
- else
- vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
// mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
// vmapheight set for any under Z value or <= INVALID_HEIGHT
-
if (vmapHeight > INVALID_HEIGHT)
{
if (mapHeight > INVALID_HEIGHT)
@@ -1579,15 +1566,8 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
else
return vmapHeight; // we have only vmapHeight (if have)
}
- else
- {
- if (!pUseVmaps)
- return mapHeight; // explicitly use map data (if have)
- else if (mapHeight > INVALID_HEIGHT && (z < mapHeight + 2 || z == MAX_HEIGHT))
- return mapHeight; // explicitly use map data if original z < mapHeight but map found (z+2 > mapHeight)
- else
- return VMAP_INVALID_HEIGHT_VALUE; // we not have any height
- }
+
+ return mapHeight; // explicitly use map data
}
inline bool IsOutdoorWMO(uint32 mogpFlags, int32 /*adtId*/, int32 /*rootId*/, int32 /*groupId*/, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)