Core/Movement: setting path length limits will now round the amount of smooth path points up instead of down to reduce edge cases in which charge effects close to their maximum cast range would return no path

This commit is contained in:
Ovahlord
2020-09-11 20:50:57 +02:00
parent dcc3ed4e54
commit 5cc2b41146
2 changed files with 9 additions and 1 deletions

View File

@@ -1031,6 +1031,14 @@ bool PathGenerator::IsInvalidDestinationZ(Unit const* target) const
return (target->GetPositionZ() - GetActualEndPosition().z) > 5.0f;
}
void PathGenerator::SetPathLengthLimit(float length)
{
if (!(uint32(length) % 4))
_pointPathLimit = std::min<uint32>(length / SMOOTH_PATH_STEP_SIZE, MAX_POINT_PATH_LENGTH);
else
_pointPathLimit = std::min<uint32>((length + SMOOTH_PATH_STEP_SIZE) / SMOOTH_PATH_STEP_SIZE, MAX_POINT_PATH_LENGTH);
}
void PathGenerator::AddFarFromPolyFlags(bool startFarFromPoly, bool endFarFromPoly)
{
if (startFarFromPoly)

View File

@@ -66,7 +66,7 @@ class TC_GAME_API PathGenerator
// option setters - use optional
void SetUseStraightPath(bool useStraightPath) { _useStraightPath = useStraightPath; }
void SetPathLengthLimit(float distance) { _pointPathLimit = std::min<uint32>(uint32(distance/SMOOTH_PATH_STEP_SIZE), MAX_POINT_PATH_LENGTH); }
void SetPathLengthLimit(float distance);
void SetUseRaycast(bool useRaycast) { _useRaycast = useRaycast; }
// result getters