mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Pathfinding): Remove unnecesary LiquidData Z check (#10251)
* Core/Pathfinding: Remove unnecesary LiquidData Z check *Remove an unnecessary LiquidData status check for Z correcing points count added probably for SunwellCore before the Movement Rewritte done last year , this fixes global pathfinding problems on all Movement Generators including all pathfinding problems that make creatures and players go through textures. * Update PathGenerator.cpp Typo on last commit
This commit is contained in:
@@ -576,46 +576,13 @@ void PathGenerator::BuildPointPath(const float* startPoint, const float* endPoin
|
||||
}
|
||||
|
||||
_pathPoints.resize(pointCount);
|
||||
uint32 newPointCount = 0;
|
||||
for (uint32 i = 0; i < pointCount; ++i) {
|
||||
G3D::Vector3 vector = G3D::Vector3(pathPoints[i * VERTEX_SIZE + 2], pathPoints[i * VERTEX_SIZE], pathPoints[i * VERTEX_SIZE + 1]);
|
||||
LiquidData const& liquidData = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), vector.x, vector.y, vector.z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS);
|
||||
// One of the points is not in the water
|
||||
if (liquidData.Status == LIQUID_MAP_UNDER_WATER)
|
||||
{
|
||||
// if the first point is under water
|
||||
// then set a proper z for it
|
||||
if (i == 0)
|
||||
{
|
||||
vector.z = std::fmaxf(vector.z, _source->GetPositionZ());
|
||||
_pathPoints[newPointCount] = vector;
|
||||
}
|
||||
// if the last point is under water
|
||||
// then set the desired end position instead
|
||||
else if (i == pointCount - 1)
|
||||
{
|
||||
_pathPoints[newPointCount] = GetActualEndPosition();
|
||||
}
|
||||
// if one of the mid-points of the path is underwater
|
||||
// then we can create a shortcut between the previous one
|
||||
// and the next one by not including it inside the list
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_pathPoints[newPointCount] = vector;
|
||||
}
|
||||
|
||||
newPointCount++;
|
||||
}
|
||||
|
||||
_pathPoints.resize(newPointCount);
|
||||
for (uint32 i = 0; i < pointCount; ++i)
|
||||
_pathPoints[i] = G3D::Vector3(pathPoints[i * VERTEX_SIZE + 2], pathPoints[i * VERTEX_SIZE], pathPoints[i * VERTEX_SIZE + 1]);
|
||||
|
||||
NormalizePath();
|
||||
|
||||
// first point is always our current location - we need the next one
|
||||
SetActualEndPosition(_pathPoints[newPointCount - 1]);
|
||||
SetActualEndPosition(_pathPoints[pointCount - 1]);
|
||||
|
||||
// force the given destination, if needed
|
||||
if (_forceDestination &&
|
||||
|
||||
Reference in New Issue
Block a user