mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/Movement: ported some undermap fixups from a TC pull request
This commit is contained in:
@@ -2454,11 +2454,7 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float
|
||||
float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, this, x, y);
|
||||
if (GridMap* gmap = m_parentTerrainMap->GetGrid(terrainMapId, x, y))
|
||||
{
|
||||
float gridHeight = gmap->getHeight(x, y);
|
||||
if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE))
|
||||
mapHeight = gridHeight;
|
||||
}
|
||||
float mapHeight = gmap->getHeight(x, y);
|
||||
|
||||
float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
if (checkVMap)
|
||||
@@ -2480,11 +2476,11 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float
|
||||
// or if the distance of the vmap height is less the land height distance
|
||||
if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z))
|
||||
return vmapHeight;
|
||||
else
|
||||
return mapHeight; // better use .map surface height
|
||||
|
||||
return mapHeight; // better use .map surface height
|
||||
}
|
||||
else
|
||||
return vmapHeight; // we have only vmapHeight (if have)
|
||||
|
||||
return vmapHeight; // we have only vmapHeight (if have)
|
||||
}
|
||||
|
||||
return mapHeight; // explicitly use map data
|
||||
|
||||
@@ -82,7 +82,7 @@ bool ConfusedMovementGenerator<T>::DoUpdate(T* owner, uint32 diff)
|
||||
|
||||
_path->SetPathLengthLimit(30.0f);
|
||||
bool result = _path->CalculatePath(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ());
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH))
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH) || (_path->GetPathType() & PATHFIND_SHORTCUT))
|
||||
{
|
||||
_timer.Reset(100);
|
||||
return true;
|
||||
|
||||
@@ -128,7 +128,7 @@ void FleeingMovementGenerator<T>::SetTargetLocation(T* owner)
|
||||
|
||||
_path->SetPathLengthLimit(30.0f);
|
||||
bool result = _path->CalculatePath(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ());
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH))
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH) || (_path->GetPathType() & PATHFIND_SHORTCUT))
|
||||
{
|
||||
_timer.Reset(100);
|
||||
return;
|
||||
|
||||
@@ -102,7 +102,7 @@ void RandomMovementGenerator<Creature>::SetRandomLocation(Creature* owner)
|
||||
|
||||
_path->SetPathLengthLimit(30.0f);
|
||||
bool result = _path->CalculatePath(position.GetPositionX(), position.GetPositionY(), position.GetPositionZ());
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH))
|
||||
if (!result || (_path->GetPathType() & PATHFIND_NOPATH) || (_path->GetPathType() & PATHFIND_SHORTCUT))
|
||||
{
|
||||
_timer.Reset(100);
|
||||
return;
|
||||
|
||||
@@ -538,14 +538,14 @@ void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoin
|
||||
/// @todo check the exact cases
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::BuildPointPath FAILED! path sized %d returned\n", pointCount);
|
||||
BuildShortcut();
|
||||
_type = PATHFIND_NOPATH;
|
||||
_type = PathType(_type | PATHFIND_NOPATH);
|
||||
return;
|
||||
}
|
||||
else if (pointCount == _pointPathLimit)
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::BuildPointPath FAILED! path sized %d returned, lower than limit set to %d\n", pointCount, _pointPathLimit);
|
||||
BuildShortcut();
|
||||
_type = PATHFIND_SHORT;
|
||||
_type = PathType(_type | PATHFIND_SHORT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1379,9 +1379,8 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
pos.m_positionX = m_preGeneratedPath->GetActualEndPosition().x;
|
||||
pos.m_positionY = m_preGeneratedPath->GetActualEndPosition().y;
|
||||
pos.m_positionZ = m_preGeneratedPath->GetActualEndPosition().z;
|
||||
dest.Relocate(pos);
|
||||
}
|
||||
|
||||
dest.Relocate(pos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user