refactor(Core): code cleanup (part 2) (#6374)

This commit is contained in:
Francesco Borzì
2021-06-16 20:40:42 +02:00
committed by GitHub
parent 8f7ad83010
commit 466cdb68d6
80 changed files with 198 additions and 209 deletions

View File

@@ -8,7 +8,6 @@
#include "CreatureAI.h"
#include "FleeingMovementGenerator.h"
#include "MapManager.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
#include "Player.h"

View File

@@ -8,7 +8,6 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "DisableMgr.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "WorldPacket.h"

View File

@@ -6,7 +6,6 @@
#include "Creature.h"
#include "DetourCommon.h"
#include "DisableMgr.h"
#include "Geometry.h"
#include "Log.h"
#include "Map.h"
@@ -1155,13 +1154,13 @@ bool PathGenerator::IsSwimmableSegment(float x, float y, float z, float destX, f
(!checkSwim || !_sourceCreature || _sourceCreature->CanSwim());
}
bool PathGenerator::IsWaterPath(Movement::PointsArray _pathPoints) const
bool PathGenerator::IsWaterPath(Movement::PointsArray pathPoints) const
{
bool waterPath = true;
// Check both start and end points, if they're both in water, then we can *safely* let the creature move
for (uint32 i = 0; i < _pathPoints.size(); ++i)
for (uint32 i = 0; i < pathPoints.size(); ++i)
{
NavTerrain terrain = GetNavTerrain(_pathPoints[i].x, _pathPoints[i].y, _pathPoints[i].z);
NavTerrain terrain = GetNavTerrain(pathPoints[i].x, pathPoints[i].y, pathPoints[i].z);
// One of the points is not in the water
if (terrain != NAV_MAGMA && terrain != NAV_WATER)
{

View File

@@ -59,7 +59,7 @@ class PathGenerator
[[nodiscard]] bool IsWalkableClimb(float const* v1, float const* v2) const;
[[nodiscard]] bool IsWalkableClimb(float x, float y, float z, float destX, float destY, float destZ) const;
[[nodiscard]] static bool IsWalkableClimb(float x, float y, float z, float destX, float destY, float destZ, float sourceHeight);
[[nodiscard]] bool IsWaterPath(Movement::PointsArray _pathPoints) const;
[[nodiscard]] bool IsWaterPath(Movement::PointsArray pathPoints) const;
[[nodiscard]] bool IsSwimmableSegment(float const* v1, float const* v2, bool checkSwim = true) const;
[[nodiscard]] bool IsSwimmableSegment(float x, float y, float z, float destX, float destY, float destZ, bool checkSwim = true) const;
[[nodiscard]] static float GetRequiredHeightToClimb(float x, float y, float z, float destX, float destY, float destZ, float sourceHeight);

View File

@@ -50,9 +50,9 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
{
owner->StopMoving();
_lastTargetPosition.reset();
if (Creature* cOwner = owner->ToCreature())
if (Creature* cOwner2 = owner->ToCreature())
{
cOwner->SetCannotReachTarget(false);
cOwner2->SetCannotReachTarget(false);
}
return true;
@@ -82,9 +82,9 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
{
i_recalculateTravel = false;
i_path = nullptr;
if (Creature* cOwner = owner->ToCreature())
if (Creature* cOwner2 = owner->ToCreature())
{
cOwner->SetCannotReachTarget(false);
cOwner2->SetCannotReachTarget(false);
}
owner->StopMoving();