diff options
| author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2020-01-09 19:38:45 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-20 20:35:37 +0100 |
| commit | dd929665e564e01b5346844adb96d8fd0eb710c4 (patch) | |
| tree | 7dd195d37d2902bec87823b13910db349a8911d7 /src/server/game/Movement | |
| parent | fd265269720e64bf39dae205b670b25a677a3938 (diff) | |
Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon (#24036)
* Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon
Fix path generator returning shortcuts when start and end are on the same polygon by handling this case as if start and end were on 2 different polygons. This will ensure BuildPointPath() gets called which calls FindSmoothPath(), making sure each step is not longer than SMOOTH_PATH_STEP_SIZE (4 yards)
* Change ingame cast error message to SPELL_FAILED_NOPATH from SPELL_FAILED_OUT_OF_RANGE if the generated path is too long
(cherry picked from commit 29bf280e3496cf13c24ccb20e37da29d3bfa74d9)
Diffstat (limited to 'src/server/game/Movement')
| -rw-r--r-- | src/server/game/Movement/PathGenerator.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index e6b4e79ebb5..f7101cdd6de 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -246,19 +246,14 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con // *** poly path generating logic *** // 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) { TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: (startPoly == endPoly)"); - BuildShortcut(); - _pathPolyRefs[0] = startPoly; - _polyLength = 1; - - _type = farFromPoly ? PATHFIND_INCOMPLETE : PATHFIND_NORMAL; - TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: path type %d", _type); - return; + _pathPolyRefs[1] = endPoly; + _polyLength = 2; } // look for startPoly/endPoly in current path |
