[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:
VladimirMangos 2010-09-04 06:22:29 +04:00
parent 8474b2cbb0
commit 94e6bb47e7
2 changed files with 14 additions and 14 deletions

View file

@ -1035,6 +1035,12 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); 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 // look from a bit higher pos to find the floor
vmapHeight = vmgr->getHeight(GetId(), x, y, z2, maxSearchDist); vmapHeight = vmgr->getHeight(GetId(), x, y, z2, maxSearchDist);
} }
@ -1064,12 +1070,6 @@ 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;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10438" #define REVISION_NR "10439"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__