mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10439] Increase search distance at height search if we know expected limit.
When we know that point above .map ground search at least until ground level for vmap height. Good news: Fishing bobber still fixed ;) Good news: Mobs not follow into the air again
This commit is contained in:
parent
8474b2cbb0
commit
94e6bb47e7
2 changed files with 14 additions and 14 deletions
|
|
@ -1016,12 +1016,12 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
|||
// find raw .map surface under Z coordinates
|
||||
float mapHeight;
|
||||
float z2 = z + 2.f;
|
||||
if(GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||
if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||
{
|
||||
float _mapheight = gmap->getHeight(x,y);
|
||||
|
||||
// look from a bit higher pos to find the floor, ignore under surface case
|
||||
if(z2 > _mapheight)
|
||||
if (z2 > _mapheight)
|
||||
mapHeight = _mapheight;
|
||||
else
|
||||
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
|
|
@ -1030,11 +1030,17 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
|||
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
|
||||
float vmapHeight;
|
||||
if(pUseVmaps)
|
||||
if (pUseVmaps)
|
||||
{
|
||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
if(vmgr->isHeightCalcEnabled())
|
||||
if (vmgr->isHeightCalcEnabled())
|
||||
{
|
||||
// if mapHeight has been found search vmap height at least until mapHeight point
|
||||
// this prevent case when original Z "too high above ground and vmap height search fail"
|
||||
// this will not affect most normal cases (no map in instance, or stay at ground at continent)
|
||||
if (mapHeight > INVALID_HEIGHT && z2 - mapHeight > maxSearchDist)
|
||||
maxSearchDist = z2 - mapHeight + 1.0f; // 1.0 make sure that we not fail for case when map height near but above for vamp height
|
||||
|
||||
// look from a bit higher pos to find the floor
|
||||
vmapHeight = vmgr->getHeight(GetId(), x, y, z2, maxSearchDist);
|
||||
}
|
||||
|
|
@ -1047,15 +1053,15 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
|||
// 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 (vmapHeight > INVALID_HEIGHT)
|
||||
{
|
||||
if( mapHeight > INVALID_HEIGHT )
|
||||
if (mapHeight > INVALID_HEIGHT)
|
||||
{
|
||||
// we have mapheight and vmapheight and must select more appropriate
|
||||
|
||||
// we are already under the surface or vmap height above map heigt
|
||||
// or if the distance of the vmap height is less the land height distance
|
||||
if( z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z) )
|
||||
if (z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z))
|
||||
return vmapHeight;
|
||||
else
|
||||
return mapHeight; // better use .map surface height
|
||||
|
|
@ -1064,12 +1070,6 @@ 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 && z2 - mapHeight > maxSearchDist)
|
||||
{
|
||||
// with vmaps we can only give definite result up to maxSearchDist,
|
||||
// in other cases mapHeight might or might not be the true height.
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
return mapHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10438"
|
||||
#define REVISION_NR "10439"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue