From cba126fa840dc0a729b9a54c626046f209f8ca43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Borz=C3=AC?= Date: Sun, 6 Dec 2020 20:55:11 +0100 Subject: [PATCH] refactor(Core): apply clang-tidy modernize-use-nullptr (#3819) --- .../Collision/Management/VMapManager2.h | 2 +- src/common/Collision/Maps/MapTree.h | 2 +- src/common/Collision/Maps/TileAssembler.h | 2 +- src/common/Collision/Models/GameObjectModel.h | 2 +- src/common/Collision/Models/ModelInstance.h | 4 +-- src/common/Collision/Models/WorldModel.h | 8 +++--- src/common/Database/Field.h | 8 +++--- src/common/Database/MySQLConnection.h | 2 +- src/common/Database/MySQLThreading.h | 2 +- src/common/Database/SQLOperation.h | 2 +- src/common/Dynamic/LinkedList.h | 28 +++++++++---------- .../Dynamic/LinkedReference/RefManager.h | 2 +- .../Dynamic/LinkedReference/Reference.h | 12 ++++---- src/common/Utilities/SignalHandler.h | 2 +- src/server/authserver/Server/RealmAcceptor.h | 2 +- src/server/game/Battlegrounds/Battleground.h | 2 +- src/server/game/Combat/ThreatManager.h | 2 +- src/server/game/Conditions/ConditionMgr.h | 2 +- src/server/game/Entities/Creature/Creature.h | 6 ++-- .../game/Entities/GameObject/GameObject.h | 4 +-- src/server/game/Entities/Item/Item.h | 2 +- src/server/game/Entities/Object/Object.h | 2 +- src/server/game/Entities/Player/Player.h | 18 ++++++------ src/server/game/Entities/Unit/Unit.h | 24 ++++++++-------- src/server/game/Globals/ObjectAccessor.h | 12 ++++---- src/server/game/Globals/ObjectMgr.h | 2 +- src/server/game/Loot/LootMgr.h | 2 +- src/server/game/Maps/Map.h | 10 +++---- src/server/game/Movement/MotionMaster.h | 2 +- src/server/game/World/World.h | 8 +++--- src/server/shared/Network/RealmSocket.cpp | 8 +++--- src/tools/map_extractor/adt.cpp | 4 +-- src/tools/map_extractor/adt.h | 20 ++++++------- src/tools/map_extractor/loadlib.cpp | 8 +++--- src/tools/map_extractor/mpq_libmpq.cpp | 8 +++--- src/tools/map_extractor/wdt.cpp | 12 ++++---- src/tools/vmap4_extractor/model.cpp | 2 +- src/tools/vmap4_extractor/mpq_libmpq.cpp | 8 +++--- src/tools/vmap4_extractor/vmapexport.cpp | 2 +- src/tools/vmap4_extractor/wmo.cpp | 4 +-- 40 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index b5ec9959b..02ced8514 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -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; } diff --git a/src/common/Collision/Maps/MapTree.h b/src/common/Collision/Maps/MapTree.h index 3ffe33b80..4ea5f0abd 100644 --- a/src/common/Collision/Maps/MapTree.h +++ b/src/common/Collision/Maps/MapTree.h @@ -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; diff --git a/src/common/Collision/Maps/TileAssembler.h b/src/common/Collision/Maps/TileAssembler.h index 6408958e6..20219c814 100644 --- a/src/common/Collision/Maps/TileAssembler.h +++ b/src/common/Collision/Maps/TileAssembler.h @@ -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); diff --git a/src/common/Collision/Models/GameObjectModel.h b/src/common/Collision/Models/GameObjectModel.h index 494f66ee3..59e1eb624 100644 --- a/src/common/Collision/Models/GameObjectModel.h +++ b/src/common/Collision/Models/GameObjectModel.h @@ -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: diff --git a/src/common/Collision/Models/ModelInstance.h b/src/common/Collision/Models/ModelInstance.h index 0e1b76b23..a6701fca6 100644 --- a/src/common/Collision/Models/ModelInstance.h +++ b/src/common/Collision/Models/ModelInstance.h @@ -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; diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index 194ae5ebd..5e4ff18dc 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -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& vert, std::vector& 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; diff --git a/src/common/Database/Field.h b/src/common/Database/Field.h index 2983d228a..4b837ff34 100644 --- a/src/common/Database/Field.h +++ b/src/common/Database/Field.h @@ -172,7 +172,7 @@ public: if (data.raw) return *reinterpret_cast(data.value); - return static_cast(strtol((char*)data.value, NULL, 10)); + return static_cast(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) diff --git a/src/common/Database/MySQLConnection.h b/src/common/Database/MySQLConnection.h index 7f8d0ba43..164b29fcc 100644 --- a/src/common/Database/MySQLConnection.h +++ b/src/common/Database/MySQLConnection.h @@ -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); } diff --git a/src/common/Database/MySQLThreading.h b/src/common/Database/MySQLThreading.h index d5907cac6..29f1a0740 100644 --- a/src/common/Database/MySQLThreading.h +++ b/src/common/Database/MySQLThreading.h @@ -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() diff --git a/src/common/Database/SQLOperation.h b/src/common/Database/SQLOperation.h index 329198790..c5af1a5b5 100644 --- a/src/common/Database/SQLOperation.h +++ b/src/common/Database/SQLOperation.h @@ -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(); diff --git a/src/common/Dynamic/LinkedList.h b/src/common/Dynamic/LinkedList.h index 8fdcd741e..5413421ab 100644 --- a/src/common/Dynamic/LinkedList.h +++ b/src/common/Dynamic/LinkedList.h @@ -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) { diff --git a/src/common/Dynamic/LinkedReference/RefManager.h b/src/common/Dynamic/LinkedReference/RefManager.h index 265aebd5c..116509dae 100644 --- a/src/common/Dynamic/LinkedReference/RefManager.h +++ b/src/common/Dynamic/LinkedReference/RefManager.h @@ -31,7 +31,7 @@ public: void clearReferences() { LinkedListElement* ref; - while ((ref = getFirst()) != NULL) + while ((ref = getFirst()) != nullptr) { ((Reference*) 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 diff --git a/src/common/Dynamic/LinkedReference/Reference.h b/src/common/Dynamic/LinkedReference/Reference.h index 71d33e25f..aedfcb19e 100644 --- a/src/common/Dynamic/LinkedReference/Reference.h +++ b/src/common/Dynamic/LinkedReference/Reference.h @@ -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* next() { return ((Reference*) LinkedListElement::next()); } diff --git a/src/common/Utilities/SignalHandler.h b/src/common/Utilities/SignalHandler.h index aa22205a1..2fcccac70 100644 --- a/src/common/Utilities/SignalHandler.h +++ b/src/common/Utilities/SignalHandler.h @@ -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; diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index e0ec82d89..ca5c80183 100644 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -26,7 +26,7 @@ public: protected: virtual int make_svc_handler(RealmSocket*& sh) { - if (sh == 0) + if (sh == nullptr) ACE_NEW_RETURN(sh, RealmSocket, -1); sh->reactor(reactor()); diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 874560295..c1687d3a6 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -464,7 +464,7 @@ public: // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} - void SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender = NULL, bool self = true); + void SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender = nullptr, bool self = true); void SendPacketToAll(WorldPacket* packet); void YellToAll(Creature* creature, const char* text, uint32 language); diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index ca96e5555..2448f2ad8 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -149,7 +149,7 @@ public: [[nodiscard]] HostileReference* getMostHated() const { - return iThreatList.empty() ? NULL : iThreatList.front(); + return iThreatList.empty() ? nullptr : iThreatList.front(); } HostileReference* getReferenceByTarget(Unit* victim) const; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 0abf30a12..4e4006e8c 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -166,7 +166,7 @@ struct ConditionSourceInfo { WorldObject* mConditionTargets[MAX_CONDITION_TARGETS]; // an array of targets available for conditions Condition* mLastFailedCondition; - ConditionSourceInfo(WorldObject* target0, WorldObject* target1 = NULL, WorldObject* target2 = nullptr) + ConditionSourceInfo(WorldObject* target0, WorldObject* target1 = nullptr, WorldObject* target2 = nullptr) { mConditionTargets[0] = target0; mConditionTargets[1] = target1; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 12c61c8bc..c25c213af 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -448,7 +448,7 @@ public: [[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } void Update(uint32 time) override; // overwrited Unit::Update - void GetRespawnPosition(float& x, float& y, float& z, float* ori = NULL, float* dist = NULL) const; + void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr, float* dist = nullptr) const; void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } [[nodiscard]] uint32 GetCorpseDelay() const { return m_corpseDelay; } @@ -531,7 +531,7 @@ public: [[nodiscard]] bool HasSpell(uint32 spellID) const override; - bool UpdateEntry(uint32 entry, const CreatureData* data = NULL, bool changelevel = true ); + bool UpdateEntry(uint32 entry, const CreatureData* data = nullptr, bool changelevel = true ); bool UpdateStats(Stats stat) override; bool UpdateAllStats() override; void UpdateResistances(uint32 school) override; @@ -724,7 +724,7 @@ public: protected: bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = nullptr); - bool InitEntry(uint32 entry, const CreatureData* data = NULL); + bool InitEntry(uint32 entry, const CreatureData* data = nullptr); // vendor items VendorItemCounts m_vendorItemCounts; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 57ec38e25..97ea88d33 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -901,10 +901,10 @@ public: void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = nullptr) override; // pussywizard! - void ModifyHealth(int32 change, Unit* attackerOrHealer = NULL, uint32 spellId = 0); + void ModifyHealth(int32 change, Unit* attackerOrHealer = nullptr, uint32 spellId = 0); void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; } // sets GameObject type 33 destruction flags and optionally default health for that state - void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = NULL, bool setHealth = false); + void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = nullptr, bool setHealth = false); [[nodiscard]] GameObjectDestructibleState GetDestructibleState() const { if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED)) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 369445ad6..7dcbb5b9f 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -196,7 +196,7 @@ bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto); class Item : public Object { public: - static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL, bool clone = false, uint32 randomPropertyId = 0); + static Item* CreateItem(uint32 item, uint32 count, Player const* player = nullptr, bool clone = false, uint32 randomPropertyId = 0); Item* CloneItem(uint32 count, Player const* player = nullptr) const; Item(); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 695a98e8c..cd68dd9b1 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -790,7 +790,7 @@ public: void GetNearPoint2D(float& x, float& y, float distance, float absAngle) const; void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ = 0) const; void GetVoidClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float relAngle = 0, float controlZ = 0) const; - bool GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float angle = 0, const WorldObject* forWho = NULL, bool force = false) const; + bool GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float angle = 0, const WorldObject* forWho = nullptr, bool force = false) const; void MovePosition(Position& pos, float dist, float angle); void GetNearPosition(Position& pos, float dist, float angle) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 31139680e..f237943fb 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1202,13 +1202,13 @@ public: [[nodiscard]] uint8 GetChatTag() const; std::string autoReplyMsg; - uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin = NULL); + uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin = nullptr); PlayerSocial* GetSocial() { return m_social; } PlayerTaxi m_taxi; void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); } - bool ActivateTaxiPathTo(std::vector const& nodes, Creature* npc = NULL, uint32 spellid = 1); + bool ActivateTaxiPathTo(std::vector const& nodes, Creature* npc = nullptr, uint32 spellid = 1); bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 1); void CleanupAfterTaxiFlight(); void ContinueTaxiFlight(); @@ -1308,7 +1308,7 @@ public: [[nodiscard]] InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, nullptr); } InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const { - return CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count); + return CanStoreItem(bag, slot, dest, item, count, nullptr, false, no_space_count); } InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const { @@ -1346,7 +1346,7 @@ public: void UpdateTitansGrip(); InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr) const; - InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = nullptr) const; + InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = nullptr, bool swap = false, uint32* no_space_count = nullptr) const; void AddRefundReference(uint32 it); void DeleteRefundReference(uint32 it); @@ -1381,7 +1381,7 @@ public: Item* GetItemFromBuyBackSlot(uint32 slot); void RemoveItemFromBuyBackSlot(uint32 slot, bool del); [[nodiscard]] uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END - KEYRING_SLOT_START; } - void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0); + void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = nullptr, uint32 itemid = 0); void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param); void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } @@ -1796,7 +1796,7 @@ public: void AddSpellMod(SpellModifier* mod, bool apply); bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr); bool HasSpellMod(SpellModifier* mod, Spell* spell); - template T ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = NULL, bool temporaryPet = false); + template T ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr, bool temporaryPet = false); void RemoveSpellMods(Spell* spell); void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr); void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr); @@ -1820,10 +1820,10 @@ public: SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); return uint32(itr != m_spellCooldowns.end() && itr->second.end > World::GetGameTimeMS() ? itr->second.end - World::GetGameTimeMS() : 0); } - void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false); + void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = nullptr, bool infinityCooldown = false); void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false) override; void ModifySpellCooldown(uint32 spellId, int32 cooldown); - void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true); + void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = nullptr, bool setCooldown = true); void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override; void RemoveSpellCooldown(uint32 spell_id, bool update = false); void SendClearCooldown(uint32 spell_id, Unit* target); @@ -1910,7 +1910,7 @@ public: bool IsGroupVisibleFor(Player const* p) const; bool IsInSameGroupWith(Player const* p) const; - bool IsInSameRaidWith(Player const* p) const { return p == this || (GetGroup() != NULL && GetGroup() == p->GetGroup()); } + bool IsInSameRaidWith(Player const* p) const { return p == this || (GetGroup() != nullptr && GetGroup() == p->GetGroup()); } void UninviteFromGroup(); static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = nullptr); void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 855093fea..af8eefb51 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1440,8 +1440,8 @@ public: void CombatStop(bool includingCast = false); void CombatStopWithPets(bool includingCast = false); void StopAttackFaction(uint32 faction_id); - Unit* SelectNearbyTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; - Unit* SelectNearbyNoTotemTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; + Unit* SelectNearbyTarget(Unit* exclude = nullptr, float dist = NOMINAL_MELEE_RANGE) const; + Unit* SelectNearbyNoTotemTarget(Unit* exclude = nullptr, float dist = NOMINAL_MELEE_RANGE) const; void SendMeleeAttackStop(Unit* victim = nullptr); void SendMeleeAttackStart(Unit* victim, Player* sendTo = nullptr); @@ -1581,11 +1581,11 @@ public: uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb); - static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true, bool allowGM = false); + static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false); static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr); static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth); - void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = nullptr); + void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = nullptr, SpellInfo const* procAura = nullptr); void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = nullptr); void GetProcAurasTriggeredOnEvent(std::list& aurasTriggeringProc, std::list* procAuras, ProcEventInfo eventInfo); @@ -1702,7 +1702,7 @@ public: [[nodiscard]] bool IsPetInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); } void CombatStart(Unit* target, bool initialAggro = true); void CombatStartOnCast(Unit* target, bool initialAggro = true, uint32 duration = 0); - void SetInCombatState(bool PvP, Unit* enemy = NULL, uint32 duration = 0); + void SetInCombatState(bool PvP, Unit* enemy = nullptr, uint32 duration = 0); void SetInCombatWith(Unit* enemy, uint32 duration = 0); void ClearInCombat(); void ClearInPetCombat(); @@ -1910,7 +1910,7 @@ public: bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id); // aura apply/remove helpers - you should better not use these - Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool periodicReset = false); + Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, uint64 casterGUID = 0, bool periodicReset = false); void _AddAura(UnitAura* aura, Unit* caster); AuraApplication* _CreateAuraApplication(Aura* aura, uint8 effMask); void _ApplyAuraEffect(Aura* aura, uint8 effIndex); @@ -1946,7 +1946,7 @@ public: void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer); void RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid); - void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true); + void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = nullptr, bool negative = true, bool positive = true); void RemoveNotOwnSingleTargetAuras(); void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0); void RemoveAurasWithAttribute(uint32 flags); @@ -2163,7 +2163,7 @@ public: VisibleAuraMap::iterator itr = m_visibleAuras.find(slot); if (itr != m_visibleAuras.end()) return itr->second; - return 0; + return nullptr; } void SetVisibleAura(uint8 slot, AuraApplication* aur) { m_visibleAuras[slot] = aur; UpdateAuraForGroup(slot);} void RemoveVisibleAura(uint8 slot) { m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);} @@ -2195,7 +2195,7 @@ public: void ModifyAuraState(AuraStateType flag, bool apply); uint32 BuildAuraStateUpdateForTarget(Unit* target) const; - bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = nullptr) const; + bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = nullptr, Unit const* Caster = nullptr) const; void UnsummonAllTotems(); Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = nullptr); @@ -2243,9 +2243,9 @@ public: bool IsImmunedToDamageOrSchool(SpellInfo const* spellInfo) const; virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature - static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); + static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = nullptr, uint8 effIndex = MAX_SPELL_EFFECTS); static uint32 CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, const uint32 damage, SpellInfo const* spellInfo, uint8 attackerLevel = 0, WeaponAttackType attackType = MAX_ATTACK); - static void CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32* absorb, uint32* resist, SpellInfo const* spellInfo = NULL, bool Splited = false); + static void CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32* absorb, uint32* resist, SpellInfo const* spellInfo = nullptr, bool Splited = false); static void CalcHealAbsorb(Unit const* victim, const SpellInfo* spellProto, uint32& healAmount, uint32& absorb); void UpdateSpeed(UnitMoveType mtype, bool forced); @@ -2258,7 +2258,7 @@ public: int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = nullptr) const; int32 CalcSpellDuration(SpellInfo const* spellProto); int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask); - void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = NULL); + void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = nullptr); float CalculateLevelPenalty(SpellInfo const* spellProto) const; void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index eee74d7c4..c7acc5667 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -104,12 +104,12 @@ public: static Unit* GetObjectInOrOutOfWorld(uint64 guid, Unit* /*typeSpecifier*/) { if (IS_PLAYER_GUID(guid)) - return (Unit*)GetObjectInOrOutOfWorld(guid, (Player*)NULL); + return (Unit*)GetObjectInOrOutOfWorld(guid, (Player*)nullptr); if (IS_PET_GUID(guid)) - return (Unit*)GetObjectInOrOutOfWorld(guid, (Pet*)NULL); + return (Unit*)GetObjectInOrOutOfWorld(guid, (Pet*)nullptr); - return (Unit*)GetObjectInOrOutOfWorld(guid, (Creature*)NULL); + return (Unit*)GetObjectInOrOutOfWorld(guid, (Creature*)nullptr); } // returns object if is in world @@ -124,12 +124,12 @@ public: static Unit* GetObjectInWorld(uint64 guid, Unit* /*typeSpecifier*/) { if (IS_PLAYER_GUID(guid)) - return (Unit*)GetObjectInWorld(guid, (Player*)NULL); + return (Unit*)GetObjectInWorld(guid, (Player*)nullptr); if (IS_PET_GUID(guid)) - return (Unit*)GetObjectInWorld(guid, (Pet*)NULL); + return (Unit*)GetObjectInWorld(guid, (Pet*)nullptr); - return (Unit*)GetObjectInWorld(guid, (Creature*)NULL); + return (Unit*)GetObjectInWorld(guid, (Creature*)nullptr); } // returns object if is in map diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 05caa5a14..966d984f7 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1286,7 +1286,7 @@ public: void AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist = true); // for event bool RemoveVendorItem(uint32 entry, uint32 item, bool persist = true); // for event - bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = NULL, std::set* skip_vendors = NULL, uint32 ORnpcflag = 0) const; + bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = nullptr, std::set* skip_vendors = nullptr, uint32 ORnpcflag = 0) const; void LoadScriptNames(); ScriptNameContainer& GetScriptNames() { return _scriptNamesStore; } diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index d10f1c9ac..ebba752b7 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -362,7 +362,7 @@ struct Loot // Inserts the item into the loot (called by LootTemplate processors) void AddItem(LootStoreItem const& item); - LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = nullptr); + LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = nullptr, QuestItem** ffaitem = nullptr, QuestItem** conditem = nullptr); uint32 GetMaxSlotInLootFor(Player* player) const; bool hasItemFor(Player* player) const; [[nodiscard]] bool hasOverThresholdItem() const; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 49f25bb35..3d4c33eb0 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -213,7 +213,7 @@ public: [[nodiscard]] float getMinHeight(float x, float y) const; [[nodiscard]] float getLiquidLevel(float x, float y) const; [[nodiscard]] uint8 getTerrainType(float x, float y) const; - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0); + ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = nullptr); }; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform @@ -357,7 +357,7 @@ public: [[nodiscard]] float GetMinHeight(float x, float y) const; Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr); - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const; + ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = nullptr) const; uint32 GetAreaId(float x, float y, float z, bool* isOutdoors) const; bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const; @@ -369,7 +369,7 @@ public: [[nodiscard]] uint8 GetTerrainType(float x, float y) const; [[nodiscard]] float GetWaterLevel(float x, float y) const; - bool IsInWater(float x, float y, float z, LiquidData* data = 0) const; + bool IsInWater(float x, float y, float z, LiquidData* data = nullptr) const; [[nodiscard]] bool IsUnderWater(float x, float y, float z) const; void MoveAllCreaturesInMoveList(); @@ -451,7 +451,7 @@ public: void UpdateIteratorBack(Player* player); - TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0); + TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = nullptr, uint32 duration = 0, Unit* summoner = nullptr, uint32 spellId = 0, uint32 vehId = 0); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true); void SummonCreatureGroup(uint8 group, std::list* list = nullptr); Player* GetPlayer(uint64 guid); @@ -471,7 +471,7 @@ public: BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast(this); else return nullptr; } [[nodiscard]] const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast(this); return nullptr; } - float GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground = NULL, bool swim = false, float maxSearchDist = 50.0f) const; + float GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground = nullptr, bool swim = false, float maxSearchDist = 50.0f) const; [[nodiscard]] float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; [[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks) const; void Balance() { _dynamicTree.balance(); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index d78a10d6c..efb98170d 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -178,7 +178,7 @@ public: void MoveTakeoff(uint32 id, Position const& pos, float speed); void MoveTakeoff(uint32 id, float x, float y, float z, float speed); // pussywizard: added for easy calling by passing 3 floats x, y, z - void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, const Movement::PointsArray* path = NULL, bool generatePath = false, float orientation = 0.0f); + void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, const Movement::PointsArray* path = nullptr, bool generatePath = false, float orientation = 0.0f); void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ); void MoveJumpTo(float angle, float speedXY, float speedZ); void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = 0) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index ecab18d16..4895cd3e7 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -713,10 +713,10 @@ public: void SendWorldText(uint32 string_id, ...); void SendGlobalText(const char* text, WorldSession* self); void SendGMText(uint32 string_id, ...); - void SendGlobalMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); - void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); - bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); - void SendZoneText(uint32 zone, const char* text, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); + void SendGlobalMessage(WorldPacket* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL); + void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL); + bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL); + void SendZoneText(uint32 zone, const char* text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL); void SendServerMessage(ServerMessageType type, const char* text = "", Player* player = nullptr); /// Are we in the middle of a shutdown? diff --git a/src/server/shared/Network/RealmSocket.cpp b/src/server/shared/Network/RealmSocket.cpp index e625b80c3..3fcf7c38f 100644 --- a/src/server/shared/Network/RealmSocket.cpp +++ b/src/server/shared/Network/RealmSocket.cpp @@ -148,11 +148,11 @@ ssize_t RealmSocket::noblk_send(ACE_Message_Block& message_block) bool RealmSocket::send(const char* buf, size_t len) { - if (buf == NULL || len == 0) + if (buf == nullptr || len == 0) return true; - ACE_Data_Block db(len, ACE_Message_Block::MB_DATA, (const char*)buf, 0, 0, ACE_Message_Block::DONT_DELETE, 0); - ACE_Message_Block message_block(&db, ACE_Message_Block::DONT_DELETE, 0); + ACE_Data_Block db(len, ACE_Message_Block::MB_DATA, (const char*)buf, nullptr, nullptr, ACE_Message_Block::DONT_DELETE, nullptr); + ACE_Message_Block message_block(&db, ACE_Message_Block::DONT_DELETE, nullptr); message_block.wr_ptr(len); @@ -191,7 +191,7 @@ int RealmSocket::handle_output(ACE_HANDLE) if (closing_) return -1; - ACE_Message_Block* mb = 0; + ACE_Message_Block* mb = nullptr; if (msg_queue()->is_empty()) { diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index 196e6d84e..2c4f2317e 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -34,7 +34,7 @@ bool isHole(int holes, int i, int j) // ADT_file::ADT_file() { - a_grid = 0; + a_grid = nullptr; } ADT_file::~ADT_file() @@ -44,7 +44,7 @@ ADT_file::~ADT_file() void ADT_file::free() { - a_grid = 0; + a_grid = nullptr; FileLoader::free(); } diff --git a/src/tools/map_extractor/adt.h b/src/tools/map_extractor/adt.h index eb511016b..4e0d253a3 100644 --- a/src/tools/map_extractor/adt.h +++ b/src/tools/map_extractor/adt.h @@ -126,13 +126,13 @@ public: { if (offsMCVT) return (adt_MCVT*)((uint8*)this + offsMCVT); - return 0; + return nullptr; } adt_MCLQ* getMCLQ() { if (offsMCLQ) return (adt_MCLQ*)((uint8*)this + offsMCLQ); - return 0; + return nullptr; } }; @@ -162,7 +162,7 @@ public: { if (cells[x][y].offsMCNK) return (adt_MCNK*)((uint8*)this + cells[x][y].offsMCNK - 84); - return 0; + return nullptr; } }; @@ -209,42 +209,42 @@ public: { if (liquid[x][y].used && liquid[x][y].offsData1) return (adt_liquid_header*)((uint8*)this + 8 + liquid[x][y].offsData1); - return 0; + return nullptr; } float* getLiquidHeightMap(adt_liquid_header* h) { if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT) - return 0; + return nullptr; if (h->offsData2b) return (float*)((uint8*)this + 8 + h->offsData2b); - return 0; + return nullptr; } uint8* getLiquidLightMap(adt_liquid_header* h) { if (h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT) - return 0; + return nullptr; if (h->offsData2b) { if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT) return (uint8*)((uint8*)this + 8 + h->offsData2b); return (uint8*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4); } - return 0; + return nullptr; } uint32* getLiquidFullLightMap(adt_liquid_header* h) { if (!(h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT)) - return 0; + return nullptr; if (h->offsData2b) { if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT) return (uint32*)((uint8*)this + 8 + h->offsData2b); return (uint32*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4); } - return 0; + return nullptr; } uint64 getLiquidShowMap(adt_liquid_header* h) diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index ac3eb7dbe..a090c7b65 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -16,9 +16,9 @@ u_map_fcc MverMagic = { {'R', 'E', 'V', 'M'} }; FileLoader::FileLoader() { - data = 0; + data = nullptr; data_size = 0; - version = 0; + version = nullptr; } FileLoader::~FileLoader() @@ -65,7 +65,7 @@ bool FileLoader::prepareLoadedData() void FileLoader::free() { delete[] data; - data = 0; + data = nullptr; data_size = 0; - version = 0; + version = nullptr; } diff --git a/src/tools/map_extractor/mpq_libmpq.cpp b/src/tools/map_extractor/mpq_libmpq.cpp index 162c0d38a..980f2012d 100644 --- a/src/tools/map_extractor/mpq_libmpq.cpp +++ b/src/tools/map_extractor/mpq_libmpq.cpp @@ -50,7 +50,7 @@ void MPQArchive::close() MPQFile::MPQFile(const char* filename): eof(false), - buffer(0), + buffer(nullptr), pointer(0), size(0) { @@ -68,7 +68,7 @@ MPQFile::MPQFile(const char* filename): { // printf("warning: file %s has size %d; cannot read.\n", filename, size); eof = true; - buffer = 0; + buffer = nullptr; return; } buffer = new char[size]; @@ -80,7 +80,7 @@ MPQFile::MPQFile(const char* filename): } eof = true; - buffer = 0; + buffer = nullptr; } size_t MPQFile::read(void* dest, size_t bytes) @@ -116,6 +116,6 @@ void MPQFile::seekRelative(int offset) void MPQFile::close() { delete[] buffer; - buffer = 0; + buffer = nullptr; eof = true; } diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index 2e5107299..62cede17c 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -35,9 +35,9 @@ bool wdt_MAIN::prepareLoadedData() WDT_file::WDT_file() { - mphd = 0; - main = 0; - wmo = 0; + mphd = nullptr; + main = nullptr; + wmo = nullptr; } WDT_file::~WDT_file() @@ -47,9 +47,9 @@ WDT_file::~WDT_file() void WDT_file::free() { - mphd = 0; - main = 0; - wmo = 0; + mphd = nullptr; + main = nullptr; + wmo = nullptr; FileLoader::free(); } diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp index 1671394e2..57f853ca4 100644 --- a/src/tools/vmap4_extractor/model.cpp +++ b/src/tools/vmap4_extractor/model.cpp @@ -12,7 +12,7 @@ #include #include -Model::Model(std::string& filename) : filename(filename), vertices(0), indices(0) +Model::Model(std::string& filename) : filename(filename), vertices(nullptr), indices(nullptr) { memset(&header, 0, sizeof(header)); } diff --git a/src/tools/vmap4_extractor/mpq_libmpq.cpp b/src/tools/vmap4_extractor/mpq_libmpq.cpp index 1d8d951f5..8c889b62b 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq.cpp +++ b/src/tools/vmap4_extractor/mpq_libmpq.cpp @@ -50,7 +50,7 @@ void MPQArchive::close() MPQFile::MPQFile(const char* filename): eof(false), - buffer(0), + buffer(nullptr), pointer(0), size(0) { @@ -68,7 +68,7 @@ MPQFile::MPQFile(const char* filename): { // printf("info: file %s has size %d; considered dummy file.\n", filename, size); eof = true; - buffer = 0; + buffer = nullptr; return; } buffer = new char[size]; @@ -80,7 +80,7 @@ MPQFile::MPQFile(const char* filename): } eof = true; - buffer = 0; + buffer = nullptr; } size_t MPQFile::read(void* dest, size_t bytes) @@ -116,6 +116,6 @@ void MPQFile::seekRelative(int offset) void MPQFile::close() { delete[] buffer; - buffer = 0; + buffer = nullptr; eof = true; } diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index 99bb64951..a0a4158f1 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -53,7 +53,7 @@ typedef struct } map_id; map_id* map_ids; -uint16* LiqType = 0; +uint16* LiqType = nullptr; uint32 map_count; char output_path[128] = "."; char input_path[1024] = "."; diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp index 5bf3a4e73..c1a3876f2 100644 --- a/src/tools/vmap4_extractor/wmo.cpp +++ b/src/tools/vmap4_extractor/wmo.cpp @@ -125,8 +125,8 @@ bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile) } WMOGroup::WMOGroup(const std::string& filename) : - filename(filename), MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), - hlq(0), LiquEx(0), LiquBytes(0), groupName(0), descGroupName(0), mogpFlags(0), + filename(filename), MOPY(nullptr), MOVI(nullptr), MoviEx(nullptr), MOVT(nullptr), MOBA(nullptr), MobaEx(nullptr), + hlq(nullptr), LiquEx(nullptr), LiquBytes(nullptr), groupName(0), descGroupName(0), mogpFlags(0), moprIdx(0), moprNItems(0), nBatchA(0), nBatchB(0), nBatchC(0), fogIdx(0), liquidType(0), groupWMOID(0), mopy_size(0), moba_size(0), LiquEx_size(0), nVertices(0), nTriangles(0), liquflags(0)