diff options
| author | Aokromes <Aokromes@users.noreply.github.com> | 2016-07-06 10:23:12 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-02-04 23:59:27 +0100 |
| commit | 6d9a0ade7be8282ec489abd033f0676621a99fb5 (patch) | |
| tree | bb387c828bd3a9949a350bb600272eb19a305bda /src | |
| parent | ad6e0b6d79d1110898b7fa530a5e35c3b7763dc8 (diff) | |
Core/Mmaps: Charge ignoring z position of target (#17516)
* Core/Mmaps: Charge ignoring z position of target
By cemak closes #15011
(cherry picked from commit fda9f1a1367dfe5f7829b8223afa2057429a8020)
Typo fix
(cherry picked from commit fcffdc38a7366042d472c93a9bec864992b0f195)
And another typo fix
(cherry picked from commit e0cc650ea9339996b2b408f8168f6588bd088e42)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Movement/PathGenerator.cpp | 5 | ||||
| -rw-r--r-- | src/server/game/Movement/PathGenerator.h | 1 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 4dcc3253317..9d18ceb33b4 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -943,3 +943,8 @@ void PathGenerator::ReducePathLenghtByDist(float dist) nextVec = currVec; // we're going backwards } } + +bool PathGenerator::IsInvalidDestinationZ(Unit const* target) const +{ + return (target->GetPositionZ() - GetActualEndPosition().z) > 5.0f; +} diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h index 3cad62abf25..a3e88b8a705 100644 --- a/src/server/game/Movement/PathGenerator.h +++ b/src/server/game/Movement/PathGenerator.h @@ -58,6 +58,7 @@ class TC_GAME_API PathGenerator // Calculate the path from owner to given destination // return: true if new path was calculated, false otherwise (no change needed) bool CalculatePath(float destX, float destY, float destZ, bool forceDest = false, bool straightLine = false); + bool IsInvalidDestinationZ(Unit const* target) const; // option setters - use optional void SetUseStraightPath(bool useStraightPath) { _useStraightPath = useStraightPath; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index af5c4f8d0b5..6fd3c795c54 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5270,7 +5270,11 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_OUT_OF_RANGE; else if (!result || m_preGeneratedPath.GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE)) return SPELL_FAILED_NOPATH; + else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if not in a straight line + return SPELL_FAILED_NOPATH; } + else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if in a straight line + return SPELL_FAILED_NOPATH; m_preGeneratedPath.ReducePathLenghtByDist(objSize); // move back } |
