mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
refactor(Core): NULL -> nullptr (#3275)
* NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@ template<class T>
|
||||
class EscortMovementGenerator : public MovementGeneratorMedium< T, EscortMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
EscortMovementGenerator(Movement::PointsArray* _path = NULL) : i_recalculateSpeed(false)
|
||||
EscortMovementGenerator(Movement::PointsArray* _path = nullptr) : i_recalculateSpeed(false)
|
||||
{
|
||||
if (_path)
|
||||
m_precomputedPath = *_path;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
PathGenerator::PathGenerator(const Unit* owner) :
|
||||
_polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false),
|
||||
_forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH),
|
||||
_endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL),
|
||||
_navMeshQuery(NULL)
|
||||
_endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(nullptr),
|
||||
_navMeshQuery(nullptr)
|
||||
{
|
||||
memset(_pathPolyRefs, 0, sizeof(_pathPolyRefs));
|
||||
|
||||
@@ -227,8 +227,8 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
}
|
||||
if (sourceCanSwim)
|
||||
{
|
||||
if ((startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) ||
|
||||
(endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)))
|
||||
if ((startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr)) ||
|
||||
(endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr)))
|
||||
{
|
||||
_type = PATHFIND_NOPATH;
|
||||
return;
|
||||
@@ -253,7 +253,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
}
|
||||
if (sourceCanSwim)
|
||||
{
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL))
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr))
|
||||
{
|
||||
if (distToStartPoly > MAX_FIXABLE_Z_ERROR)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
|
||||
if (farFromEndPoly)
|
||||
{
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL))
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr))
|
||||
{
|
||||
BuildShortcut();
|
||||
_type = PATHFIND_NOPATH;
|
||||
@@ -272,7 +272,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL))
|
||||
else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr))
|
||||
{
|
||||
if (farFromEndPoly)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
|
||||
return;
|
||||
}
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL))
|
||||
if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr))
|
||||
{
|
||||
if (!sourceCanWalk)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
}
|
||||
|
||||
// if both points are in water
|
||||
if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL))
|
||||
if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr))
|
||||
{
|
||||
BuildShortcut();
|
||||
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
|
||||
@@ -340,7 +340,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
if (startPoly != endPoly || !endInWaterFar)
|
||||
{
|
||||
float closestPoint[VERTEX_SIZE];
|
||||
if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, NULL)))
|
||||
if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, nullptr)))
|
||||
{
|
||||
dtVcopy(endPoint, closestPoint);
|
||||
SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1]));
|
||||
@@ -417,7 +417,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
|
||||
// we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data
|
||||
float suffixEndPoint[VERTEX_SIZE];
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL)))
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, nullptr)))
|
||||
{
|
||||
// we can hit offmesh connection as last poly - closestPointOnPoly() don't like that
|
||||
// try to recover by using prev polyref
|
||||
@@ -528,7 +528,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
for (; i < size; ++i)
|
||||
if (_pathPoints[i].z >= _sourceUnit->GetPositionZ()+0.1f)
|
||||
break;
|
||||
if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, NULL))
|
||||
if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, nullptr))
|
||||
for (uint32 j=0; j<i; ++j)
|
||||
_pathPoints[j].z = _sourceUnit->GetPositionZ();
|
||||
}
|
||||
@@ -785,7 +785,7 @@ bool PathGenerator::HaveTile(const G3D::Vector3& p) const
|
||||
if (tx < 0 || ty < 0)
|
||||
return false;
|
||||
|
||||
return (_navMesh->getTileAt(tx, ty, 0) != NULL);
|
||||
return (_navMesh->getTileAt(tx, ty, 0) != nullptr);
|
||||
}
|
||||
|
||||
uint32 PathGenerator::FixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath, dtPolyRef const* visited, uint32 nvisited)
|
||||
|
||||
@@ -132,7 +132,7 @@ class PathGenerator
|
||||
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 = NULL) const;
|
||||
dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = nullptr) const;
|
||||
dtPolyRef GetPolyByLocation(float* Point, float* Distance) const;
|
||||
bool HaveTile(G3D::Vector3 const& p) const;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ template<class T>
|
||||
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
RandomMovementGenerator(float wanderDistance = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(wanderDistance), _pathGenerator(NULL), _currentPoint(RANDOM_POINTS_NUMBER)
|
||||
RandomMovementGenerator(float wanderDistance = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(wanderDistance), _pathGenerator(nullptr), _currentPoint(RANDOM_POINTS_NUMBER)
|
||||
{
|
||||
_initialPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
_destinationPoints.reserve(RANDOM_POINTS_NUMBER);
|
||||
|
||||
@@ -29,7 +29,7 @@ class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >,
|
||||
{
|
||||
protected:
|
||||
TargetedMovementGeneratorMedium(Unit* target, float offset, float angle) :
|
||||
TargetedMovementGeneratorBase(target), i_path(NULL), lastPathingFailMSTime(0),
|
||||
TargetedMovementGeneratorBase(target), i_path(nullptr), lastPathingFailMSTime(0),
|
||||
i_recheckDistance(0), i_recheckDistanceForced(2500), i_offset(offset), i_angle(angle),
|
||||
i_recalculateTravel(false), i_targetReached(false)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
|
||||
sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID());
|
||||
#endif
|
||||
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||
creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL);
|
||||
creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr);
|
||||
}
|
||||
|
||||
// Inform script
|
||||
@@ -114,7 +114,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
||||
creature->SetHomePosition(x, y, z, o);
|
||||
else
|
||||
{
|
||||
if (Transport* trans = (creature->GetTransport() ? creature->GetTransport()->ToMotionTransport() : NULL))
|
||||
if (Transport* trans = (creature->GetTransport() ? creature->GetTransport()->ToMotionTransport() : nullptr))
|
||||
{
|
||||
o -= trans->GetOrientation();
|
||||
creature->SetTransportHomePosition(x, y, z, o);
|
||||
@@ -317,7 +317,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
|
||||
// this prevent cheating with landing point at lags
|
||||
// when client side flight end early in comparison server side
|
||||
player->StopMoving();
|
||||
player->SetFallInformation(time(NULL), player->GetPositionZ());
|
||||
player->SetFallInformation(time(nullptr), player->GetPositionZ());
|
||||
}
|
||||
|
||||
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
|
||||
@@ -409,7 +409,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
|
||||
if (i_currentNode >= i_path.size() - 1)
|
||||
{
|
||||
player->CleanupAfterTaxiFlight();
|
||||
player->SetFallInformation(time(NULL), player->GetPositionZ());
|
||||
player->SetFallInformation(time(nullptr), player->GetPositionZ());
|
||||
if (player->pvpInfo.IsHostile)
|
||||
player->CastSpell(player, 2479, true);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
|
||||
public:
|
||||
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
|
||||
: PathMovementBase((WaypointPath const*)NULL), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {}
|
||||
~WaypointMovementGenerator() { i_path = NULL; }
|
||||
~WaypointMovementGenerator() { i_path = nullptr; }
|
||||
void DoInitialize(Creature*);
|
||||
void DoFinalize(Creature*);
|
||||
void DoReset(Creature*);
|
||||
|
||||
Reference in New Issue
Block a user