Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon
Port From (https://github.com/TrinityCore/TrinityCore/commit/dd929665e564e01b5346844adb96d8fd0eb710c4)
This commit is contained in:
@@ -236,19 +236,14 @@ namespace Game.Movement
|
|||||||
// *** poly path generating logic ***
|
// *** poly path generating logic ***
|
||||||
|
|
||||||
// start and end are on same polygon
|
// start and end are on same polygon
|
||||||
// just need to move in straight line
|
// handle this case as if they were 2 different polygons, building a line path split in some few points
|
||||||
if (startPoly == endPoly)
|
if (startPoly == endPoly)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Maps, "++ BuildPolyPath . (startPoly == endPoly)\n");
|
Log.outDebug(LogFilter.Maps, "++ BuildPolyPath . (startPoly == endPoly)\n");
|
||||||
|
|
||||||
BuildShortcut();
|
|
||||||
|
|
||||||
_pathPolyRefs[0] = startPoly;
|
_pathPolyRefs[0] = startPoly;
|
||||||
_polyLength = 1;
|
_pathPolyRefs[1] = endPoly;
|
||||||
|
_polyLength = 2;
|
||||||
pathType = farFromPoly ? PathType.Incomplete : PathType.Normal;
|
|
||||||
Log.outDebug(LogFilter.Maps, "BuildPolyPath . path type {0}\n", pathType);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for startPoly/endPoly in current path
|
// look for startPoly/endPoly in current path
|
||||||
|
|||||||
@@ -4922,7 +4922,7 @@ namespace Game.Spells
|
|||||||
// first try with raycast, if it fails fall back to normal path
|
// first try with raycast, if it fails fall back to normal path
|
||||||
bool result = m_preGeneratedPath.CalculatePath(target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), false, false);
|
bool result = m_preGeneratedPath.CalculatePath(target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), false, false);
|
||||||
if (m_preGeneratedPath.GetPathType().HasAnyFlag(PathType.Short))
|
if (m_preGeneratedPath.GetPathType().HasAnyFlag(PathType.Short))
|
||||||
return SpellCastResult.OutOfRange;
|
return SpellCastResult.NoPath;
|
||||||
else if (!result || m_preGeneratedPath.GetPathType().HasAnyFlag(PathType.NoPath | PathType.Incomplete))
|
else if (!result || m_preGeneratedPath.GetPathType().HasAnyFlag(PathType.NoPath | PathType.Incomplete))
|
||||||
return SpellCastResult.NoPath;
|
return SpellCastResult.NoPath;
|
||||||
else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
|
else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
|
||||||
|
|||||||
Reference in New Issue
Block a user