mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 13:37:01 +00:00
[10438] Fix GetHeight() to return height within actual search distance only.
Good news: Fixes fishing bobber Bad news: Mobs follow into the air again unless larger search distance is used
This commit is contained in:
parent
87b2ab6ba1
commit
8474b2cbb0
2 changed files with 10 additions and 3 deletions
|
|
@ -1015,12 +1015,13 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
||||||
{
|
{
|
||||||
// find raw .map surface under Z coordinates
|
// find raw .map surface under Z coordinates
|
||||||
float mapHeight;
|
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);
|
float _mapheight = gmap->getHeight(x,y);
|
||||||
|
|
||||||
// look from a bit higher pos to find the floor, ignore under surface case
|
// look from a bit higher pos to find the floor, ignore under surface case
|
||||||
if(z + 2.0f > _mapheight)
|
if(z2 > _mapheight)
|
||||||
mapHeight = _mapheight;
|
mapHeight = _mapheight;
|
||||||
else
|
else
|
||||||
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||||
|
|
@ -1035,7 +1036,7 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
||||||
if(vmgr->isHeightCalcEnabled())
|
if(vmgr->isHeightCalcEnabled())
|
||||||
{
|
{
|
||||||
// look from a bit higher pos to find the floor
|
// look from a bit higher pos to find the floor
|
||||||
vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f, maxSearchDist);
|
vmapHeight = vmgr->getHeight(GetId(), x, y, z2, maxSearchDist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||||
|
|
@ -1063,6 +1064,12 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
||||||
else
|
else
|
||||||
return vmapHeight; // we have only vmapHeight (if have)
|
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;
|
return mapHeight;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10437"
|
#define REVISION_NR "10438"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue