mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11068] Prevent infinity creature fall at fail get heght.
Also fix wrong use INVALID_HEIGHT as height value. It must be used only for _check_ height, and DON'T must use as real height value. Must fix some wrong height check results. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
21cc7cd179
commit
d699d0973b
4 changed files with 9 additions and 7 deletions
|
|
@ -1464,10 +1464,11 @@ bool Creature::FallGround()
|
||||||
// use larger distance for vmap height search than in most other cases
|
// use larger distance for vmap height search than in most other cases
|
||||||
float tz = GetTerrain()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);
|
float tz = GetTerrain()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||||
|
|
||||||
if (tz < INVALID_HEIGHT)
|
if (tz <= INVALID_HEIGHT)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("FallGround: creature %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
|
DEBUG_LOG("FallGround: creature %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
|
||||||
GetEntry(), GetMap()->GetId(), GetPositionX(), GetPositionX(), GetPositionZ(), tz);
|
GetEntry(), GetMap()->GetId(), GetPositionX(), GetPositionX(), GetPositionZ(), tz);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abort too if the ground is very near
|
// Abort too if the ground is very near
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ GridMap::GridMap()
|
||||||
m_area_map = NULL;
|
m_area_map = NULL;
|
||||||
|
|
||||||
// Height level data
|
// Height level data
|
||||||
m_gridHeight = INVALID_HEIGHT;
|
m_gridHeight = INVALID_HEIGHT_VALUE;
|
||||||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||||
m_V9 = NULL;
|
m_V9 = NULL;
|
||||||
m_V8 = NULL;
|
m_V8 = NULL;
|
||||||
|
|
@ -55,7 +55,7 @@ GridMap::GridMap()
|
||||||
m_liquid_offY = 0;
|
m_liquid_offY = 0;
|
||||||
m_liquid_width = 0;
|
m_liquid_width = 0;
|
||||||
m_liquid_height = 0;
|
m_liquid_height = 0;
|
||||||
m_liquidLevel = INVALID_HEIGHT;
|
m_liquidLevel = INVALID_HEIGHT_VALUE;
|
||||||
m_liquid_type = NULL;
|
m_liquid_type = NULL;
|
||||||
m_liquid_map = NULL;
|
m_liquid_map = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -478,10 +478,10 @@ float GridMap::getLiquidLevel(float x, float y)
|
||||||
int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX;
|
int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX;
|
||||||
|
|
||||||
if (cx_int < 0 || cx_int >=m_liquid_height)
|
if (cx_int < 0 || cx_int >=m_liquid_height)
|
||||||
return INVALID_HEIGHT;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
|
||||||
if (cy_int < 0 || cy_int >=m_liquid_width )
|
if (cy_int < 0 || cy_int >=m_liquid_width )
|
||||||
return INVALID_HEIGHT;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
|
||||||
return m_liquid_map[cx_int*m_liquid_width + cy_int];
|
return m_liquid_map[cx_int*m_liquid_width + cy_int];
|
||||||
}
|
}
|
||||||
|
|
@ -930,7 +930,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
|
||||||
{
|
{
|
||||||
GridMapLiquidStatus result = LIQUID_MAP_NO_WATER;
|
GridMapLiquidStatus result = LIQUID_MAP_NO_WATER;
|
||||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||||
float liquid_level, ground_level = INVALID_HEIGHT;
|
float liquid_level, ground_level = INVALID_HEIGHT_VALUE;
|
||||||
uint32 liquid_type;
|
uint32 liquid_type;
|
||||||
if (vmgr->GetLiquidLevel(GetMapId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type))
|
if (vmgr->GetLiquidLevel(GetMapId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,7 @@ typedef ACE_Atomic_Op<ACE_Thread_Mutex, long> AtomicLong;
|
||||||
|
|
||||||
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
|
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
|
||||||
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
|
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
|
||||||
|
#define INVALID_HEIGHT_VALUE -200000.0f // for return, must be equal to VMAP_INVALID_HEIGHT_VALUE, check value for unknown height is VMAP_INVALID_HEIGHT
|
||||||
#define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
|
#define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
|
||||||
#define DEFAULT_HEIGHT_SEARCH 10.0f // default search distance to find height at nearby locations
|
#define DEFAULT_HEIGHT_SEARCH 10.0f // default search distance to find height at nearby locations
|
||||||
#define DEFAULT_WATER_SEARCH 50.0f // default search distance to case detection water level
|
#define DEFAULT_WATER_SEARCH 50.0f // default search distance to case detection water level
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11067"
|
#define REVISION_NR "11068"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue