mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
refactor(Core): apply clang-tidy modernize-use-nullptr (#3819)
This commit is contained in:
@@ -52,7 +52,7 @@ namespace VMAP
|
||||
class ManagedModel
|
||||
{
|
||||
public:
|
||||
ManagedModel() : iModel(0), iRefCount(0) { }
|
||||
ManagedModel() : iModel(nullptr), iRefCount(0) { }
|
||||
void setModel(WorldModel* model) { iModel = model; }
|
||||
WorldModel* getModel() { return iModel; }
|
||||
void incRefCount() { ++iRefCount; }
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace VMAP
|
||||
|
||||
struct LocationInfo
|
||||
{
|
||||
LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) { }
|
||||
LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::inf()) { }
|
||||
const ModelInstance* hitInstance;
|
||||
const GroupModel* hitModel;
|
||||
float ground_Z;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace VMAP
|
||||
class WmoLiquid* liquid;
|
||||
|
||||
GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0),
|
||||
liquid(NULL) { }
|
||||
liquid(nullptr) { }
|
||||
~GroupModel_Raw();
|
||||
|
||||
bool Read(FILE* f);
|
||||
|
||||
@@ -34,7 +34,7 @@ class GameObjectModel /*, public Intersectable*/
|
||||
VMAP::WorldModel* iModel;
|
||||
GameObject const* owner;
|
||||
|
||||
GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL), owner(NULL) { }
|
||||
GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(nullptr), owner(nullptr) { }
|
||||
bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info);
|
||||
|
||||
public:
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace VMAP
|
||||
class ModelInstance: public ModelSpawn
|
||||
{
|
||||
public:
|
||||
ModelInstance(): iInvScale(0.0f), iModel(0) { }
|
||||
ModelInstance(): iInvScale(0.0f), iModel(nullptr) { }
|
||||
ModelInstance(const ModelSpawn& spawn, WorldModel* model);
|
||||
void setUnloaded() { iModel = 0; }
|
||||
void setUnloaded() { iModel = nullptr; }
|
||||
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const;
|
||||
void intersectPoint(const G3D::Vector3& p, AreaInfo& info) const;
|
||||
bool GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace VMAP
|
||||
bool writeToFile(FILE* wf);
|
||||
static bool readFromFile(FILE* rf, WmoLiquid*& liquid);
|
||||
private:
|
||||
WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(0), iFlags(0) { }
|
||||
WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(nullptr), iFlags(nullptr) { }
|
||||
uint32 iTilesX; //!< number of tiles in x direction, each
|
||||
uint32 iTilesY;
|
||||
G3D::Vector3 iCorner; //!< the lower corner
|
||||
@@ -62,15 +62,15 @@ namespace VMAP
|
||||
class GroupModel
|
||||
{
|
||||
public:
|
||||
GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(0) { }
|
||||
GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(nullptr) { }
|
||||
GroupModel(const GroupModel& other);
|
||||
GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox& bound):
|
||||
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) { }
|
||||
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { }
|
||||
~GroupModel() { delete iLiquid; }
|
||||
|
||||
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
|
||||
void setMeshData(std::vector<G3D::Vector3>& vert, std::vector<MeshTriangle>& tri);
|
||||
void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; }
|
||||
void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; }
|
||||
bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const;
|
||||
bool IsInsideObject(const G3D::Vector3& pos, const G3D::Vector3& down, float& z_dist) const;
|
||||
bool GetLiquidLevel(const G3D::Vector3& pos, float& liqHeight) const;
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
if (data.raw)
|
||||
return *reinterpret_cast<int64*>(data.value);
|
||||
return static_cast<int64>(strtol((char*)data.value, NULL, 10));
|
||||
return static_cast<int64>(strtol((char*)data.value, nullptr, 10));
|
||||
}
|
||||
|
||||
[[nodiscard]] float GetFloat() const
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
[[nodiscard]] char const* GetCString() const
|
||||
{
|
||||
if (!data.value)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#ifdef ACORE_DEBUG
|
||||
if (IsNumeric())
|
||||
@@ -244,7 +244,7 @@ public:
|
||||
|
||||
[[nodiscard]] bool IsNull() const
|
||||
{
|
||||
return data.value == NULL;
|
||||
return data.value == nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -275,7 +275,7 @@ protected:
|
||||
void CleanUp()
|
||||
{
|
||||
delete[] ((char*)data.value);
|
||||
data.value = NULL;
|
||||
data.value = nullptr;
|
||||
}
|
||||
|
||||
static size_t SizeForType(MYSQL_FIELD* field)
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
void CommitTransaction();
|
||||
bool ExecuteTransaction(SQLTransaction& transaction);
|
||||
|
||||
operator bool () const { return m_Mysql != NULL; }
|
||||
operator bool () const { return m_Mysql != nullptr; }
|
||||
void Ping() { mysql_ping(m_Mysql); }
|
||||
|
||||
uint32 GetLastError() { return mysql_errno(m_Mysql); }
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
static void Library_Init()
|
||||
{
|
||||
mysql_library_init(-1, NULL, NULL);
|
||||
mysql_library_init(-1, nullptr, nullptr);
|
||||
}
|
||||
|
||||
static void Library_End()
|
||||
|
||||
@@ -48,7 +48,7 @@ class MySQLConnection;
|
||||
class SQLOperation : public ACE_Method_Request
|
||||
{
|
||||
public:
|
||||
SQLOperation(): m_conn(NULL) { }
|
||||
SQLOperation(): m_conn(nullptr) { }
|
||||
int call() override
|
||||
{
|
||||
Execute();
|
||||
|
||||
@@ -21,17 +21,17 @@ private:
|
||||
LinkedListElement* iNext;
|
||||
LinkedListElement* iPrev;
|
||||
public:
|
||||
LinkedListElement(): iNext(NULL), iPrev(NULL) { }
|
||||
LinkedListElement(): iNext(nullptr), iPrev(nullptr) { }
|
||||
~LinkedListElement() { delink(); }
|
||||
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != NULL); }
|
||||
[[nodiscard]] bool hasPrev() const { return (iPrev && iPrev->iPrev != NULL); }
|
||||
[[nodiscard]] bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != nullptr); }
|
||||
[[nodiscard]] bool hasPrev() const { return (iPrev && iPrev->iPrev != nullptr); }
|
||||
[[nodiscard]] bool isInList() const { return (iNext != nullptr && iPrev != nullptr); }
|
||||
|
||||
LinkedListElement* next() { return hasNext() ? iNext : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; }
|
||||
LinkedListElement* next() { return hasNext() ? iNext : nullptr; }
|
||||
[[nodiscard]] LinkedListElement const* next() const { return hasNext() ? iNext : nullptr; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : nullptr; }
|
||||
[[nodiscard]] LinkedListElement const* prev() const { return hasPrev() ? iPrev : nullptr; }
|
||||
|
||||
LinkedListElement* nocheck_next() { return iNext; }
|
||||
[[nodiscard]] LinkedListElement const* nocheck_next() const { return iNext; }
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
{
|
||||
iNext->iPrev = iPrev;
|
||||
iPrev->iNext = iNext;
|
||||
iNext = NULL;
|
||||
iPrev = NULL;
|
||||
iNext = nullptr;
|
||||
iPrev = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +85,11 @@ public:
|
||||
|
||||
[[nodiscard]] bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
|
||||
LinkedListElement* getFirst() { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
[[nodiscard]] LinkedListElement const* getFirst() const { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement* getFirst() { return (isEmpty() ? nullptr : iFirst.iNext); }
|
||||
[[nodiscard]] LinkedListElement const* getFirst() const { return (isEmpty() ? nullptr : iFirst.iNext); }
|
||||
|
||||
LinkedListElement* getLast() { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
[[nodiscard]] LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement* getLast() { return (isEmpty() ? nullptr : iLast.iPrev); }
|
||||
[[nodiscard]] LinkedListElement const* getLast() const { return (isEmpty() ? nullptr : iLast.iPrev); }
|
||||
|
||||
void insertFirst(LinkedListElement* pElem)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void clearReferences()
|
||||
{
|
||||
LinkedListElement* ref;
|
||||
while ((ref = getFirst()) != NULL)
|
||||
while ((ref = getFirst()) != nullptr)
|
||||
{
|
||||
((Reference<TO, FROM>*) ref)->invalidate();
|
||||
ref->delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
|
||||
|
||||
@@ -27,7 +27,7 @@ protected:
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
virtual void sourceObjectDestroyLink() = 0;
|
||||
public:
|
||||
Reference() { iRefTo = NULL; iRefFrom = NULL; }
|
||||
Reference() { iRefTo = nullptr; iRefFrom = nullptr; }
|
||||
virtual ~Reference() { }
|
||||
|
||||
// Create new link
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
ASSERT(fromObj); // fromObj MUST not be NULL
|
||||
if (isValid())
|
||||
unlink();
|
||||
if (toObj != NULL)
|
||||
if (toObj != nullptr)
|
||||
{
|
||||
iRefTo = toObj;
|
||||
iRefFrom = fromObj;
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
{
|
||||
targetObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
iRefFrom = NULL;
|
||||
iRefTo = nullptr;
|
||||
iRefFrom = nullptr;
|
||||
}
|
||||
|
||||
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
{
|
||||
sourceObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
iRefTo = nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isValid() const // Only check the iRefTo
|
||||
{
|
||||
return iRefTo != NULL;
|
||||
return iRefTo != nullptr;
|
||||
}
|
||||
|
||||
Reference<TO, FROM>* next() { return ((Reference<TO, FROM>*) LinkedListElement::next()); }
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace acore
|
||||
class SignalHandler : public ACE_Event_Handler
|
||||
{
|
||||
public:
|
||||
int handle_signal(int SigNum, siginfo_t* = NULL, ucontext_t* = NULL) override
|
||||
int handle_signal(int SigNum, siginfo_t* = nullptr, ucontext_t* = nullptr) override
|
||||
{
|
||||
HandleSignal(SigNum);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user