From ff3beb0e92f4c48e6dd0546f9e3e85cf07a8cc73 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Thu, 24 Aug 2023 20:51:15 +0200 Subject: [PATCH] Core/Movement: added some overloads to PathGenerator::CalculatePath --- src/server/game/Movement/PathGenerator.cpp | 11 +++++++++++ src/server/game/Movement/PathGenerator.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index bb4d5cacd4..b340a731e7 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -23,6 +23,7 @@ #include "MMapFactory.h" #include "MMapManager.h" #include "Log.h" +#include "Position.h" #include "DisableMgr.h" #include "DetourCommon.h" #include "DetourNavMeshQuery.h" @@ -61,6 +62,16 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo return CalculatePath(PositionToVector3(_source->GetPosition()), G3D::Vector3(destX, destY, destZ), forceDest); } +bool PathGenerator::CalculatePath(Position const& destination, bool forceDest /*= false*/) +{ + return CalculatePath(PositionToVector3(_source->GetPosition()), PositionToVector3(destination), forceDest); +} + +bool PathGenerator::CalculatePath(Position const& startPosition, Position const& destination, bool forceDest /*= false*/) +{ + return CalculatePath(PositionToVector3(startPosition), PositionToVector3(destination), forceDest); +} + bool PathGenerator::CalculatePath(G3D::Vector3 const& startPoint, G3D::Vector3 const& endPoint, bool forceDest /*= false*/) { if (!Trinity::IsValidMapCoord(startPoint.x, startPoint.y, startPoint.z) || !Trinity::IsValidMapCoord(endPoint.x, endPoint.y, endPoint.z)) diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h index cb6da39535..e3d75bdc37 100644 --- a/src/server/game/Movement/PathGenerator.h +++ b/src/server/game/Movement/PathGenerator.h @@ -26,6 +26,7 @@ class Unit; class WorldObject; +struct Position; // 74*4.0f=296y number_of_points*interval = max_path_len // this is way more than actual evade range @@ -67,6 +68,8 @@ 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 CalculatePath(Position const& destination, bool forceDest = false); + bool CalculatePath(Position const& startPosition, Position const& destination, bool forceDest = false); // Calculates the path from start point to given destination bool CalculatePath(G3D::Vector3 const& startPoint, G3D::Vector3 const& endPoint, bool forceDest = false); bool IsInvalidDestinationZ(Unit const* target) const;