Core/Mmaps: Refactored some code
This commit is contained in:
@@ -160,7 +160,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
void MoveLand(uint32 id, Position const& pos);
|
||||
void MoveTakeoff(uint32 id, Position const& pos);
|
||||
|
||||
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = true);
|
||||
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);
|
||||
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
|
||||
void MoveJumpTo(float angle, float speedXY, float speedZ);
|
||||
void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0);
|
||||
|
||||
@@ -78,7 +78,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
|
||||
PathFinderMovementGenerator path(&unit);
|
||||
path.setPathLengthLimit(30.0f);
|
||||
path.calculate(x, y, z);
|
||||
path.CalculatePath(x, y, z);
|
||||
if (path.getPathType() & PATHFIND_NOPATH)
|
||||
{
|
||||
i_nextMoveTime.Reset(urand(800, 1000));
|
||||
|
||||
@@ -45,7 +45,7 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
|
||||
PathFinderMovementGenerator path(&owner);
|
||||
path.setPathLengthLimit(30.0f);
|
||||
path.calculate(x, y, z);
|
||||
path.CalculatePath(x, y, z);
|
||||
if (path.getPathType() & PATHFIND_NOPATH)
|
||||
{
|
||||
i_nextCheckTime.Reset(urand(1000, 1500));
|
||||
|
||||
@@ -50,7 +50,7 @@ PathFinderMovementGenerator::~PathFinderMovementGenerator()
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::~PathFinderMovementGenerator() for %u \n", m_sourceUnit->GetGUIDLow());
|
||||
}
|
||||
|
||||
bool PathFinderMovementGenerator::calculate(float destX, float destY, float destZ, bool forceDest)
|
||||
bool PathFinderMovementGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest)
|
||||
{
|
||||
if (!Trinity::IsValidMapCoord(destX, destY, destZ) ||
|
||||
!Trinity::IsValidMapCoord(m_sourceUnit->GetPositionX(), m_sourceUnit->GetPositionY(), m_sourceUnit->GetPositionZ()))
|
||||
@@ -67,7 +67,7 @@ bool PathFinderMovementGenerator::calculate(float destX, float destY, float dest
|
||||
|
||||
m_forceDestination = forceDest;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::calculate() for %u \n", m_sourceUnit->GetGUIDLow());
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::CalculatePath() for %u \n", m_sourceUnit->GetGUIDLow());
|
||||
|
||||
// make sure navMesh works - we can run on map w/o mmap
|
||||
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
|
||||
@@ -88,7 +88,7 @@ bool PathFinderMovementGenerator::calculate(float destX, float destY, float dest
|
||||
{
|
||||
// our target is not moving - we just coming closer
|
||||
// we are moving on precalculated path - enjoy the ride
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::calculate:: precalculated path\n");
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::CalculatePath:: precalculated path\n");
|
||||
|
||||
m_pathPoints.erase(m_pathPoints.begin());
|
||||
return false;
|
||||
|
||||
@@ -59,10 +59,10 @@ class PathFinderMovementGenerator
|
||||
|
||||
// Calculate the path from owner to given destination
|
||||
// return: true if new path was calculated, false otherwise (no change needed)
|
||||
bool calculate(float destX, float destY, float destZ, bool forceDest = false);
|
||||
bool CalculatePath(float destX, float destY, float destZ, bool forceDest = false);
|
||||
|
||||
// option setters - use optional
|
||||
void setUseStrightPath(bool useStraightPath) { m_useStraightPath = useStraightPath; };
|
||||
void SetUseStraightPath(bool useStraightPath) { m_useStraightPath = useStraightPath; };
|
||||
void setPathLengthLimit(float distance) { m_pointPathLimit = std::min<uint32>(uint32(distance/SMOOTH_PATH_STEP_SIZE), MAX_POINT_PATH_LENGTH); };
|
||||
|
||||
// result getters
|
||||
|
||||
@@ -69,7 +69,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
||||
// allow pets following their master to cheat while generating paths
|
||||
bool forceDest = (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->isPet()
|
||||
&& owner.HasUnitState(UNIT_STATE_FOLLOW));
|
||||
i_path->calculate(x, y, z, forceDest);
|
||||
i_path->CalculatePath(x, y, z, forceDest);
|
||||
if (i_path->getPathType() & PATHFIND_NOPATH)
|
||||
return;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Movement
|
||||
}
|
||||
|
||||
// there is a big chance that current position is unknown if current state is not finalized, need compute it
|
||||
// this also allows calculate spline position and update map position in much greater intervals
|
||||
// this also allows CalculatePath spline position and update map position in much greater intervals
|
||||
if (!move_spline.Finalized())
|
||||
real_position = move_spline.ComputePosition();
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Movement
|
||||
if (generatePath)
|
||||
{
|
||||
PathFinderMovementGenerator path(&unit);
|
||||
path.calculate(dest.x, dest.y, dest.z, forceDestination);
|
||||
path.CalculatePath(dest.x, dest.y, dest.z, forceDestination);
|
||||
MovebyPath(path.getPath());
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user