![]() |
TrinityCore
|
#include <PathGenerator.h>
Public Member Functions | |
| PathGenerator (WorldObject const *owner) | |
| ~PathGenerator () | |
| PathGenerator (PathGenerator const &right)=delete | |
| PathGenerator (PathGenerator &&right)=delete | |
| PathGenerator & | operator= (PathGenerator const &right)=delete |
| PathGenerator & | operator= (PathGenerator &&right)=delete |
| bool | CalculatePath (float srcX, float srcY, float srcZ, float destX, float destY, float destZ, bool forceDest=false) |
| bool | CalculatePath (float destX, float destY, float destZ, bool forceDest=false) |
| bool | IsInvalidDestinationZ (WorldObject const *target) const |
| void | SetUseStraightPath (bool useStraightPath) |
| void | SetPathLengthLimit (float distance) |
| void | SetUseRaycast (bool useRaycast) |
| G3D::Vector3 const & | GetStartPosition () const |
| G3D::Vector3 const & | GetEndPosition () const |
| G3D::Vector3 const & | GetActualEndPosition () const |
| Movement::PointsArray const & | GetPath () const |
| float | GetPathLength () const |
| PathType | GetPathType () const |
| void | ShortenPathUntilDist (G3D::Vector3 const &target, float dist) |
Private Member Functions | |
| void | SetStartPosition (G3D::Vector3 const &point) |
| void | SetEndPosition (G3D::Vector3 const &point) |
| void | SetActualEndPosition (G3D::Vector3 const &point) |
| void | NormalizePath () |
| void | Clear () |
| bool | InRange (G3D::Vector3 const &p1, G3D::Vector3 const &p2, float r, float h) const |
| float | Dist3DSqr (G3D::Vector3 const &p1, G3D::Vector3 const &p2) const |
| bool | InRangeYZX (float const *v1, float const *v2, float r, float h) const |
| dtPolyRef | GetPathPolyByPosition (dtPolyRef const *polyPath, uint32 polyPathSize, float const *Point, float *Distance=nullptr) const |
| dtPolyRef | GetPolyByLocation (float const *Point, float *Distance) const |
| bool | HaveTile (G3D::Vector3 const &p) const |
| void | BuildPolyPath (G3D::Vector3 const &startPos, G3D::Vector3 const &endPos) |
| void | BuildPointPath (float const *startPoint, float const *endPoint) |
| void | BuildShortcut () |
| NavTerrainFlag | GetNavTerrain (float x, float y, float z) const |
| void | CreateFilter () |
| void | UpdateFilter () |
| uint32 | FixupCorridor (dtPolyRef *path, uint32 npath, uint32 maxPath, dtPolyRef const *visited, uint32 nvisited) |
| bool | GetSteerTarget (float const *startPos, float const *endPos, float minTargetDist, dtPolyRef const *path, uint32 pathSize, float *steerPos, unsigned char &steerPosFlag, dtPolyRef &steerPosRef) |
| dtStatus | FindSmoothPath (float const *startPos, float const *endPos, dtPolyRef const *polyPath, uint32 polyPathSize, float *smoothPath, int *smoothPathSize, uint32 maxSmoothPathSize) |
| void | AddFarFromPolyFlags (bool startFarFromPoly, bool endFarFromPoly) |
Private Attributes | |
| dtPolyRef | _pathPolyRefs [MAX_PATH_LENGTH] |
| uint32 | _polyLength |
| Movement::PointsArray | _pathPoints |
| PathType | _type |
| bool | _useStraightPath |
| bool | _forceDestination |
| uint32 | _pointPathLimit |
| bool | _useRaycast |
| G3D::Vector3 | _startPosition |
| G3D::Vector3 | _endPosition |
| G3D::Vector3 | _actualEndPosition |
| WorldObject const *const | _source |
| dtNavMesh const * | _navMesh |
| dtNavMeshQuery const * | _navMeshQuery |
| dtQueryFilter | _filter |
Definition at line 55 of file PathGenerator.h.
|
explicit |
Definition at line 31 of file PathGenerator.cpp.
References _navMesh, _navMeshQuery, _pathPolyRefs, _source, _startPosition, CreateFilter(), BaseEntity::GetGUID(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), MMAP::MMapManager::GetNavMesh(), MMAP::MMapManager::GetNavMeshQuery(), WorldObject::GetPhaseShift(), Map::GetTerrain(), PhasingHandler::GetTerrainMapId(), MMAP::MMapManager::instance(), DisableMgr::IsPathfindingEnabled(), TC_LOG_DEBUG, and ObjectGuid::ToString().
| PathGenerator::~PathGenerator | ( | ) |
Definition at line 52 of file PathGenerator.cpp.
References _source, BaseEntity::GetGUID(), TC_LOG_DEBUG, and ObjectGuid::ToString().
|
delete |
|
delete |
|
private |
Definition at line 1043 of file PathGenerator.cpp.
References _type, PATHFIND_FARFROMPOLY_END, and PATHFIND_FARFROMPOLY_START.
Referenced by BuildPolyPath().
|
private |
Definition at line 534 of file PathGenerator.cpp.
References _forceDestination, _navMeshQuery, _pathPoints, _pathPolyRefs, _pointPathLimit, _polyLength, _source, _type, _useRaycast, _useStraightPath, BuildShortcut(), Dist3DSqr(), FindSmoothPath(), GetActualEndPosition(), GetEndPosition(), BaseEntity::GetGUID(), GetStartPosition(), InRange(), MAX_POINT_PATH_LENGTH, NormalizePath(), PATHFIND_NOPATH, PATHFIND_NORMAL, PATHFIND_NOT_USING_PATH, PATHFIND_SHORT, SetActualEndPosition(), TC_LOG_DEBUG, TC_LOG_ERROR, ObjectGuid::ToString(), and VERTEX_SIZE.
Referenced by BuildPolyPath().
|
private |
Definition at line 164 of file PathGenerator.cpp.
References _filter, _navMeshQuery, _pathPoints, _pathPolyRefs, _polyLength, _source, _type, _useRaycast, AddFarFromPolyFlags(), BuildPointPath(), BuildShortcut(), Creature::CanEnterWater(), Creature::CanFly(), Clear(), WorldObject::GetCollisionHeight(), WorldObject::GetDebugInfo(), BaseEntity::GetGUID(), Map::GetLiquidStatus(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetPhaseShift(), GetPolyByLocation(), GetStartPosition(), BaseEntity::GetTypeId(), INVALID_POLYREF, Map::IsUnderWater(), LIQUID_MAP_NO_WATER, MAX_PATH_LENGTH, NormalizePath(), PATHFIND_INCOMPLETE, PATHFIND_NOPATH, PATHFIND_NORMAL, PATHFIND_NOT_USING_PATH, SetActualEndPosition(), TC_LOG_DEBUG, TC_LOG_ERROR, Object::ToCreature(), ObjectGuid::ToString(), Object::ToUnit(), TYPEID_UNIT, and VERTEX_SIZE.
Referenced by CalculatePath().
|
private |
Definition at line 634 of file PathGenerator.cpp.
References _pathPoints, _type, Clear(), GetActualEndPosition(), GetStartPosition(), NormalizePath(), PATHFIND_SHORTCUT, and TC_LOG_DEBUG.
Referenced by BuildPointPath(), BuildPolyPath(), and CalculatePath().
| bool PathGenerator::CalculatePath | ( | float | destX, |
| float | destY, | ||
| float | destZ, | ||
| bool | forceDest = false |
||
| ) |
Definition at line 91 of file PathGenerator.cpp.
References _source, CalculatePath(), and Position::GetPosition().
| bool PathGenerator::CalculatePath | ( | float | srcX, |
| float | srcY, | ||
| float | srcZ, | ||
| float | destX, | ||
| float | destY, | ||
| float | destZ, | ||
| bool | forceDest = false |
||
| ) |
Definition at line 57 of file PathGenerator.cpp.
References _forceDestination, _navMesh, _navMeshQuery, _source, _type, BuildPolyPath(), BuildShortcut(), BaseEntity::GetGUID(), Unit::HasUnitState(), HaveTile(), Trinity::IsValidMapCoord(), PATHFIND_NORMAL, PATHFIND_NOT_USING_PATH, SetEndPosition(), SetStartPosition(), TC_LOG_DEBUG, TC_METRIC_DETAILED_EVENT, ObjectGuid::ToString(), Object::ToUnit(), UNIT_STATE_IGNORE_PATHFINDING, and UpdateFilter().
Referenced by CalculatePath(), spell_warr_heroic_leap::CheckElevation(), Spell::EffectChargeDest(), mmaps_commandscript::HandleMmapPathCommand(), mmaps_commandscript::HandleMmapTestArea(), PointMovementGenerator::Initialize(), WorldObject::MovePositionToFirstCollision(), Movement::MoveSplineInit::MoveTo(), at_fel_lord_caza_throw_axe_knockback::OnInitialize(), at_tunk_seismic_slam::OnInitialize(), at_orator_krix_vizk_doubt::OnInitialize(), at_dh_inner_demon::OnInitialize(), at_gen_spatial_rift::OnInitialize(), at_monk_song_of_chi_ji::OnInitialize(), areatrigger_pri_divine_star::OnInitialize(), at_void_orb_harbinger::OnInitialize(), at_sporecaller_zancha_volatile_pod::OnInitialize(), and areatrigger_pri_entropic_rift::UpdateMovement().
|
inlineprivate |
Definition at line 118 of file PathGenerator.h.
Referenced by BuildPolyPath(), and BuildShortcut().
|
private |
Definition at line 652 of file PathGenerator.cpp.
References _filter, _source, Creature::CanEnterWater(), BaseEntity::GetTypeId(), Creature::IsAquatic(), NAV_GROUND, NAV_MAGMA_SLIME, NAV_WATER, TYPEID_UNIT, and UpdateFilter().
Referenced by PathGenerator().
|
private |
Definition at line 968 of file PathGenerator.cpp.
Referenced by BuildPointPath().
|
private |
Definition at line 818 of file PathGenerator.cpp.
References _filter, _navMesh, _navMeshQuery, _source, FixupCorridor(), WorldObject::GetDebugInfo(), GetSteerTarget(), InRangeYZX(), INVALID_POLYREF, MAX_PATH_LENGTH, MAX_POINT_PATH_LENGTH, SMOOTH_PATH_SLOP, SMOOTH_PATH_STEP_SIZE, TC_LOG_DEBUG, and VERTEX_SIZE.
Referenced by BuildPointPath().
|
private |
Definition at line 736 of file PathGenerator.cpp.
Referenced by FindSmoothPath().
|
inline |
Definition at line 80 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildShortcut(), mmaps_commandscript::HandleMmapPathCommand(), IsInvalidDestinationZ(), and MotionMaster::MoveCharge().
|
inline |
Definition at line 79 of file PathGenerator.h.
Referenced by BuildPointPath(), and mmaps_commandscript::HandleMmapPathCommand().
|
private |
Definition at line 704 of file PathGenerator.cpp.
References _source, WorldObject::GetCollisionHeight(), Map::GetLiquidStatus(), WorldObject::GetMap(), WorldObject::GetPhaseShift(), EnumFlag< T >::HasFlag(), LIQUID_MAP_NO_WATER, Magma, NAV_GROUND, NAV_MAGMA_SLIME, NAV_WATER, Ocean, Slime, LiquidData::type_flags, and Water.
Referenced by UpdateFilter().
|
inline |
Definition at line 82 of file PathGenerator.h.
Referenced by mmaps_commandscript::HandleMmapPathCommand(), PointMovementGenerator::Initialize(), MotionMaster::MoveCharge(), WorldObject::MovePositionToFirstCollision(), Movement::MoveSplineInit::MoveTo(), at_fel_lord_caza_throw_axe_knockback::OnInitialize(), at_tunk_seismic_slam::OnInitialize(), at_orator_krix_vizk_doubt::OnInitialize(), at_dh_inner_demon::OnInitialize(), at_gen_spatial_rift::OnInitialize(), at_monk_song_of_chi_ji::OnInitialize(), areatrigger_pri_divine_star::OnInitialize(), at_void_orb_harbinger::OnInitialize(), at_sporecaller_zancha_volatile_pod::OnInitialize(), and areatrigger_pri_entropic_rift::UpdateMovement().
| float PathGenerator::GetPathLength | ( | ) | const |
Definition at line 973 of file PathGenerator.cpp.
References _pathPoints.
Referenced by Spell::EffectChargeDest().
|
private |
Definition at line 98 of file PathGenerator.cpp.
References _navMeshQuery, INVALID_POLYREF, and VERTEX_SIZE.
Referenced by GetPolyByLocation().
|
inline |
Definition at line 85 of file PathGenerator.h.
Referenced by spell_warr_heroic_leap::CheckElevation(), mmaps_commandscript::HandleMmapPathCommand(), PointMovementGenerator::Initialize(), WorldObject::MovePositionToFirstCollision(), Movement::MoveSplineInit::MoveTo(), and ShortenPathUntilDist().
|
private |
Definition at line 129 of file PathGenerator.cpp.
References _filter, _navMeshQuery, _pathPolyRefs, _polyLength, GetPathPolyByPosition(), INVALID_POLYREF, and VERTEX_SIZE.
Referenced by BuildPolyPath().
|
inline |
Definition at line 78 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), BuildShortcut(), and mmaps_commandscript::HandleMmapPathCommand().
|
private |
Definition at line 781 of file PathGenerator.cpp.
References _navMeshQuery, InRangeYZX(), and VERTEX_SIZE.
Referenced by FindSmoothPath().
|
private |
Workaround For some reason, often the tx and ty variables wont get a valid value Use this check to prevent getting negative tile coords and crashing on getTileAt
Definition at line 720 of file PathGenerator.cpp.
References _navMesh, and VERTEX_SIZE.
Referenced by CalculatePath().
|
private |
Definition at line 962 of file PathGenerator.cpp.
Referenced by BuildPointPath().
|
private |
Definition at line 954 of file PathGenerator.cpp.
Referenced by FindSmoothPath(), and GetSteerTarget().
| bool PathGenerator::IsInvalidDestinationZ | ( | WorldObject const * | target | ) | const |
Definition at line 1038 of file PathGenerator.cpp.
References GetActualEndPosition(), and Position::GetPositionZ().
|
private |
Definition at line 628 of file PathGenerator.cpp.
References _pathPoints, _source, and WorldObject::UpdateAllowedPositionZ().
Referenced by BuildPointPath(), BuildPolyPath(), and BuildShortcut().
|
delete |
|
delete |
|
inlineprivate |
Definition at line 115 of file PathGenerator.h.
Referenced by BuildPointPath(), and BuildPolyPath().
|
inlineprivate |
Definition at line 114 of file PathGenerator.h.
Referenced by CalculatePath().
|
inline |
Definition at line 74 of file PathGenerator.h.
References MAX_POINT_PATH_LENGTH, and SMOOTH_PATH_STEP_SIZE.
Referenced by spell_warr_heroic_leap::CheckElevation().
|
inlineprivate |
Definition at line 113 of file PathGenerator.h.
Referenced by CalculatePath().
|
inline |
Definition at line 75 of file PathGenerator.h.
Referenced by mmaps_commandscript::HandleMmapPathCommand(), and WorldObject::MovePositionToFirstCollision().
|
inline |
Definition at line 73 of file PathGenerator.h.
Referenced by mmaps_commandscript::HandleMmapPathCommand().
| void PathGenerator::ShortenPathUntilDist | ( | G3D::Vector3 const & | target, |
| float | dist | ||
| ) |
Definition at line 982 of file PathGenerator.cpp.
References _pathPoints, _source, WorldObject::GetCollisionHeight(), WorldObject::GetHitSpherePointFor(), WorldObject::GetMap(), GetPathType(), WorldObject::GetPhaseShift(), Map::isInLineOfSight(), LINEOFSIGHT_ALL_CHECKS, VMAP::Nothing, PATHFIND_BLANK, and TC_LOG_ERROR.
Referenced by PointMovementGenerator::Initialize().
|
private |
Definition at line 679 of file PathGenerator.cpp.
References _filter, _source, _startPosition, Map::GetForceDisabledNavMeshFilterFlags(), Map::GetForceEnabledNavMeshFilterFlags(), WorldObject::GetMap(), GetNavTerrain(), NAV_GROUND_STEEP, Object::ToCreature(), and Object::ToUnit().
Referenced by CalculatePath(), and CreateFilter().
|
private |
Definition at line 105 of file PathGenerator.h.
|
private |
Definition at line 104 of file PathGenerator.h.
|
private |
Definition at line 111 of file PathGenerator.h.
Referenced by BuildPolyPath(), CreateFilter(), FindSmoothPath(), GetPolyByLocation(), and UpdateFilter().
|
private |
Definition at line 99 of file PathGenerator.h.
Referenced by BuildPointPath(), and CalculatePath().
|
private |
Definition at line 108 of file PathGenerator.h.
Referenced by CalculatePath(), FindSmoothPath(), HaveTile(), and PathGenerator().
|
private |
Definition at line 109 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), CalculatePath(), FindSmoothPath(), GetPathPolyByPosition(), GetPolyByLocation(), GetSteerTarget(), and PathGenerator().
|
private |
Definition at line 95 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), BuildShortcut(), GetPathLength(), NormalizePath(), and ShortenPathUntilDist().
|
private |
Definition at line 92 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), GetPolyByLocation(), and PathGenerator().
|
private |
Definition at line 100 of file PathGenerator.h.
Referenced by BuildPointPath().
|
private |
Definition at line 93 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), and GetPolyByLocation().
|
private |
Definition at line 107 of file PathGenerator.h.
Referenced by BuildPointPath(), BuildPolyPath(), CalculatePath(), CalculatePath(), CreateFilter(), FindSmoothPath(), GetNavTerrain(), NormalizePath(), PathGenerator(), ShortenPathUntilDist(), UpdateFilter(), and ~PathGenerator().
|
private |
Definition at line 103 of file PathGenerator.h.
Referenced by PathGenerator(), and UpdateFilter().
|
private |
Definition at line 96 of file PathGenerator.h.
Referenced by AddFarFromPolyFlags(), BuildPointPath(), BuildPolyPath(), BuildShortcut(), and CalculatePath().
|
private |
Definition at line 101 of file PathGenerator.h.
Referenced by BuildPointPath(), and BuildPolyPath().
|
private |
Definition at line 98 of file PathGenerator.h.
Referenced by BuildPointPath().