diff --git a/src/framework/Dynamic/FactoryHolder.h b/src/framework/Dynamic/FactoryHolder.h index d97aac39d..bdc2b9f45 100644 --- a/src/framework/Dynamic/FactoryHolder.h +++ b/src/framework/Dynamic/FactoryHolder.h @@ -44,7 +44,7 @@ class MANGOS_DLL_DECL FactoryHolder void DeregisterSelf(void) { FactoryHolderRepository::Instance().RemoveItem(this, false); } /// Abstract Factory create method - virtual T* Create(void *data = NULL) const = 0; + virtual T* Create(void *data = nullptr) const = 0; private: Key i_key; }; diff --git a/src/framework/GameSystem/GridRefManager.h b/src/framework/GameSystem/GridRefManager.h index bb240a501..7d48c442e 100644 --- a/src/framework/GameSystem/GridRefManager.h +++ b/src/framework/GameSystem/GridRefManager.h @@ -44,8 +44,8 @@ class GridRefManager : public RefManager, OBJECT> } iterator begin() { return iterator(getFirst()); } - iterator end() { return iterator(NULL); } + iterator end() { return iterator(nullptr); } iterator rbegin() { return iterator(getLast()); } - iterator rend() { return iterator(NULL); } + iterator rend() { return iterator(nullptr); } }; #endif diff --git a/src/framework/GameSystem/TypeContainer.h b/src/framework/GameSystem/TypeContainer.h index 5dbe1f2bf..42e84fb1e 100644 --- a/src/framework/GameSystem/TypeContainer.h +++ b/src/framework/GameSystem/TypeContainer.h @@ -67,13 +67,13 @@ class TypeUnorderedMapContainer template bool erase(KEY_TYPE handle, SPECIFIC_TYPE* /*obj*/) { - return TypeUnorderedMapContainer::erase(i_elements, handle, (SPECIFIC_TYPE*)NULL); + return TypeUnorderedMapContainer::erase(i_elements, handle, (SPECIFIC_TYPE*)nullptr); } template SPECIFIC_TYPE* find(KEY_TYPE hdl, SPECIFIC_TYPE* /*obj*/) { - return TypeUnorderedMapContainer::find(i_elements, hdl, (SPECIFIC_TYPE*)NULL); + return TypeUnorderedMapContainer::find(i_elements, hdl, (SPECIFIC_TYPE*)nullptr); } private: @@ -123,7 +123,7 @@ class TypeUnorderedMapContainer { typename std::unordered_map::iterator i = elements._element.find(hdl); if (i == elements._element.end()) - return NULL; + return nullptr; else return i->second; } @@ -131,20 +131,20 @@ class TypeUnorderedMapContainer template static SPECIFIC_TYPE* find(ContainerUnorderedMap& /*elements*/, KEY_TYPE /*hdl*/, SPECIFIC_TYPE* /*obj*/) { - return NULL; + return nullptr; } template static SPECIFIC_TYPE* find(ContainerUnorderedMap& /*elements*/, KEY_TYPE /*hdl*/, SPECIFIC_TYPE* /*obj*/) { - return NULL; + return nullptr; } template static SPECIFIC_TYPE* find(ContainerUnorderedMap< TypeList, KEY_TYPE >& elements, KEY_TYPE hdl, SPECIFIC_TYPE* /*obj*/) { - SPECIFIC_TYPE* ret = TypeUnorderedMapContainer::find(elements._elements, hdl, (SPECIFIC_TYPE*)NULL); - return ret ? ret : TypeUnorderedMapContainer::find(elements._TailElements, hdl, (SPECIFIC_TYPE*)NULL); + SPECIFIC_TYPE* ret = TypeUnorderedMapContainer::find(elements._elements, hdl, (SPECIFIC_TYPE*)nullptr); + return ret ? ret : TypeUnorderedMapContainer::find(elements._TailElements, hdl, (SPECIFIC_TYPE*)nullptr); } // Erase helpers @@ -171,8 +171,8 @@ class TypeUnorderedMapContainer template static bool erase(ContainerUnorderedMap< TypeList, KEY_TYPE >& elements, KEY_TYPE handle, SPECIFIC_TYPE* /*obj*/) { - bool ret = TypeUnorderedMapContainer::erase(elements._elements, handle, (SPECIFIC_TYPE*)NULL); - return ret ? ret : TypeUnorderedMapContainer::erase(elements._TailElements, handle, (SPECIFIC_TYPE*)NULL); + bool ret = TypeUnorderedMapContainer::erase(elements._elements, handle, (SPECIFIC_TYPE*)nullptr); + return ret ? ret : TypeUnorderedMapContainer::erase(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr); } }; @@ -214,14 +214,14 @@ class MANGOS_DLL_DECL TypeMapContainer public: template - size_t Count() const { return MaNGOS::Count(i_elements, (SPECIFIC_TYPE*)NULL); } + size_t Count() const { return MaNGOS::Count(i_elements, (SPECIFIC_TYPE*)nullptr); } /// inserts a specific object into the container template bool insert(SPECIFIC_TYPE *obj) { SPECIFIC_TYPE* t = MaNGOS::Insert(i_elements, obj); - return (t != NULL); + return (t != nullptr); } /// Removes the object from the container, and returns the removed object @@ -229,7 +229,7 @@ class MANGOS_DLL_DECL TypeMapContainer bool remove(SPECIFIC_TYPE* obj) { SPECIFIC_TYPE* t = MaNGOS::Remove(i_elements, obj); - return (t != NULL); + return (t != nullptr); } ContainerMapList & GetElements() { return i_elements; } diff --git a/src/framework/GameSystem/TypeContainerFunctions.h b/src/framework/GameSystem/TypeContainerFunctions.h index 2f753d16c..7ff1a6991 100644 --- a/src/framework/GameSystem/TypeContainerFunctions.h +++ b/src/framework/GameSystem/TypeContainerFunctions.h @@ -78,14 +78,14 @@ namespace MaNGOS template SPECIFIC_TYPE* Insert(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/) { - return NULL; + return nullptr; } // this is a missed template SPECIFIC_TYPE* Insert(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/) { - return NULL; // a missed + return nullptr; // a missed } // Recursion @@ -93,7 +93,7 @@ namespace MaNGOS SPECIFIC_TYPE* Insert(ContainerMapList >&elements, SPECIFIC_TYPE *obj) { SPECIFIC_TYPE* t= Insert(elements._elements, obj); - return (t != NULL ? t : Insert(elements._TailElements, obj)); + return (t != nullptr ? t : Insert(elements._TailElements, obj)); } // non-const remove method @@ -107,14 +107,14 @@ namespace MaNGOS template SPECIFIC_TYPE* Remove(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/) { - return NULL; + return nullptr; } // this is a missed template SPECIFIC_TYPE* Remove(ContainerMapList &/*elements*/, SPECIFIC_TYPE * /*obj*/) { - return NULL; // a missed + return nullptr; // a missed } template @@ -122,7 +122,7 @@ namespace MaNGOS { // The head element is bad SPECIFIC_TYPE* t = Remove(elements._elements, obj); - return ( t != NULL ? t : Remove(elements._TailElements, obj) ); + return ( t != nullptr ? t : Remove(elements._TailElements, obj) ); } } diff --git a/src/framework/GameSystem/TypeContainerFunctionsPtr.h b/src/framework/GameSystem/TypeContainerFunctionsPtr.h index a36ae4ba4..57062c45b 100644 --- a/src/framework/GameSystem/TypeContainerFunctionsPtr.h +++ b/src/framework/GameSystem/TypeContainerFunctionsPtr.h @@ -65,17 +65,17 @@ namespace MaNGOS template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { typename std::map >::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); + return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)nullptr) : iter->second); }; template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { - return NullPtr((SPECIFIC_TYPE*)NULL);// terminate recursion + return NullPtr((SPECIFIC_TYPE*)nullptr);// terminate recursion } template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { - return NullPtr((SPECIFIC_TYPE*)NULL);// this is a missed + return NullPtr((SPECIFIC_TYPE*)nullptr);// this is a missed } template CountedPtr& Find(ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) @@ -88,17 +88,17 @@ namespace MaNGOS template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { typename CountedPtr::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); + return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)nullptr) : iter->second); }; template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { - return NullPtr((SPECIFIC_TYPE*)NULL); + return NullPtr((SPECIFIC_TYPE*)nullptr); } template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) { - return NullPtr((SPECIFIC_TYPE*)NULL); + return NullPtr((SPECIFIC_TYPE*)nullptr); } template CountedPtr& Find(const ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) @@ -119,13 +119,13 @@ namespace MaNGOS template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) { - return NullPtr((SPECIFIC_TYPE*)NULL); + return NullPtr((SPECIFIC_TYPE*)nullptr); } // this is a missed template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) { - return NullPtr((SPECIFIC_TYPE*)NULL);// a missed + return NullPtr((SPECIFIC_TYPE*)nullptr);// a missed } // Recursion diff --git a/src/framework/Network/MangosSocketImpl.h b/src/framework/Network/MangosSocketImpl.h index ede54bc92..0abb2ce3b 100644 --- a/src/framework/Network/MangosSocketImpl.h +++ b/src/framework/Network/MangosSocketImpl.h @@ -75,7 +75,7 @@ void MangosSocket::CloseSocket(void) { ACE_GUARD(LockType, Guard, m_SessionLock); - m_Session = NULL; + m_Session = nullptr; } } @@ -269,7 +269,7 @@ int MangosSocket::handle_close(ACE_HANDLE h, ACE { ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); - m_Session = NULL; + m_Session = nullptr; } reactor()->remove_handler(this, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::ALL_EVENTS_MASK); @@ -291,7 +291,7 @@ int MangosSocket::Update(void) template int MangosSocket::handle_input_header(void) { - MANGOS_ASSERT(m_RecvWPct == NULL); + MANGOS_ASSERT(m_RecvWPct == nullptr); MANGOS_ASSERT(m_Header.length() == sizeof(ClientPktHeader)); @@ -334,13 +334,13 @@ int MangosSocket::handle_input_payload(void) MANGOS_ASSERT(m_RecvPct.space() == 0); MANGOS_ASSERT(m_Header.space() == 0); - MANGOS_ASSERT(m_RecvWPct != NULL); + MANGOS_ASSERT(m_RecvWPct != nullptr); const int ret = ((SocketName*)this)->ProcessIncoming(m_RecvWPct); - m_RecvPct.base(NULL, 0); + m_RecvPct.base(nullptr, 0); m_RecvPct.reset(); - m_RecvWPct = NULL; + m_RecvWPct = nullptr; m_Header.reset(); @@ -407,7 +407,7 @@ int MangosSocket::handle_input_missing_data(void // hope this is not hack ,as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - sLog.outError("Forcing close on input m_RecvWPct = NULL"); + sLog.outError("Forcing close on input m_RecvWPct = nullptr"); errno = EINVAL; return -1; } diff --git a/src/framework/Network/MangosSocketMgrImpl.h b/src/framework/Network/MangosSocketMgrImpl.h index 2f9ad83eb..c35cc1c42 100644 --- a/src/framework/Network/MangosSocketMgrImpl.h +++ b/src/framework/Network/MangosSocketMgrImpl.h @@ -345,7 +345,7 @@ int MangosSocketMgr::Connect(int port, std::string const& address, S if (connector.connect(handler,addr) == -1) { // Handler is already deleted. - handler = NULL; + handler = nullptr; return -1; } // Now add a reactor so our connnection gets updated diff --git a/src/framework/Policies/CreationPolicy.h b/src/framework/Policies/CreationPolicy.h index 27ab006e9..98ec2bd56 100644 --- a/src/framework/Policies/CreationPolicy.h +++ b/src/framework/Policies/CreationPolicy.h @@ -94,7 +94,7 @@ namespace MaNGOS void* p = malloc(sizeof(T)); if (!p) - return NULL; + return nullptr; return new(p) T; } diff --git a/src/framework/Policies/MemoryManagement.cpp b/src/framework/Policies/MemoryManagement.cpp index 1ee2af6b5..e64b19945 100644 --- a/src/framework/Policies/MemoryManagement.cpp +++ b/src/framework/Policies/MemoryManagement.cpp @@ -29,7 +29,7 @@ void* operator new(size_t sz) { void *res = scalable_malloc(sz); - if (res == NULL) + if (res == nullptr) throw std::bad_alloc(); return res; @@ -39,7 +39,7 @@ void* operator new[](size_t sz) { void *res = scalable_malloc(sz); - if (res == NULL) + if (res == nullptr) throw std::bad_alloc(); return res; diff --git a/src/framework/Policies/SingletonImp.h b/src/framework/Policies/SingletonImp.h index a853cda1c..700b255f6 100644 --- a/src/framework/Policies/SingletonImp.h +++ b/src/framework/Policies/SingletonImp.h @@ -67,7 +67,7 @@ class LifeTimePolicy void MaNGOS::Singleton::DestroySingleton() { CreatePolicy::Destroy(si_instance); - si_instance = NULL; + si_instance = nullptr; si_destroyed = true; } diff --git a/src/framework/Utilities/LinkedReference/RefManager.h b/src/framework/Utilities/LinkedReference/RefManager.h index a1fda9e79..e4539df97 100644 --- a/src/framework/Utilities/LinkedReference/RefManager.h +++ b/src/framework/Utilities/LinkedReference/RefManager.h @@ -42,14 +42,14 @@ class RefManager : public LinkedListHead Reference const* getLast() const { return ((Reference const*) LinkedListHead::getLast()); } iterator begin() { return iterator(getFirst()); } - iterator end() { return iterator(NULL); } + iterator end() { return iterator(nullptr); } iterator rbegin() { return iterator(getLast()); } - iterator rend() { return iterator(NULL); } + iterator rend() { return iterator(nullptr); } 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/framework/Utilities/LinkedReference/Reference.h b/src/framework/Utilities/LinkedReference/Reference.h index 3cd2a3326..3a6419dc6 100644 --- a/src/framework/Utilities/LinkedReference/Reference.h +++ b/src/framework/Utilities/LinkedReference/Reference.h @@ -52,7 +52,7 @@ class Reference : public LinkedListElement // Create new link void link(TO* toObj, FROM* fromObj) { - assert(fromObj); // fromObj MUST not be NULL + assert(fromObj); // fromObj MUST not be nullptr if (isValid()) unlink(); diff --git a/src/game/AI/CreatureAI.h b/src/game/AI/CreatureAI.h index 9abc700bd..1660c8be4 100644 --- a/src/game/AI/CreatureAI.h +++ b/src/game/AI/CreatureAI.h @@ -88,7 +88,7 @@ class MANGOS_DLL_SPEC CreatureAI // Called when an unit moves within visibility distance virtual void MoveInLineOfSight(Unit*) {} - // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) + // Called for reaction at enter to combat if not in combat yet (enemy can be nullptr) virtual void EnterCombat(Unit* /*enemy*/) {} // Called for reaction at stopping attack at no attackers or targets diff --git a/src/game/AI/CreatureAISelector.cpp b/src/game/AI/CreatureAISelector.cpp index 40e781d0f..def94638a 100644 --- a/src/game/AI/CreatureAISelector.cpp +++ b/src/game/AI/CreatureAISelector.cpp @@ -47,13 +47,13 @@ CreatureAI* selectAI(Creature *creature) CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance()); - const CreatureAICreator *ai_factory = NULL; + const CreatureAICreator *ai_factory = nullptr; std::string ainame = creature->GetAIName(); // select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI - Unit *owner = NULL; + Unit *owner = nullptr; if ((creature->IsPet() && ((Pet*)creature)->isControlled() && ((owner = creature->GetOwner()) && owner->GetTypeId() == TYPEID_PLAYER)) || creature->isCharmed()) ai_factory = ai_registry.GetRegistryItem("PetAI"); @@ -85,7 +85,7 @@ CreatureAI* selectAI(Creature *creature) { const CreatureAICreator *factory = iter->second; const SelectableAI *p = dynamic_cast(factory); - MANGOS_ASSERT(p != NULL); + MANGOS_ASSERT(p != nullptr); int val = p->Permit(creature); if (val > best_val) { @@ -96,21 +96,21 @@ CreatureAI* selectAI(Creature *creature) } // select NullCreatureAI if not another cases - ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); + ainame = (ai_factory == nullptr) ? "NullCreatureAI" : ai_factory->key(); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str()); - return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature)); + return (ai_factory == nullptr ? new NullCreatureAI(creature) : ai_factory->Create(creature)); } MovementGenerator* selectMovementGenerator(Creature *creature) { MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance()); - MANGOS_ASSERT(creature->GetCreatureInfo() != NULL); + MANGOS_ASSERT(creature->GetCreatureInfo() != nullptr); MovementGeneratorType type = creature->GetOwnerGuid().IsPlayer() ? FOLLOW_MOTION_TYPE : creature->GetDefaultMovementType(); if (CreatureGroup* group = creature->GetCreatureGroup()) if (group->IsFormation() && group->GetLeaderGuid() != creature->GetObjectGuid()) type = PATROL_MOTION_TYPE; MovementGeneratorCreator const * mv_factory = mv_registry.GetRegistryItem(type); - return (mv_factory == NULL ? NULL : mv_factory->Create(creature)); + return (mv_factory == nullptr ? nullptr : mv_factory->Create(creature)); } } diff --git a/src/game/AI/GenericSpellAI.cpp b/src/game/AI/GenericSpellAI.cpp index 5e563955e..f157b8b8a 100644 --- a/src/game/AI/GenericSpellAI.cpp +++ b/src/game/AI/GenericSpellAI.cpp @@ -186,7 +186,7 @@ struct MANGOS_DLL_DECL GenericSpellMob : public ScriptedAI #endif if (it->timer < uiDiff) { - Unit* target = NULL; + Unit* target = nullptr; switch (it->target) { case GENERIC_TARGET_SELF: diff --git a/src/game/AI/PetAI.cpp b/src/game/AI/PetAI.cpp index 154016341..cb6a0c30f 100644 --- a/src/game/AI/PetAI.cpp +++ b/src/game/AI/PetAI.cpp @@ -103,11 +103,11 @@ void PetAI::UpdateAI(const uint32 diff) m_updateAlliesTimer -= diff; // First checking if we have some taunt on us - Unit* tauntTarget = NULL; + Unit* tauntTarget = nullptr; const Unit::AuraList& tauntAuras = m_creature->GetAurasByType(SPELL_AURA_MOD_TAUNT); if (!tauntAuras.empty() && !playerControlled) { - Unit* caster = NULL; + Unit* caster = nullptr; // Auras are pushed_back, last caster will be on the end Unit::AuraList::const_iterator aura = tauntAuras.end(); @@ -344,7 +344,7 @@ void PetAI::UpdateAI(const uint32 diff) void PetAI::UpdateAllies() { Unit* owner = m_creature->GetCharmerOrOwner(); - Group *group = NULL; + Group *group = nullptr; m_updateAlliesTimer = 10 * IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance @@ -365,7 +365,7 @@ void PetAI::UpdateAllies() m_AllySet.insert(m_creature->GetObjectGuid()); if (group) //add group { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* target = itr->getSource(); if (!target || !group->SameSubGroup((Player*)owner, target)) @@ -451,7 +451,7 @@ void PetAI::OwnerAttacked(Unit* target) // Called when owner attacks something. Allows defensive pets to know // that they need to assist - // Target might be NULL if called from spell with invalid cast targets + // Target might be nullptr if called from spell with invalid cast targets if (!target) return; @@ -483,16 +483,16 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const // Pet desactive (monture) if (m_creature->IsPet() && !((Pet*)m_creature)->IsEnabled()) - return NULL; + return nullptr; // Passive pets don't do next target selection if (m_creature->HasReactState(REACT_PASSIVE)) - return NULL; + return nullptr; // Not sure why we wouldn't have an owner but just in case... Unit* owner = m_creature->GetCharmerOrOwner(); if (!owner) - return NULL; + return nullptr; // Check owner attackers if (Unit* ownerAttacker = owner->getAttackerForHelper()) @@ -515,7 +515,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const } // Default - no valid targets - return NULL; + return nullptr; } void PetAI::HandleReturnMovement() @@ -670,7 +670,7 @@ bool PetAI::CanAttack(Unit* target) { // Check if our owner selected this target and clicked "attack" Unit* owner = m_creature->GetCharmerOrOwner(); - Unit* ownerTarget = NULL; + Unit* ownerTarget = nullptr; if (owner) { if (Player* playerOwner = owner->ToPlayer()) diff --git a/src/game/AI/PetEventAI.cpp b/src/game/AI/PetEventAI.cpp index 772bd8ff2..c69fad548 100644 --- a/src/game/AI/PetEventAI.cpp +++ b/src/game/AI/PetEventAI.cpp @@ -228,7 +228,7 @@ void PetEventAI::OwnerAttacked(Unit* pTarget) // Called when owner attacks something. Allows defensive pets to know // that they need to assist - // Target might be NULL if called from spell with invalid cast targets + // Target might be nullptr if called from spell with invalid cast targets if (!pTarget) return; diff --git a/src/game/AI/PlayerAI.cpp b/src/game/AI/PlayerAI.cpp index cdc603281..8f1d8d0ea 100644 --- a/src/game/AI/PlayerAI.cpp +++ b/src/game/AI/PlayerAI.cpp @@ -40,7 +40,7 @@ static std::vector hunterSkipSpells = void PlayerAI::Remove() { - me->setAI(NULL); + me->setAI(nullptr); delete this; } @@ -284,7 +284,7 @@ void PlayerControlledAI::UpdateAI(const uint32 uiDiff) return; } - Unit* victim = NULL; + Unit* victim = nullptr; CharmInfo* charmInfo = me->GetCharmInfo(); Unit* controller = FindController(); diff --git a/src/game/AI/PlayerAI.h b/src/game/AI/PlayerAI.h index fa741f407..dab56c471 100644 --- a/src/game/AI/PlayerAI.h +++ b/src/game/AI/PlayerAI.h @@ -58,7 +58,7 @@ class MANGOS_DLL_SPEC PlayerAI class MANGOS_DLL_SPEC PlayerControlledAI: public PlayerAI { public: - explicit PlayerControlledAI(Player* pPlayer, Unit* caster = NULL); + explicit PlayerControlledAI(Player* pPlayer, Unit* caster = nullptr); virtual ~PlayerControlledAI(); diff --git a/src/game/AI/ScriptedAI.h b/src/game/AI/ScriptedAI.h index b6070bb86..0b6f74b66 100644 --- a/src/game/AI/ScriptedAI.h +++ b/src/game/AI/ScriptedAI.h @@ -32,7 +32,7 @@ struct MANGOS_DLL_DECL ScriptedAI : CreatureAI // Called at each attack of m_creature by any victim void AttackStart(Unit*) override; - // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) + // Called for reaction at enter to combat if not in combat yet (enemy can be nullptr) void EnterCombat(Unit*) override; // Called at stoping attack by any attacker diff --git a/src/game/AI/ScriptedInstance.cpp b/src/game/AI/ScriptedInstance.cpp index c0b09b163..6232c2a21 100644 --- a/src/game/AI/ScriptedInstance.cpp +++ b/src/game/AI/ScriptedInstance.cpp @@ -139,7 +139,7 @@ Player* ScriptedInstance::GetPlayerInMap(bool bOnlyAlive /*=false*/, bool bCanBe return nullptr; } -/// Returns a pointer to a loaded GameObject that was stored in m_mGoEntryGuidStore. Can return NULL +/// Returns a pointer to a loaded GameObject that was stored in m_mGoEntryGuidStore. Can return nullptr GameObject* ScriptedInstance::GetSingleGameObjectFromStorage(uint32 uiEntry) { EntryGuidMap::iterator find = m_mGoEntryGuidStore.find(uiEntry); @@ -152,7 +152,7 @@ GameObject* ScriptedInstance::GetSingleGameObjectFromStorage(uint32 uiEntry) return nullptr; } -/// Returns a pointer to a loaded Creature that was stored in m_mGoEntryGuidStore. Can return NULL +/// Returns a pointer to a loaded Creature that was stored in m_mGoEntryGuidStore. Can return nullptr Creature* ScriptedInstance::GetSingleCreatureFromStorage(uint32 uiEntry, bool bSkipDebugLog /*=false*/) { EntryGuidMap::iterator find = m_mNpcEntryGuidStore.find(uiEntry); diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index d8859df8a..016fd165f 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -414,7 +414,7 @@ void AccountMgr::LoadAccountBanList(bool silent) bool AccountMgr::IsIPBanned(std::string const& ip) const { std::map::const_iterator it = _ipBanned.find(ip); - if (it == _ipBanned.end() || it->second < time(NULL)) + if (it == _ipBanned.end() || it->second < time(nullptr)) return false; return true; } @@ -422,7 +422,7 @@ bool AccountMgr::IsIPBanned(std::string const& ip) const bool AccountMgr::IsAccountBanned(uint32 acc) const { std::map::const_iterator it = _accountBanned.find(acc); - if (it == _accountBanned.end() || it->second < time(NULL)) + if (it == _accountBanned.end() || it->second < time(nullptr)) return false; return true; } @@ -438,7 +438,7 @@ bool AccountMgr::CheckInstanceCount(uint32 accountId, uint32 instanceId, uint32 return true; if (enterTimes.size() < maxCount) return true; - time_t now = time(NULL); + time_t now = time(nullptr); for (it2 = enterTimes.begin(); it2 != enterTimes.end(); ++it2) if (it2->second + 3600 < now) { @@ -500,7 +500,7 @@ uint32 AccountPersistentData::GetWhisperScore(MasterPlayer* from, MasterPlayer* void AccountPersistentData::JustMailed(uint32 toAccount) { - _mailsSent[toAccount] = time(NULL); + _mailsSent[toAccount] = time(nullptr); } bool AccountPersistentData::CanMail(uint32 targetAccount) @@ -510,7 +510,7 @@ bool AccountPersistentData::CanMail(uint32 targetAccount) return true; uint32 totalScore = 0; - time_t lastNonExpired = time(NULL) - sWorld.getConfig(CONFIG_UINT32_MAILSPAM_EXPIRE_SECS); + time_t lastNonExpired = time(nullptr) - sWorld.getConfig(CONFIG_UINT32_MAILSPAM_EXPIRE_SECS); for (auto it = _mailsSent.begin(); it != _mailsSent.end(); ++it) if (it->second >= lastNonExpired) totalScore++; diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index c2a27632f..7a4a11c1f 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -49,7 +49,7 @@ class AccountPersistentData public: struct WhisperData { - WhisperData() : first_whisp(time(NULL)), score(0), whispers_count(0) {} + WhisperData() : first_whisp(time(nullptr)), score(0), whispers_count(0) {} time_t first_whisp; uint32 score; uint32 whispers_count; diff --git a/src/game/AdvancedPlayerBotAI.cpp b/src/game/AdvancedPlayerBotAI.cpp index f1a620a97..8abf25046 100644 --- a/src/game/AdvancedPlayerBotAI.cpp +++ b/src/game/AdvancedPlayerBotAI.cpp @@ -304,7 +304,7 @@ void AdvancedPlayerBotAI::MageAI(const uint32 delta) float range = me->isInCombat() ? 30.0f : frand(15, 30); Unit* target = me->SelectNearestTarget(range); if (target && !me->IsWithinLOSInMap(target)) - target = NULL; + target = nullptr; // OOM ? if (me->GetPower(POWER_MANA) < 40 && target && me->isInCombat()) { diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 11b46d844..2691bc259 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -453,7 +453,7 @@ void AuctionHouseMgr::LoadAuctions() auction->bid = fields[8].GetUInt32(); auction->startbid = fields[9].GetUInt32(); auction->deposit = fields[10].GetUInt32(); - auction->auctionHouseEntry = NULL; // init later + auction->auctionHouseEntry = nullptr; // init later auction->ownerAccount = sObjectMgr.GetPlayerAccountIdByGUID(auction->owner); @@ -861,7 +861,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const data << uint32(startbid); // Auction->startbid (not sure if useful) data << uint32(bid ? GetAuctionOutBid() : 0); // minimal outbid data << uint32(buyout); // auction->buyout - data << uint32((expireTime - time(NULL))*IN_MILLISECONDS); // time left + data << uint32((expireTime - time(nullptr))*IN_MILLISECONDS); // time left data << ObjectGuid(HIGHGUID_PLAYER, bidder); // auction->bidder current data << uint32(bid); // current bid return true; diff --git a/src/game/AuctionHouse/AuctionHouseMgr.h b/src/game/AuctionHouse/AuctionHouseMgr.h index 3bd593456..166be046a 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/game/AuctionHouse/AuctionHouseMgr.h @@ -128,7 +128,7 @@ class AuctionHouseObject AuctionEntry* GetAuction(uint32 id) const { AuctionEntryMap::const_iterator itr = AuctionsMap.find( id ); - return itr != AuctionsMap.end() ? itr->second : NULL; + return itr != AuctionsMap.end() ? itr->second : nullptr; } bool RemoveAuction(AuctionEntry* entry); @@ -167,7 +167,7 @@ class AuctionHouseMgr { return itr->second; } - return NULL; + return nullptr; } //auction messages diff --git a/src/game/AutoTesting/AutoTestingMgr.cpp b/src/game/AutoTesting/AutoTestingMgr.cpp index afb13178c..a50ed60fd 100644 --- a/src/game/AutoTesting/AutoTestingMgr.cpp +++ b/src/game/AutoTesting/AutoTestingMgr.cpp @@ -27,7 +27,7 @@ void SingleTest::Reset() // only maps created for the testing are deleted if (_map->GetInstanceId() > RESERVED_INSTANCES_LAST) sMapMgr.DeleteTestMap(_map); - _map = NULL; + _map = nullptr; } } @@ -86,17 +86,17 @@ WorldObject* SingleTest::GetTestObject(uint32 num, uint32 options) { Map* map = GetMap(); if (!map) - return NULL; + return nullptr; TestObjectGuids::const_iterator it = _testObjects.find(num); if (it == _testObjects.end()) - return NULL; + return nullptr; _initializedObjects.insert(num); return map->GetWorldObject(it->second); } Unit* SingleTest::GetTestUnit(uint32 num, uint32 options) { - Unit* unit = NULL; + Unit* unit = nullptr; bool initialized = _initializedObjects.find(num) != _initializedObjects.end(); if (WorldObject* obj = GetTestObject(num, options)) unit = obj->ToUnit(); @@ -114,7 +114,7 @@ Unit* SingleTest::GetTestUnit(uint32 num, uint32 options) Player* SingleTest::GetTestPlayer(uint32 num, uint32 options) { - Player* p = NULL; + Player* p = nullptr; bool initialized = _initializedObjects.find(num) != _initializedObjects.end(); if (WorldObject* obj = GetTestUnit(num, options)) p = obj->ToPlayer(); @@ -138,7 +138,7 @@ Player* SingleTest::GetTestPlayer(uint32 num, uint32 options) Creature* SingleTest::GetTestCreature(uint32 num, uint32 options) { - Creature* creature = NULL; + Creature* creature = nullptr; if (WorldObject* obj = GetTestUnit(num, options)) creature = obj->ToCreature(); if (!creature) @@ -150,7 +150,7 @@ class TestPlayerBotAI : public PlayerCreatorAI { public: TestPlayerBotAI(SingleTest* test, uint32 num, uint8 _race_, uint8 _class_, uint32 mapId, uint32 instanceId, float x, float y, float z, float o) : - PlayerCreatorAI(NULL, _race_, _class_, mapId, instanceId, x, y, z, o), _test(test), _num(num) + PlayerCreatorAI(nullptr, _race_, _class_, mapId, instanceId, x, y, z, o), _test(test), _num(num) { } void OnPlayerLogin() @@ -172,7 +172,7 @@ void SingleTest::SpawnPlayer(uint32 id, uint8 _class, uint32 _race, float x, flo Creature* SingleTest::SpawnCreature(uint32 num, uint32 entry, float x, float y, float z, float o) { ComputeCoords(x, y, z); - Creature* c = NULL; + Creature* c = nullptr; if (c = GetMap()->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN, 0)) { c->SetActiveObjectState(true); diff --git a/src/game/AutoTesting/Tests/ControlSpells.cpp b/src/game/AutoTesting/Tests/ControlSpells.cpp index 35be1db09..e525e241c 100644 --- a/src/game/AutoTesting/Tests/ControlSpells.cpp +++ b/src/game/AutoTesting/Tests/ControlSpells.cpp @@ -20,8 +20,8 @@ public: } void Test() override { - Player* warlock = GetTestStep() ? GetTestPlayer(0, TESTPLAYER_MAXLEVEL) : NULL; - Creature* necromancer = GetTestStep() > 1 ? GetTestCreature(1) : NULL; + Player* warlock = GetTestStep() ? GetTestPlayer(0, TESTPLAYER_MAXLEVEL) : nullptr; + Creature* necromancer = GetTestStep() > 1 ? GetTestCreature(1) : nullptr; switch (GetTestStep()) { case 0: @@ -63,9 +63,9 @@ public: } void Test() override { - Player* warlock = GetTestStep() ? GetTestPlayer(0, TESTPLAYER_MAXLEVEL) : NULL; - Player* hunt = GetTestStep() ? GetTestPlayer(1, TESTPLAYER_MAXLEVEL) : NULL; - Creature* necromancer = GetTestStep() > 1 ? GetTestCreature(2) : NULL; + Player* warlock = GetTestStep() ? GetTestPlayer(0, TESTPLAYER_MAXLEVEL) : nullptr; + Player* hunt = GetTestStep() ? GetTestPlayer(1, TESTPLAYER_MAXLEVEL) : nullptr; + Creature* necromancer = GetTestStep() > 1 ? GetTestCreature(2) : nullptr; switch (GetTestStep()) { case 0: diff --git a/src/game/AutoTesting/Tests/Warlock.cpp b/src/game/AutoTesting/Tests/Warlock.cpp index be07b4e2d..14c0bfddd 100644 --- a/src/game/AutoTesting/Tests/Warlock.cpp +++ b/src/game/AutoTesting/Tests/Warlock.cpp @@ -294,7 +294,7 @@ public: { int nbCreaWithDebuff = 0; int nbCreaWithMovement = 0; - Creature* murloc = NULL; + Creature* murloc = nullptr; for (int i = 1; i < 13; i++) { murloc = GetTestCreature(i); diff --git a/src/game/Battlegrounds/BattleGround.cpp b/src/game/Battlegrounds/BattleGround.cpp index ae919309d..1b938372f 100644 --- a/src/game/Battlegrounds/BattleGround.cpp +++ b/src/game/Battlegrounds/BattleGround.cpp @@ -1601,7 +1601,7 @@ void BattleGround::HandleKillPlayer(Player *player, Player *killer) // Nostalrius: // 2 appels pour un pretre avec l'esprit de redemption. // - Avant le declenchement du talent (Aura 27827) - // - Apres la fin du buff - a ce moment la killer=NULL + // - Apres la fin du buff - a ce moment la killer=nullptr // add +1 kills to group and +1 killing_blows to killer if (killer && player->getFaction() != killer->getFaction()) diff --git a/src/game/Battlegrounds/BattleGround.h b/src/game/Battlegrounds/BattleGround.h index e8846719d..830701353 100644 --- a/src/game/Battlegrounds/BattleGround.h +++ b/src/game/Battlegrounds/BattleGround.h @@ -131,7 +131,7 @@ struct BattleGroundPlayer struct BattleGroundObjectInfo { - BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {} + BattleGroundObjectInfo() : object(nullptr), timer(0), spellid(0) {} GameObject *object; int32 timer; @@ -389,7 +389,7 @@ class BattleGround /* Packet Transfer */ // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {} - void SendPacketToTeam(Team team, WorldPacket *packet, Player *sender = NULL, bool self = true); + void SendPacketToTeam(Team team, WorldPacket *packet, Player *sender = nullptr, bool self = true); void SendPacketToAll(WorldPacket *packet); template @@ -410,7 +410,7 @@ class BattleGround virtual void EndBattleGround(Team winner); void BlockMovement(Player *plr); - void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); + void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = nullptr); void SendYellToAll(int32 entry, uint32 language, ObjectGuid guid); void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... ); diff --git a/src/game/Battlegrounds/BattleGroundMgr.cpp b/src/game/Battlegrounds/BattleGroundMgr.cpp index a5d7fd0f1..ca844d8da 100644 --- a/src/game/Battlegrounds/BattleGroundMgr.cpp +++ b/src/game/Battlegrounds/BattleGroundMgr.cpp @@ -140,7 +140,7 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de /*** BATTLEGROUND QUEUES ***/ /*********************************************************/ -// add group or player (grp == NULL) to bg queue with the given leader and bg specifications +// add group or player (grp == nullptr) to bg queue with the given leader and bg specifications GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, BattleGroundBracketId bracketId, bool isPremade, std::vector* excludedMembers) { // create new ginfo @@ -169,7 +169,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG if (grp) { const uint32 group_limit = sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_GROUP_LIMIT); - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *member = itr->getSource(); if (!member) @@ -297,7 +297,7 @@ void BattleGroundQueue::LogQueueInscription(Player *plr, BattleGroundTypeId BgTy { std::string sPName = plr->GetName(); std::string last_ip = ""; - time_t queuing_time = time(NULL); + time_t queuing_time = time(nullptr); if (WorldSession* session = plr->GetSession()) last_ip = session->GetRemoteAddress(); @@ -887,7 +887,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId); //battleground can be deleted already when we are removing queue info - //bg pointer can be NULL! so use it carefully! + //bg pointer can be nullptr! so use it carefully! uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId); if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground @@ -1119,14 +1119,14 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id BattleGround* bg = GetBattleGroundTemplate(bgTypeId); if (!bg) - return NULL; + return nullptr; for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr) { if (itr->second->GetClientInstanceID() == instanceId) return itr->second; } - return NULL; + return nullptr; } BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId) @@ -1141,16 +1141,16 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT if (itr != m_BattleGrounds[i].end()) return itr->second; } - return NULL; + return nullptr; } itr = m_BattleGrounds[bgTypeId].find(InstanceID); - return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL); + return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : nullptr); } BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId) { //map is sorted and we can be sure that lowest instance id has only BG template - return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second; + return m_BattleGrounds[bgTypeId].empty() ? nullptr : m_BattleGrounds[bgTypeId].begin()->second; } uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id) @@ -1181,10 +1181,10 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI if (!bg_template) { sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId); - return NULL; + return nullptr; } - BattleGround *bg = NULL; + BattleGround *bg = nullptr; // create a copy of the BG template switch (bgTypeId) { @@ -1218,7 +1218,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, uint32 AllianceWinSpell, uint32 AllianceLoseSpell, uint32 HordeWinSpell, uint32 HordeLoseSpell, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) { // Create the BG - BattleGround *bg = NULL; + BattleGround *bg = nullptr; switch (bgTypeId) { case BATTLEGROUND_AV: @@ -1625,7 +1625,7 @@ void BattleGroundMgr::LoadBattleEventIndexes() uint8 desc_event2 = fields[8].GetUInt8(); const char *description = fields[9].GetString(); - // checking for NULL - through right outer join this will mean following: + // checking for nullptr - through right outer join this will mean following: if (fields[5].GetUInt32() != dbTableGuidLow) { sLog.outErrorDb("BattleGroundEvent: %s with nonexistent guid %u for event: map:%u, event1:%u, event2:%u (\"%s\")", @@ -1633,7 +1633,7 @@ void BattleGroundMgr::LoadBattleEventIndexes() continue; } - // checking for NULL - through full outer join this can mean 2 things: + // checking for nullptr - through full outer join this can mean 2 things: if (desc_map != map) { // there is an event missing diff --git a/src/game/Camera.h b/src/game/Camera.h index a8ac0dbf8..dca67209a 100644 --- a/src/game/Camera.h +++ b/src/game/Camera.h @@ -120,7 +120,7 @@ public: void Event_RemovedFromWorld() { - m_grid = NULL; + m_grid = nullptr; CameraCall(&Camera::Event_RemovedFromWorld); } diff --git a/src/game/Chat/AsyncCommandHandlers.cpp b/src/game/Chat/AsyncCommandHandlers.cpp index 9acaee4bf..c47e1b687 100644 --- a/src/game/Chat/AsyncCommandHandlers.cpp +++ b/src/game/Chat/AsyncCommandHandlers.cpp @@ -451,7 +451,7 @@ void AccountSearchHandler::ShowAccountListHelper(QueryResult* result, ChatHandle uint32 account = fields[0].GetUInt32(); WorldSession* session = sWorld.FindSession(account); - Player* player = session ? session->GetPlayer() : NULL; + Player* player = session ? session->GetPlayer() : nullptr; char const* char_name = player ? player->GetName() : " - "; std::string lastIp = chatHandler.GetMangosString(LANG_ERROR); diff --git a/src/game/Chat/ChannelMgr.cpp b/src/game/Chat/ChannelMgr.cpp index 46649c4a1..907836dcb 100644 --- a/src/game/Chat/ChannelMgr.cpp +++ b/src/game/Chat/ChannelMgr.cpp @@ -38,7 +38,7 @@ ChannelMgr* channelMgr(Team team) if (team == HORDE) return &MaNGOS::Singleton::Instance(); - return NULL; + return nullptr; } ChannelMgr::~ChannelMgr() @@ -59,7 +59,7 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, bool allowAreaDependantCha { ChatChannelsEntry const* ch = GetChannelEntryFor(name); if (!allowAreaDependantChans && ch && ch->flags & Channel::CHANNEL_DBC_FLAG_ZONE_DEP) - return NULL; + return nullptr; Channel *nchan = new Channel(name); channels[wname] = nchan; return nchan; @@ -85,7 +85,7 @@ Channel *ChannelMgr::GetChannel(std::string name, PlayerPointer p, bool pkt) p->GetSession()->SendPacket(&data); } - return NULL; + return nullptr; } else return i->second; diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 66f55df1b..e23706f70 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -1130,7 +1130,7 @@ ChatCommand * ChatHandler::getCommandTable() load_command_table = false; // check hardcoded part integrity - //CheckIntegrity(commandTable, NULL); + //CheckIntegrity(commandTable, nullptr); FillFullCommandsName(commandTable, ""); QueryResult *result = WorldDatabase.Query("SELECT name,security,help,flags FROM command"); @@ -1231,7 +1231,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac else if (target_account) target_sec = sAccountMgr.GetSecurity(target_account); else - return true; // caller must report error for (target==NULL && target_account==0) + return true; // caller must report error for (target==nullptr && target_account==0) if (GetAccessLevel() < target_sec || (strong && GetAccessLevel() <= target_sec)) { @@ -1405,14 +1405,14 @@ void ChatHandler::CheckIntegrity(ChatCommand *table, ChatCommand *parentCommand) * * @param text Command line string that will parsed for (sub)command search * - * @return Pointer to found command structure or NULL if appropriate command not found + * @return Pointer to found command structure or nullptr if appropriate command not found */ ChatCommand const* ChatHandler::FindCommand(char const* text) { ChatCommand* command = nullptr; char const* textPtr = text; - return FindCommand(getCommandTable(), textPtr, command) == CHAT_COMMAND_OK ? command : NULL; + return FindCommand(getCommandTable(), textPtr, command) == CHAT_COMMAND_OK ? command : nullptr; } /** @@ -1432,20 +1432,20 @@ ChatCommand const* ChatHandler::FindCommand(char const* text) * * CHAT_COMMAND_OK - Command found! * text point to non parsed tail with possible command specific data, command store found command pointer, - * parentCommand have parent of found command or NULL if command found in table array directly + * parentCommand have parent of found command or nullptr if command found in table array directly * cmdNamePtr store found command name in original form from command line * CHAT_COMMAND_UNKNOWN - Command not found in table directly * text only skip possible whitespaces, - * command is NULL - * parentCommand is NULL + * command is nullptr + * parentCommand is nullptr * cmdNamePtr store command name that not found as it extracted from command line * CHAT_COMMAND_UNKNOWN_SUBCOMMAND - Subcommand not found in some deed subcomand lists * text point to non parsed tail including not found command name in command line, * command store last found parent command if any - * parentCommand have parent of command in command arg or NULL + * parentCommand have parent of command in command arg or nullptr * cmdNamePtr store command name that not found as it extracted from command line */ -ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const* &text, ChatCommand*& command, ChatCommand** parentCommand /*= NULL*/, std::string* cmdNamePtr /*= NULL*/, bool allAvailable /*= false*/, bool exactlyName /*= false*/) +ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const* &text, ChatCommand*& command, ChatCommand** parentCommand /*= nullptr*/, std::string* cmdNamePtr /*= nullptr*/, bool allAvailable /*= false*/, bool exactlyName /*= false*/) { std::string cmd = ""; @@ -1487,7 +1487,7 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const* if (parentCommand) *parentCommand = parentSubcommand ? parentSubcommand : &table[i]; - // Name == "" is special case: restore original command text for next level "" (where parentSubcommand==NULL) + // Name == "" is special case: restore original command text for next level "" (where parentSubcommand==nullptr) if (strlen(command->Name) == 0 && !parentSubcommand) text = oldchildtext; @@ -1506,7 +1506,7 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const* case CHAT_COMMAND_UNKNOWN_SUBCOMMAND: default: { - // some deep subcommand not found, if this second level subcommand then parentCommand can be NULL, use known value for it + // some deep subcommand not found, if this second level subcommand then parentCommand can be nullptr, use known value for it if (parentCommand) *parentCommand = parentSubcommand ? parentSubcommand : &table[i]; return res; @@ -1600,7 +1600,7 @@ void ChatHandler::ExecuteCommand(const char* text) Player* p = m_session->GetPlayer(); ObjectGuid sel_guid = p->GetSelectionGuid(); sLog.outCommand(GetAccountId(), "Command: %s [Player: %s (Group Leader \"%s\", Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s]", - realCommandFull.c_str(), p->GetName(), p->GetGroup() ? p->GetGroup()->GetLeaderGuid().GetString().c_str() : "NULL", GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), + realCommandFull.c_str(), p->GetName(), p->GetGroup() ? p->GetGroup()->GetLeaderGuid().GetString().c_str() : "nullptr", GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), sel_guid.GetString().c_str()); } else // 0 account -> console @@ -1803,7 +1803,7 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) break; case CHAT_COMMAND_UNKNOWN: // not show command list at error in first level command find fail - childCommands = table != getCommandTable() || strlen(oldCmd) == 0 ? table : NULL; + childCommands = table != getCommandTable() || strlen(oldCmd) == 0 ? table : nullptr; command = nullptr; break; } @@ -2304,7 +2304,7 @@ Pet* ChatHandler::GetSelectedPet() const * Function skip all whitespaces in args string * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) - * allowed NULL string pointer stored in *args + * allowed nullptr string pointer stored in *args */ void ChatHandler::SkipWhiteSpaces(char** args) { @@ -2470,9 +2470,9 @@ bool ChatHandler::ExtractOptFloat(char** args, float& val, float defVal) * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * @param lit optional explicit literal requirement. function fail if literal is not starting substring of lit. * Note: function in same way fail if no any literal or literal not fit in this case. Need additional check for select specific fail case - * @return name/number-like string without whitespaces, or NULL if args empty or not appropriate content. + * @return name/number-like string without whitespaces, or nullptr if args empty or not appropriate content. */ -char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/) +char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= nullptr*/) { if (!*args || !**args) return nullptr; @@ -2530,7 +2530,7 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/) char* tail = strtok(nullptr, ""); - *args = tail ? tail : (char*)""; // *args don't must be NULL + *args = tail ? tail : (char*)""; // *args don't must be nullptr SkipWhiteSpaces(args); @@ -2542,7 +2542,7 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/) * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * @param asis control save quote string wrappers - * @return quote-like string, or NULL if args empty or not appropriate content. + * @return quote-like string, or nullptr if args empty or not appropriate content. */ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/) { @@ -2591,7 +2591,7 @@ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/) * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * @param asis control save quote string wrappers - * @return quote/literal string, or NULL if args empty or not appropriate content. + * @return quote/literal string, or nullptr if args empty or not appropriate content. */ char* ChatHandler::ExtractQuotedOrLiteralArg(char** args, bool asis /*= false*/) { @@ -2629,19 +2629,19 @@ bool ChatHandler::ExtractOnOff(char** args, bool& value) * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * - * @param linkTypes optional NULL-terminated array of link types, shift-link must fit one from link type from array if provided or extraction fail + * @param linkTypes optional nullptr-terminated array of link types, shift-link must fit one from link type from array if provided or extraction fail * - * @param found_idx if not NULL then at return index in linkTypes that fit shift-link type, if extraction fail then non modified + * @param found_idx if not nullptr then at return index in linkTypes that fit shift-link type, if extraction fail then non modified * - * @param keyPair if not NULL then pointer to 2-elements array for return start and end pointer for found key + * @param keyPair if not nullptr then pointer to 2-elements array for return start and end pointer for found key * if extraction fail then non modified * * @param somethingPair then pointer to 2-elements array for return start and end pointer if found. - * if not NULL then shift-link must have data field, if extraction fail then non modified + * if not nullptr then shift-link must have data field, if extraction fail then non modified * - * @return shift-link-like string, or NULL if args empty or not appropriate content. + * @return shift-link-like string, or nullptr if args empty or not appropriate content. */ -char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*= NULL*/, int* foundIdx /*= NULL*/, char** keyPair /*= NULL*/, char** somethingPair /*= NULL*/) +char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*= nullptr*/, int* foundIdx /*= nullptr*/, char** keyPair /*= nullptr*/, char** somethingPair /*= nullptr*/) { if (!*args || !**args) return nullptr; @@ -2697,7 +2697,7 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*= } // is search fail? - if (!linkTypes[linktype_idx]) // NULL terminator in last element + if (!linkTypes[linktype_idx]) // nullptr terminator in last element return nullptr; tail += strlen(linkTypes[linktype_idx]); // skip linktype string @@ -2818,7 +2818,7 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*= * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * @param asis control save quote string wrappers - * @return extracted arg string, or NULL if args empty or not appropriate content. + * @return extracted arg string, or nullptr if args empty or not appropriate content. */ char* ChatHandler::ExtractArg(char** args, bool asis /*= false*/) { @@ -2837,7 +2837,7 @@ char* ChatHandler::ExtractArg(char** args, bool asis /*= false*/) * * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * if args have only single arg then args still pointing to this arg (unmodified pointer) - * @return extracted string, or NULL if args empty or not appropriate content or have single arg totally. + * @return extracted string, or nullptr if args empty or not appropriate content or have single arg totally. */ char* ChatHandler::ExtractOptNotLastArg(char** args) { @@ -2848,7 +2848,7 @@ char* ChatHandler::ExtractOptNotLastArg(char** args) return arg; // optional name not found - *args = arg ? arg : (char*)""; // *args don't must be NULL + *args = arg ? arg : (char*)""; // *args don't must be nullptr return nullptr; } @@ -2862,12 +2862,12 @@ char* ChatHandler::ExtractOptNotLastArg(char** args) * * @param linkType shift-link must fit by link type to this arg value or extraction fail * - * @param something1 if not NULL then shift-link must have data field and it returned into this arg + * @param something1 if not nullptr then shift-link must have data field and it returned into this arg * if extraction fail then non modified * - * @return extracted key, or NULL if args empty or not appropriate content or not fit to linkType. + * @return extracted key, or nullptr if args empty or not appropriate content or not fit to linkType. */ -char* ChatHandler::ExtractKeyFromLink(char** text, char const* linkType, char** something1 /*= NULL*/) +char* ChatHandler::ExtractKeyFromLink(char** text, char const* linkType, char** something1 /*= nullptr*/) { char const* linkTypes[2]; linkTypes[0] = linkType; @@ -2885,17 +2885,17 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* linkType, char** * @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces) * if args have sift link with linkType != LINKTYPE then args still pointing to this arg (unmodified pointer) * - * @param linkTypes NULL-terminated array of link types, shift-link must fit one from link type from array or extraction fail + * @param linkTypes nullptr-terminated array of link types, shift-link must fit one from link type from array or extraction fail * - * @param found_idx if not NULL then at return index in linkTypes that fit shift-link type, for non-link case return -1 + * @param found_idx if not nullptr then at return index in linkTypes that fit shift-link type, for non-link case return -1 * if extraction fail then non modified * - * @param something1 if not NULL then shift-link must have data field and it returned into this arg + * @param something1 if not nullptr then shift-link must have data field and it returned into this arg * if extraction fail then non modified * - * @return extracted key, or NULL if args empty or not appropriate content or not fit to linkType. + * @return extracted key, or nullptr if args empty or not appropriate content or not fit to linkType. */ -char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes, int* found_idx, char** something1 /*= NULL*/) +char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes, int* found_idx, char** something1 /*= nullptr*/) { // skip empty if (!*text || !**text) @@ -2914,7 +2914,7 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes, char* keyPair[2]; char* somethingPair[2]; - arg = ExtractLinkArg(text, linkTypes, found_idx, keyPair, something1 ? somethingPair : NULL); + arg = ExtractLinkArg(text, linkTypes, found_idx, keyPair, something1 ? somethingPair : nullptr); if (!arg) return nullptr; @@ -3249,7 +3249,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (ObjectMgr::GetCreatureTemplate(id)) { - FindCreatureData worker(id, m_session ? m_session->GetPlayer() : NULL); + FindCreatureData worker(id, m_session ? m_session->GetPlayer() : nullptr); sObjectMgr.DoCreatureData(worker); @@ -3275,7 +3275,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (ObjectMgr::GetGameObjectInfo(id)) { - FindGOData worker(id, m_session ? m_session->GetPlayer() : NULL); + FindGOData worker(id, m_session ? m_session->GetPlayer() : nullptr); sObjectMgr.DoGOData(worker); @@ -3373,7 +3373,7 @@ std::string ChatHandler::ExtractPlayerNameFromLink(char** text) * * @return true if extraction successful */ -bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, ObjectGuid* player_guid /*= NULL*/, std::string* player_name /*= NULL*/, bool use_extended_response) +bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= nullptr*/, ObjectGuid* player_guid /*= nullptr*/, std::string* player_name /*= nullptr*/, bool use_extended_response) { std::string name = ""; if (*args && **args) @@ -3436,7 +3436,7 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O return true; } -uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= NULL*/, Player** targetIfNullArg /*= NULL*/) +uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= nullptr*/, Player** targetIfNullArg /*= nullptr*/) { uint32 account_id = 0; @@ -3448,7 +3448,7 @@ uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= N if (!targetIfNullArg) return 0; - /// only target player different from self allowed (if targetPlayer!=NULL then not console) + /// only target player different from self allowed (if targetPlayer!=nullptr then not console) Player* targetPlayer = GetSelectedPlayer(); if (!targetPlayer) return 0; @@ -3530,7 +3530,7 @@ static RaceMaskName const raceMaskNames[] = {nullptr, 0 } }; -bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** maskName /*=NULL*/) +bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** maskName /*=nullptr*/) { if (ExtractUInt32(text, raceMask)) { diff --git a/src/game/Chat/Chat.h b/src/game/Chat/Chat.h index 4f3974849..efee18d9a 100644 --- a/src/game/Chat/Chat.h +++ b/src/game/Chat/Chat.h @@ -991,7 +991,7 @@ class MANGOS_DLL_SPEC ChatHandler void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: - WorldSession * m_session; // != NULL for chat command call and NULL for CLI command + WorldSession * m_session; // != nullptr for chat command call and nullptr for CLI command // common global flag static bool load_command_table; diff --git a/src/game/Commands/AccountCommands.cpp b/src/game/Commands/AccountCommands.cpp index f57a31ac3..6e1814b69 100644 --- a/src/game/Commands/AccountCommands.cpp +++ b/src/game/Commands/AccountCommands.cpp @@ -56,7 +56,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(char* args) // Let set addon state only for lesser (strong) security level // or to self account if (GetAccountId() && GetAccountId() != account_id && - HasLowerSecurityAccount(NULL, account_id, true)) + HasLowerSecurityAccount(nullptr, account_id, true)) return false; uint32 lev; @@ -74,7 +74,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args) char* accountStr = ExtractOptNotLastArg(&args); std::string targetAccountName; - Player* targetPlayer = NULL; + Player* targetPlayer = nullptr; uint32 targetAccountId = ExtractAccountId(&accountStr, &targetAccountName, &targetPlayer); if (!targetAccountId) return false; @@ -96,7 +96,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args) /// can set security level only for target with less security and to less security that we have /// This is also reject self apply in fact - if (HasLowerSecurityAccount(NULL, targetAccountId, true)) + if (HasLowerSecurityAccount(nullptr, targetAccountId, true)) return false; /// account can't set security to same or grater level, need more power GM or console @@ -137,7 +137,7 @@ bool ChatHandler::HandleAccountSetPasswordCommand(char* args) /// can set password only for target with less security /// This is also reject self apply in fact - if (HasLowerSecurityAccount(NULL, targetAccountId, true)) + if (HasLowerSecurityAccount(nullptr, targetAccountId, true)) return false; if (strcmp(szPassword1, szPassword2)) @@ -185,7 +185,7 @@ bool ChatHandler::HandleAccountSetLockedCommand(char* args) // Let set locked state only for lesser (strong) security level // or to self account if (GetAccountId() && GetAccountId() != account_id && - HasLowerSecurityAccount(NULL, account_id, true)) + HasLowerSecurityAccount(nullptr, account_id, true)) return false; uint32 value; @@ -214,7 +214,7 @@ bool ChatHandler::HandleAccountCharactersCommand(char* args) { ///- Get the command line arguments std::string account_name; - Player* target = NULL; // only for triggering use targeted player account + Player* target = nullptr; // only for triggering use targeted player account uint32 account_id = ExtractAccountId(&args, &account_name, &target); if (!account_id) return false; @@ -283,7 +283,7 @@ bool ChatHandler::HandleAccountDeleteCommand(char* args) /// Commands not recommended call from chat, but support anyway /// can delete only for account with less security /// This is also reject self apply in fact - if (HasLowerSecurityAccount (NULL, account_id, true)) + if (HasLowerSecurityAccount (nullptr, account_id, true)) return false; AccountOpResult result = sAccountMgr.DeleteAccount(account_id); @@ -427,7 +427,7 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args) bool ChatHandler::HandleAddCharacterNoteCommand(char* args) { ObjectGuid playerGuid; - if (!ExtractPlayerTarget(&args, NULL, &playerGuid)) + if (!ExtractPlayerTarget(&args, nullptr, &playerGuid)) { PSendSysMessage(LANG_PLAYER_NOT_FOUND); SetSentErrorMessage(true); @@ -454,7 +454,7 @@ bool ChatHandler::HandleAddCharacterNoteCommand(char* args) bool ChatHandler::HandleWarnCharacterCommand(char* args) { ObjectGuid playerGuid; - if (!ExtractPlayerTarget(&args, NULL, &playerGuid)) + if (!ExtractPlayerTarget(&args, nullptr, &playerGuid)) { PSendSysMessage(LANG_PLAYER_NOT_FOUND); SetSentErrorMessage(true); @@ -744,7 +744,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(char* args) { Player* target; ObjectGuid target_guid; - if (!ExtractPlayerTarget(&args, &target, &target_guid,NULL,true)) + if (!ExtractPlayerTarget(&args, &target, &target_guid,nullptr,true)) return false; uint32 accountid = target ? target->GetSession()->GetAccountId() : sObjectMgr.GetPlayerAccountIdByGUID(target_guid); @@ -778,7 +778,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname) time_t unbandate = time_t(fields[3].GetUInt64()); bool active = false; - if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 || unbandate >= time(NULL))) + if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 || unbandate >= time(nullptr))) active = true; bool permanent = (fields[1].GetUInt64() == (uint64)0); uint32 reqGmLevel = fields[6].GetUInt8(); @@ -1038,7 +1038,7 @@ bool ChatHandler::HandleBanListIPCommand(char* args) bool ChatHandler::HandleAnticheatCommand(char* args) { - Player* player = NULL; + Player* player = nullptr; if (!ExtractPlayerTarget(&args, &player) && m_session) player = m_session->GetPlayer(); if (!player) @@ -1066,7 +1066,7 @@ bool ChatHandler::HandleListAddonsCommand(char* args) bool ChatHandler::HandleClientInfosCommand(char* args) { - Player* player = NULL; + Player* player = nullptr; if (!ExtractPlayerTarget(&args, &player) && m_session) player = m_session->GetPlayer(); if (!player) @@ -1189,7 +1189,7 @@ bool ChatHandler::HandleMuteCommand(char* args) if (HasLowerSecurity(target, target_guid, true)) return false; - time_t mutetime = time(NULL) + notspeaktime * MINUTE; + time_t mutetime = time(nullptr) + notspeaktime * MINUTE; if (target) target->GetSession()->m_muteTime = mutetime; diff --git a/src/game/Commands/CharacterCommands.cpp b/src/game/Commands/CharacterCommands.cpp index f532ea16a..09a24f812 100644 --- a/src/game/Commands/CharacterCommands.cpp +++ b/src/game/Commands/CharacterCommands.cpp @@ -126,7 +126,7 @@ bool ChatHandler::HandleExploreCheatCommand(char* args) int flag = atoi(args); Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -176,7 +176,7 @@ bool ChatHandler::HandleHoverCommand(char* args) bool ChatHandler::HandleLevelUpCommand(char* args) { int32 addlevel = 1; - char* nameStr = NULL; + char* nameStr = nullptr; if (*args) { @@ -228,7 +228,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args) HandleCharacterLevel(target, target_guid, oldlevel, newlevel); - if (!m_session || m_session->GetPlayer() != target) // including chr==NULL + if (!m_session || m_session->GetPlayer() != target) // including chr==nullptr { std::string nameLink = playerLink(target_name); PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); @@ -244,7 +244,7 @@ bool ChatHandler::HandleShowAreaCommand(char* args) return false; Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -275,7 +275,7 @@ bool ChatHandler::HandleHideAreaCommand(char* args) return false; Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -576,7 +576,7 @@ bool ChatHandler::HandleUnLearnCommand(char* args) if (!spell_id) return false; - bool allRanks = ExtractLiteralArg(&args, "all") != NULL; + bool allRanks = ExtractLiteralArg(&args, "all") != nullptr; if (!allRanks && *args) // can be fail also at syntax error return false; @@ -1026,7 +1026,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo return; } - CharacterDatabase.PExecute("UPDATE characters SET name='%s', account='%u', deleteDate=NULL, deleteInfos_Name=NULL, deleteInfos_Account=NULL WHERE deleteDate IS NOT NULL AND guid = %u", + CharacterDatabase.PExecute("UPDATE characters SET name='%s', account='%u', deleteDate=nullptr, deleteInfos_Name=nullptr, deleteInfos_Account=nullptr WHERE deleteDate IS NOT NULL AND guid = %u", delInfo.name.c_str(), delInfo.accountId, delInfo.lowguid); } @@ -1364,7 +1364,7 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args) HandleCharacterLevel(target, target_guid, oldlevel, newlevel); - if (!m_session || m_session->GetPlayer() != target) // including player==NULL + if (!m_session || m_session->GetPlayer() != target) // including player==nullptr { std::string nameLink = playerLink(target_name); PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); @@ -1394,7 +1394,7 @@ bool ChatHandler::HandleCharacterRenameCommand(char* args) else { // check offline security - if (HasLowerSecurity(NULL, target_guid)) + if (HasLowerSecurity(nullptr, target_guid)) return false; std::string oldNameLink = playerLink(target_name); @@ -1599,8 +1599,8 @@ bool ChatHandler::HandleHonorShow(char* /*args*/) LANG_HRD_HIGH_WARLORD, //LANG_GAME_MASTER }; - char const* rank_name = NULL; - char const* hrank_name = NULL; + char const* rank_name = nullptr; + char const* hrank_name = nullptr; uint32 honor_rank = target->GetHonorMgr().GetRank().visualRank; @@ -2668,7 +2668,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args) std::string name; - SkillLineEntry const *targetSkillInfo = NULL; + SkillLineEntry const *targetSkillInfo = nullptr; for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); @@ -2734,7 +2734,7 @@ bool ChatHandler::HandleLearnCommand(char* args) if (!spell || !sSpellMgr.GetSpellEntry(spell)) return false; - bool allRanks = ExtractLiteralArg(&args, "all") != NULL; + bool allRanks = ExtractLiteralArg(&args, "all") != nullptr; if (!allRanks && *args) // can be fail also at syntax error return false; @@ -2774,7 +2774,7 @@ bool ChatHandler::HandleItemMoveCommand(char* args) if (!pParam1) return false; - char* pParam2 = strtok(NULL, " "); + char* pParam2 = strtok(nullptr, " "); if (!pParam2) return false; @@ -3088,7 +3088,7 @@ bool ChatHandler::HandleAddItemSetCommand(char* args) } else { - pl->SendEquipError(msg, NULL, NULL, pProto->ItemId); + pl->SendEquipError(msg, nullptr, nullptr, pProto->ItemId); PSendSysMessage(LANG_ITEM_CANNOT_CREATE, pProto->ItemId, 1); } } @@ -3204,7 +3204,7 @@ bool ChatHandler::HandleListItemCommand(char* args) item_id, uint32(count)); } else - result = NULL; + result = nullptr; if (result) { @@ -3254,7 +3254,7 @@ bool ChatHandler::HandleListItemCommand(char* args) item_id, uint32(count)); } else - result = NULL; + result = nullptr; if (result) { @@ -3953,7 +3953,7 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args) return false; Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -4067,7 +4067,7 @@ bool ChatHandler::HandleModifySpeedCommand(char* args) } Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -4129,7 +4129,7 @@ bool ChatHandler::HandleModifySwimCommand(char* args) } Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -4176,7 +4176,7 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args) } Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -4303,7 +4303,7 @@ bool ChatHandler::HandleModifyRageCommand(char* args) } Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -4478,7 +4478,7 @@ bool ChatHandler::HandleQuestAddCommand(char* args) return false; Player* player; - if (!ExtractPlayerTarget(&args, &player, NULL, NULL)) + if (!ExtractPlayerTarget(&args, &player, nullptr, nullptr)) return false; Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); @@ -4507,7 +4507,7 @@ bool ChatHandler::HandleQuestAddCommand(char* args) // ok, normal (creature/GO starting) quest if (player->CanAddQuest(pQuest, true)) { - player->AddQuest(pQuest, NULL); + player->AddQuest(pQuest, nullptr); if (player->CanCompleteQuest(entry)) player->CompleteQuest(entry); @@ -4526,7 +4526,7 @@ bool ChatHandler::HandleQuestRemoveCommand(char* args) return false; Player* player; - if (!ExtractPlayerTarget(&args, &player, NULL, NULL)) + if (!ExtractPlayerTarget(&args, &player, nullptr, nullptr)) return false; Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); @@ -4673,7 +4673,7 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args) return false; Player* player; - if (!ExtractPlayerTarget(&args, &player, NULL, NULL)) + if (!ExtractPlayerTarget(&args, &player, nullptr, nullptr)) return false; Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); diff --git a/src/game/Commands/CreatureCommands.cpp b/src/game/Commands/CreatureCommands.cpp index 1944dd29d..f12e2bc73 100644 --- a/src/game/Commands/CreatureCommands.cpp +++ b/src/game/Commands/CreatureCommands.cpp @@ -56,7 +56,7 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) uint32 Entry = target->GetEntry(); CreatureInfo const* cInfo = target->GetCreatureInfo(); - time_t curRespawnDelay = target->GetRespawnTimeEx() - time(NULL); + time_t curRespawnDelay = target->GetRespawnTimeEx() - time(nullptr); if (curRespawnDelay < 0) curRespawnDelay = 0; std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay, true); @@ -610,7 +610,7 @@ bool ChatHandler::HandleNpcSummonCommand(char* args) bool ChatHandler::HandleNpcDeleteCommand(char* args) { - Creature* unit = NULL; + Creature* unit = nullptr; if (*args) { @@ -968,12 +968,12 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args) else return false; - bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != NULL; + bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != nullptr; if (!doNotDelete && *args) // need fail if false in result wrong literal return false; // now lowguid is low guid really existing creature - // and pCreature point (maybe) to this creature or NULL + // and pCreature point (maybe) to this creature or nullptr // update movement type if (!doNotDelete) @@ -1240,7 +1240,7 @@ bool ChatHandler::HandleNpcGroupDelCommand(char *args) g->RemoveMember(target->GetObjectGuid()); g->SaveToDb(); - target->SetCreatureGroup(NULL); + target->SetCreatureGroup(nullptr); target->GetMotionMaster()->Initialize(); return true; } @@ -1291,7 +1291,7 @@ inline Creature* Helper_CreateWaypointFor(Creature* wpOwner, WaypointPathOrigin if (!wpCreature->Create(wpOwner->GetMap()->GenerateLocalLowGuid(HIGHGUID_UNIT), pos, waypointInfo, TEAM_NONE, waypointInfo->entry)) { delete wpCreature; - return NULL; + return nullptr; } wpCreature->SetVisibility(VISIBILITY_OFF); @@ -1802,7 +1802,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) } Creature* wpOwner; // Npc that is moving - TemporarySummonWaypoint* wpTarget = NULL; // Define here for wp-info command + TemporarySummonWaypoint* wpTarget = nullptr; // Define here for wp-info command // Show info for the selected waypoint (Step one: get moving npc) if (subCmd == "info") @@ -1839,7 +1839,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) wpOwner = targetCreature; // Get the path - WaypointPath* wpPath = NULL; + WaypointPath* wpPath = nullptr; if (wpOrigin != PATH_NO_PATH) // Might have been provided by param wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin); else @@ -2227,8 +2227,8 @@ bool ChatHandler::HandleEscortAddWpCommand(char *args) SetSentErrorMessage(true); return false; } - QueryResult* pResult = NULL; - Field* pFields = NULL; + QueryResult* pResult = nullptr; + Field* pFields = nullptr; if (waypointId == 0) { pResult = WorldDatabase.PQuery("SELECT MAX(pointid) FROM script_waypoint WHERE entry=%u", creatureEntry); diff --git a/src/game/Commands/DebugCommands.cpp b/src/game/Commands/DebugCommands.cpp index 3d43719c4..b51591ef0 100644 --- a/src/game/Commands/DebugCommands.cpp +++ b/src/game/Commands/DebugCommands.cpp @@ -72,7 +72,7 @@ bool ChatHandler::HandleSpellEffectsCommand(char *args) return false; } LocaleConstant loc = GetSessionDbcLocale(); - ShowSpellListHelper(NULL, pSpell, loc); + ShowSpellListHelper(nullptr, pSpell, loc); for (uint8 i = 0; i < MAX_EFFECT_INDEX; ++i) { if (pSpell->Effect[i] == 0) @@ -110,7 +110,7 @@ bool ChatHandler::HandleSpellEffectsCommand(char *args) } if (SpellEntry const* pTriggered = sSpellMgr.GetSpellEntry(pSpell->EffectTriggerSpell[i])) - ShowSpellListHelper(NULL, pTriggered, loc); + ShowSpellListHelper(nullptr, pTriggered, loc); else PSendSysMessage("(existe pas)"); } @@ -130,7 +130,7 @@ bool ChatHandler::HandleSpellInfosCommand(char *args) return false; } LocaleConstant loc = GetSessionDbcLocale(); - ShowSpellListHelper(NULL, pSpell, loc); + ShowSpellListHelper(nullptr, pSpell, loc); PSendSysMessage("School%u:Category%u:Dispel%u:Mechanic%u", pSpell->School, pSpell->Category, pSpell->Dispel, pSpell->Mechanic); PSendSysMessage("Attributes0x%x:Ex[0x%x:0x%x:0x%x:0x%x]", pSpell->Attributes, pSpell->AttributesEx, pSpell->AttributesEx2, pSpell->AttributesEx3, pSpell->AttributesEx4); @@ -158,7 +158,7 @@ bool ChatHandler::HandleSpellSearchCommand(char *args) return false; PSendSysMessage("* Results for SpellFamilyName %u and SpellFamilyFlags & 0x%x", familyName, familyFlags); LocaleConstant loc = GetSessionDbcLocale(); - SpellEntry const* pSpell = NULL; + SpellEntry const* pSpell = nullptr; for (uint32 id = 0; id < sSpellMgr.GetMaxSpellId(); ++id) { pSpell = sSpellMgr.GetSpellEntry(id); @@ -166,7 +166,7 @@ bool ChatHandler::HandleSpellSearchCommand(char *args) continue; if (pSpell->SpellFamilyName == familyName && pSpell->SpellFamilyFlags & familyFlags) { - ShowSpellListHelper(NULL, pSpell, loc); + ShowSpellListHelper(nullptr, pSpell, loc); ++results; } } @@ -196,7 +196,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(char* args) if (!ExtractOptUInt32(&args, failarg2, 0)) return false; - char* unk = strtok(NULL, " "); + char* unk = strtok(nullptr, " "); uint8 unkI = unk ? (uint8)atoi(unk) : 2; WorldPacket data(SMSG_CAST_RESULT, 4 + 1 + 1); @@ -230,7 +230,7 @@ bool ChatHandler::HandleDebugSendNextChannelSpellVisualCommand(char *args) return true; } uint32 id = 0; - SpellEntry const *spellInfo = NULL; + SpellEntry const *spellInfo = nullptr; for (id = uiPlayId + 1; id <= sSpellMgr.GetMaxSpellId(); id++) { spellInfo = sSpellMgr.GetSpellEntry(id); @@ -313,7 +313,7 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args) return false; uint8 msg = atoi(args); - m_session->GetPlayer()->SendEquipError(InventoryResult(msg), NULL, NULL); + m_session->GetPlayer()->SendEquipError(InventoryResult(msg), nullptr, nullptr); return true; } @@ -799,9 +799,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) continue; } - if (updateQueue[qp] == NULL) + if (updateQueue[qp] == nullptr) { - PSendSysMessage("%s at slot %u has a queuepos (%d) that points to NULL in the queue!", + PSendSysMessage("%s at slot %u has a queuepos (%d) that points to nullptr in the queue!", item->GetGuidStr().c_str(), item->GetSlot(), qp); error = true; continue; @@ -878,9 +878,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) continue; } - if (updateQueue[qp] == NULL) + if (updateQueue[qp] == nullptr) { - PSendSysMessage("%s in bag %u at slot %u has a queuepos (%d) that points to NULL in the queue!", + PSendSysMessage("%s in bag %u at slot %u has a queuepos (%d) that points to nullptr in the queue!", item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp); error = true; continue; @@ -931,7 +931,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (item->GetState() == ITEM_REMOVED) continue; Item *test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); - if (test == NULL) + if (test == nullptr) { PSendSysMessage("queue(" SIZEFMTD "): %s has incorrect (bag %u slot %u) values, the player doesn't have an item at that position!", i, item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot()); @@ -1414,7 +1414,7 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args) return false; Player *chr = GetSelectedPlayer(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -1618,7 +1618,7 @@ bool ChatHandler::HandleDebugLootTableCommand(char* args) simCount = simCount ? simCount : 10000; SetSentErrorMessage(true); - LootStore const* store = NULL; + LootStore const* store = nullptr; if (tableName == "creature") store = &LootTemplates_Creature; else if (tableName == "reference") @@ -1663,7 +1663,7 @@ bool ChatHandler::HandleDebugLootTableCommand(char* args) for (unsigned int i = 0; i < simCount; ++i) { - Loot l(NULL); + Loot l(nullptr); if (lootOwner) l.SetTeam(lootOwner->GetTeam()); tab->Process(l, *store, store->IsRatesAllowed()); @@ -1825,7 +1825,7 @@ bool ChatHandler::HandleFactionChangeItemsCommand(char* c) if (!canEquip) { - ItemPrototype const* similar = NULL; + ItemPrototype const* similar = nullptr; for (uint32 id2 = 0; id2 < sItemStorage.GetMaxEntry(); id2++) if (ItemPrototype const * proto2 = sItemStorage.LookupEntry(id2)) if (proto1 != proto2 && IsSimilarItem(proto1, proto2)) @@ -2354,7 +2354,7 @@ bool ChatHandler::HandleMmapPathCommand(char* args) // this entry visible only to GM's with "gm on" static const uint32 WAYPOINT_NPC_ENTRY = 1; - Creature* wp = NULL; + Creature* wp = nullptr; for (uint32 i = 0; i < pointPath.size(); ++i) { if (transport) @@ -2502,7 +2502,7 @@ bool ChatHandler::HandleMmapStatsCommand(char* /*args*/) if (Transport* transport = m_session->GetPlayer()->GetTransport()) { const dtNavMeshQuery* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetModelNavMeshQuery(transport->GetDisplayId()); - navmesh = navmeshquery ? navmeshquery->getAttachedNavMesh() : NULL; + navmesh = navmeshquery ? navmeshquery->getAttachedNavMesh() : nullptr; } if (!navmesh) diff --git a/src/game/Commands/LookupCommands.cpp b/src/game/Commands/LookupCommands.cpp index 95f4195f4..487fa38e4 100644 --- a/src/game/Commands/LookupCommands.cpp +++ b/src/game/Commands/LookupCommands.cpp @@ -173,7 +173,7 @@ bool ChatHandler::HandleListCreatureCommand(char* args) return true; } -void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target /*=NULL*/) +void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target /*=nullptr*/) { ItemPrototype const *itemProto = sItemStorage.LookupEntry(itemId); if (!itemProto) @@ -181,7 +181,7 @@ void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target std::string name; - if (ItemLocale const *il = loc_idx >= 0 ? sObjectMgr.GetItemLocale(itemProto->ItemId) : NULL) + if (ItemLocale const *il = loc_idx >= 0 ? sObjectMgr.GetItemLocale(itemProto->ItemId) : nullptr) name = il->Name[loc_idx]; if (name.empty()) @@ -215,7 +215,7 @@ bool ChatHandler::HandleLookupItemCommand(char* args) wstrToLower(wnamepart); - Player* pl = m_session ? m_session->GetPlayer() : NULL; + Player* pl = m_session ? m_session->GetPlayer() : nullptr; uint32 counter = 0; @@ -328,7 +328,7 @@ bool ChatHandler::HandleLookupSkillCommand(char* args) if (!*args) return false; - // can be NULL in console call + // can be nullptr in console call Player* target = GetSelectedPlayer(); std::string namepart = args; @@ -453,7 +453,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args) if (!*args) return false; - // can be NULL at console call + // can be nullptr at console call Player* target = GetSelectedPlayer(); std::string namepart = args; @@ -507,7 +507,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args) return true; } -void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* target /*= NULL*/) +void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* target /*= nullptr*/) { Quest const* qinfo = sObjectMgr.GetQuestTemplate(questId); if (!qinfo) @@ -515,7 +515,7 @@ void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* tar std::string title; - if (QuestLocale const *il = loc_idx >= 0 ? sObjectMgr.GetQuestLocale(qinfo->GetQuestId()) : NULL) + if (QuestLocale const *il = loc_idx >= 0 ? sObjectMgr.GetQuestLocale(qinfo->GetQuestId()) : nullptr) title = il->Title[loc_idx]; if (title.empty()) @@ -549,7 +549,7 @@ bool ChatHandler::HandleLookupQuestCommand(char* args) if (!*args) return false; - // can be NULL at console call + // can be nullptr at console call Player* target = GetSelectedPlayer(); std::string namepart = args; @@ -999,7 +999,7 @@ bool ChatHandler::HandleLookupPlayerIpCommand(char* args) if (!ExtractOptUInt32(&args, limit, 100)) return false; - QueryResult* result = NULL; + QueryResult* result = nullptr; std::string ip = ipStr; LoginDatabase.escape_string(ip); result = LoginDatabase.PQuery("SELECT id, username FROM account WHERE last_ip " _LIKE_ " " _CONCAT2_("'%s'", "'%%'"), ip.c_str()); @@ -1078,7 +1078,7 @@ bool ChatHandler::HandleLookupPlayerCharacterCommand(char* args) if (!ExtractOptUInt32(&args, limit, 100)) return false; - QueryResult* result = NULL; + QueryResult* result = nullptr; std::string normalizedName = nameStr; if (normalizePlayerName(normalizedName)) if (PlayerCacheData const* data = sObjectMgr.GetPlayerDataByName(normalizedName)) @@ -1091,7 +1091,7 @@ bool ChatHandler::HandleLookupPlayerCharacterCommand(char* args) AccountTypes security = sAccountMgr.GetSecurity(id); if (GetAccessLevel() < security || (GetAccessLevel() < SEC_ADMINISTRATOR && security > SEC_PLAYER)) - return LookupPlayerSearchCommand(NULL, &limit); + return LookupPlayerSearchCommand(nullptr, &limit); LoginDatabase.escape_string(ip); result = LoginDatabase.PQuery("SELECT id, username FROM account WHERE last_ip = '%s'", ip.c_str()); @@ -1160,8 +1160,8 @@ bool ChatHandler::HandleLookupPoolCommand(char * args) std::string namepart = args; - Player* player = m_session ? m_session->GetPlayer() : NULL; - MapPersistentState* mapState = player ? player->GetMap()->GetPersistentState() : NULL; + Player* player = m_session ? m_session->GetPlayer() : nullptr; + MapPersistentState* mapState = player ? player->GetMap()->GetPersistentState() : nullptr; strToLower(namepart); @@ -1386,7 +1386,7 @@ static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] = LANG_REP_FRIENDLY, LANG_REP_HONORED, LANG_REP_REVERED, LANG_REP_EXALTED }; -void ChatHandler::ShowFactionListHelper(FactionEntry const * factionEntry, LocaleConstant loc, FactionState const* repState /*= NULL*/, Player * target /*= NULL */) +void ChatHandler::ShowFactionListHelper(FactionEntry const * factionEntry, LocaleConstant loc, FactionState const* repState /*= nullptr*/, Player * target /*= nullptr */) { std::string name = factionEntry->name[loc]; // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format @@ -1397,7 +1397,7 @@ void ChatHandler::ShowFactionListHelper(FactionEntry const * factionEntry, Local else ss << factionEntry->ID << " - " << name << " " << localeNames[loc]; - if (repState) // and then target!=NULL also + if (repState) // and then target!=nullptr also { ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); std::string rankName = GetMangosString(ReputationRankStrIndex[rank]); @@ -1428,7 +1428,7 @@ bool ChatHandler::HandleLookupFactionCommand(char* args) if (!*args) return false; - // Can be NULL at console call + // Can be nullptr at console call Player *target = GetSelectedPlayer(); std::string namepart = args; @@ -1471,7 +1471,7 @@ bool ChatHandler::HandleLookupFactionCommand(char* args) if (loc < MAX_DBC_LOCALE) { - FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; + FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr; ShowFactionListHelper(factionEntry, LocaleConstant(loc), repState, target); counter++; } diff --git a/src/game/Commands/MiscCommands.cpp b/src/game/Commands/MiscCommands.cpp index ecd557750..b2f267e34 100644 --- a/src/game/Commands/MiscCommands.cpp +++ b/src/game/Commands/MiscCommands.cpp @@ -415,7 +415,7 @@ bool ChatHandler::HandleGuildInviteCommand(char *args) // if not guild name only (in "") then player name ObjectGuid target_guid; - if (!ExtractPlayerTarget(&nameStr, NULL, &target_guid)) + if (!ExtractPlayerTarget(&nameStr, nullptr, &target_guid)) { SendSysMessage(LANG_PLAYER_NOT_FOUND); SetSentErrorMessage(true); @@ -778,7 +778,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args) if (itr->first != player->GetMapId()) { DungeonPersistentState *save = itr->second.state; - std::string timeleft = secsToTimeString(save->GetResetTime() - time(NULL), true); + std::string timeleft = secsToTimeString(save->GetResetTime() - time(nullptr), true); if (const MapEntry* entry = sMapStorage.LookupEntry(itr->first)) { @@ -851,7 +851,7 @@ bool ChatHandler::HandleSendMassMailCommand(char* args) { // format: raceMask "subject text" "mail text" uint32 raceMask = 0; - char const* name = NULL; + char const* name = nullptr; if (!ExtractRaceMask(&args, raceMask, &name)) return false; @@ -984,7 +984,7 @@ bool ChatHandler::HandleSendMassItemsCommand(char* args) // format: racemask "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] uint32 raceMask = 0; - char const* name = NULL; + char const* name = nullptr; if (!ExtractRaceMask(&args, raceMask, &name)) return false; @@ -1065,7 +1065,7 @@ bool ChatHandler::HandleSendMassMoneyCommand(char* args) /// format: raceMask "subject text" "mail text" money uint32 raceMask = 0; - char const* name = NULL; + char const* name = nullptr; if (!ExtractRaceMask(&args, raceMask, &name)) return false; @@ -1210,10 +1210,10 @@ bool ChatHandler::HandlePoolInfoCommand(char* args) if (!ExtractUint32KeyFromLink(&args, "Hpool", pool_id)) return false; - Player* player = m_session ? m_session->GetPlayer() : NULL; + Player* player = m_session ? m_session->GetPlayer() : nullptr; - MapPersistentState* mapState = player ? player->GetMap()->GetPersistentState() : NULL; - SpawnedPoolData const* spawns = mapState ? &mapState->GetSpawnedPoolData() : NULL; + MapPersistentState* mapState = player ? player->GetMap()->GetPersistentState() : nullptr; + SpawnedPoolData const* spawns = mapState ? &mapState->GetSpawnedPoolData() : nullptr; std::string active_str = GetMangosString(LANG_ACTIVE); @@ -1233,7 +1233,7 @@ bool ChatHandler::HandlePoolInfoCommand(char* args) } PoolGroup const& poolCreatures = sPoolMgr.GetPoolCreatures(pool_id); - SpawnedPoolObjects const* crSpawns = spawns ? &spawns->GetSpawnedCreatures() : NULL; + SpawnedPoolObjects const* crSpawns = spawns ? &spawns->GetSpawnedCreatures() : nullptr; PoolObjectList const& poolCreaturesEx = poolCreatures.GetExplicitlyChanced(); if (!poolCreaturesEx.empty()) @@ -1280,7 +1280,7 @@ bool ChatHandler::HandlePoolInfoCommand(char* args) } PoolGroup const& poolGameObjects = sPoolMgr.GetPoolGameObjects(pool_id); - SpawnedPoolObjects const* goSpawns = spawns ? &spawns->GetSpawnedGameobjects() : NULL; + SpawnedPoolObjects const* goSpawns = spawns ? &spawns->GetSpawnedGameobjects() : nullptr; PoolObjectList const& poolGameObjectsEx = poolGameObjects.GetExplicitlyChanced(); if (!poolGameObjectsEx.empty()) @@ -1327,7 +1327,7 @@ bool ChatHandler::HandlePoolInfoCommand(char* args) } PoolGroup const& poolPools = sPoolMgr.GetPoolPools(pool_id); - SpawnedPoolPools const* poolSpawns = spawns ? &spawns->GetSpawnedPools() : NULL; + SpawnedPoolPools const* poolSpawns = spawns ? &spawns->GetSpawnedPools() : nullptr; PoolObjectList const& poolPoolsEx = poolPools.GetExplicitlyChanced(); if (!poolPoolsEx.empty()) @@ -1419,9 +1419,9 @@ void ChatHandler::ShowTriggerListHelper(AreaTriggerEntry const * atEntry) bool ChatHandler::HandleTriggerCommand(char* args) { - AreaTriggerEntry const* atEntry = NULL; + AreaTriggerEntry const* atEntry = nullptr; - Player* pl = m_session ? m_session->GetPlayer() : NULL; + Player* pl = m_session ? m_session->GetPlayer() : nullptr; // select by args if (*args) @@ -1666,7 +1666,7 @@ bool ChatHandler::HandleCinematicListWpCommand(char *args) bool ChatHandler::HandleReplayPlayCommand(char* c) { - if (!c || !*c || strchr(c, '/') != NULL || strchr(c, '.') != NULL) + if (!c || !*c || strchr(c, '/') != nullptr || strchr(c, '.') != nullptr) return false; WorldSession* sess = m_session; if (Player* player = GetSelectedPlayer()) @@ -1719,7 +1719,7 @@ bool ChatHandler::HandleReplayStopCommand(char* c) SetSentErrorMessage(true); return false; } - m_session->SetReadPacket(NULL); + m_session->SetReadPacket(nullptr); SendSysMessage("Replay stopped"); return true; } diff --git a/src/game/Commands/ObjectCommands.cpp b/src/game/Commands/ObjectCommands.cpp index 793a3c246..ace057e28 100644 --- a/src/game/Commands/ObjectCommands.cpp +++ b/src/game/Commands/ObjectCommands.cpp @@ -135,7 +135,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args) if (target) { - time_t curRespawnDelay = target->GetRespawnTimeEx() - time(NULL); + time_t curRespawnDelay = target->GetRespawnTimeEx() - time(nullptr); if (curRespawnDelay < 0) curRespawnDelay = 0; @@ -188,7 +188,7 @@ bool ChatHandler::HandleGameObjectTurnCommand(char* args) if (!lowguid) return false; - GameObject* obj = NULL; + GameObject* obj = nullptr; // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) @@ -231,7 +231,7 @@ bool ChatHandler::HandleGameObjectMoveCommand(char* args) if (!lowguid) return false; - GameObject* obj = NULL; + GameObject* obj = nullptr; // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) @@ -308,7 +308,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(char* args) if (!lowguid) return false; - GameObject* obj = NULL; + GameObject* obj = nullptr; // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) @@ -433,7 +433,7 @@ bool ChatHandler::HandleGameObjectTempAddCommand(char *args) Player *chr = m_session->GetPlayer(); - char* spawntime = strtok(NULL, " "); + char* spawntime = strtok(nullptr, " "); uint32 spawntm = 300; if (spawntime) @@ -523,7 +523,7 @@ bool ChatHandler::HandleGameObjectSelectCommand(char*) const float dist = 10.0f; Player* player = m_session->GetPlayer(); - GameObject* go = NULL; + GameObject* go = nullptr; CellPair pair(MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY())); Cell cell(pair); cell.SetNoCreate(); @@ -577,7 +577,7 @@ bool ChatHandler::HandleGameObjectRespawnCommand(char*) bool ChatHandler::HandleGameObjectToggleCommand(char* args) { uint32 lowguid; - GameObject* obj = NULL; + GameObject* obj = nullptr; if (!ExtractUint32KeyFromLink(&args, "Hgameobject", lowguid)) { diff --git a/src/game/Commands/ServerCommands.cpp b/src/game/Commands/ServerCommands.cpp index 11fc2eb16..b69547a74 100644 --- a/src/game/Commands/ServerCommands.cpp +++ b/src/game/Commands/ServerCommands.cpp @@ -607,7 +607,7 @@ bool ChatHandler::HandleGroupAddSpellCommand(char *args) return false; } LocaleConstant loc = GetSessionDbcLocale(); - ShowSpellListHelper(NULL, pSpell, loc); + ShowSpellListHelper(nullptr, pSpell, loc); WorldDatabase.PExecute("INSERT INTO `spell_group` SET id=%u, spell_id=%u", groupId, spellId); PSendSysMessage("Spell added to group %u in DB.", groupId); @@ -712,8 +712,8 @@ bool ChatHandler::HandleEventInfoCommand(char* args) std::string endTimeStr = TimeToTimestampStr(eventData.end); uint32 delay = sGameEventMgr.NextCheck(event_id); - time_t nextTime = time(NULL) + delay; - std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL) + delay) : "-"; + time_t nextTime = time(nullptr) + delay; + std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-"; std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE); std::string lengthStr = secsToTimeString(eventData.length * MINUTE); diff --git a/src/game/Commands/TeleportCommands.cpp b/src/game/Commands/TeleportCommands.cpp index 647dbf385..06750132e 100644 --- a/src/game/Commands/TeleportCommands.cpp +++ b/src/game/Commands/TeleportCommands.cpp @@ -139,7 +139,7 @@ bool ChatHandler::HandleTeleGroupCommand(char * args) return false; } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pl = itr->getSource(); @@ -214,7 +214,7 @@ bool ChatHandler::HandleGroupgoCommand(char* args) return false; } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pl = itr->getSource(); @@ -274,7 +274,7 @@ static char const* const areatriggerKeys[] = { "Hareatrigger", "Hareatrigger_target", - NULL + nullptr }; bool ChatHandler::HandleGoTriggerCommand(char* args) @@ -353,7 +353,7 @@ static char const* const creatureKeys[] = { "Hcreature", "Hcreature_entry", - NULL + nullptr }; /** \brief Teleport the GM to the specified creature @@ -391,7 +391,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args) crType = CREATURE_LINK_ENTRY; } - CreatureData const* data = NULL; + CreatureData const* data = nullptr; uint32 lowguid = 0; switch (crType) @@ -412,7 +412,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args) return false; } - FindCreatureData worker(tEntry, m_session ? m_session->GetPlayer() : NULL); + FindCreatureData worker(tEntry, m_session ? m_session->GetPlayer() : nullptr); sObjectMgr.DoCreatureData(worker); @@ -467,7 +467,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args) return false; } - FindCreatureData worker(0, m_session ? m_session->GetPlayer() : NULL); + FindCreatureData worker(0, m_session ? m_session->GetPlayer() : nullptr); do { @@ -519,7 +519,7 @@ static char const* const gameobjectKeys[] = { "Hgameobject", "Hgameobject_entry", - NULL + nullptr }; //teleport to gameobject @@ -544,7 +544,7 @@ bool ChatHandler::HandleGoObjectCommand(char* args) goType = GAMEOBJECT_LINK_ENTRY; } - GameObjectData const* data = NULL; + GameObjectData const* data = nullptr; switch (goType) { @@ -564,7 +564,7 @@ bool ChatHandler::HandleGoObjectCommand(char* args) return false; } - FindGOData worker(tEntry, m_session ? m_session->GetPlayer() : NULL); + FindGOData worker(tEntry, m_session ? m_session->GetPlayer() : nullptr); sObjectMgr.DoGOData(worker); @@ -622,7 +622,7 @@ bool ChatHandler::HandleGoObjectCommand(char* args) return false; } - FindGOData worker(0, m_session ? m_session->GetPlayer() : NULL); + FindGOData worker(0, m_session ? m_session->GetPlayer() : nullptr); do { @@ -701,7 +701,7 @@ bool ChatHandler::HandleTeleNameCommand(char* args) else { // check offline security - if (HasLowerSecurity(NULL, target_guid)) + if (HasLowerSecurity(nullptr, target_guid)) return false; std::string nameLink = playerLink(target_name); @@ -1185,7 +1185,7 @@ bool ChatHandler::HandleNamegoCommand(char* args) else { // check offline security - if (HasLowerSecurity(NULL, target_guid)) + if (HasLowerSecurity(nullptr, target_guid)) return false; std::string nameLink = playerLink(target_name); @@ -1279,7 +1279,7 @@ bool ChatHandler::HandleGonameCommand(char* args) { Group *group = _player->GetGroup(); // if no bind exists, create a solo bind - InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId()) : NULL; + InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId()) : nullptr; // if no bind exists, create a solo bind if (!gBind) { @@ -1343,7 +1343,7 @@ bool ChatHandler::HandleGonameCommand(char* args) bool ChatHandler::HandleGocorpseCommand(char* args) { ObjectGuid target_guid; - if (!ExtractPlayerTarget(&args, NULL, &target_guid, NULL)) + if (!ExtractPlayerTarget(&args, nullptr, &target_guid, nullptr)) return false; Corpse* corpse = sObjectAccessor.GetCorpseForPlayerGUID(target_guid); @@ -1358,5 +1358,5 @@ bool ChatHandler::HandleGocorpseCommand(char* args) float y = corpse->GetPositionY(); float z = corpse->GetPositionZ(); - return HandleGoHelper(m_session->GetPlayer(), corpse->GetMapId(), x, y, &z, NULL); + return HandleGoHelper(m_session->GetPlayer(), corpse->GetMapId(), x, y, &z, nullptr); } diff --git a/src/game/Commands/TicketCommands.cpp b/src/game/Commands/TicketCommands.cpp index f474b91a0..913af6c87 100644 --- a/src/game/Commands/TicketCommands.cpp +++ b/src/game/Commands/TicketCommands.cpp @@ -17,7 +17,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(char* args) uint32 ticketId = atoi(ticketIdStr); std::string target(GetSession() ? GetSession()->GetPlayerName() : ""); - char* targetStr = strtok(NULL, " "); + char* targetStr = strtok(nullptr, " "); if (targetStr) target = targetStr; if (target.empty()) @@ -45,7 +45,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(char* args) // If assigned to different player other than current, leave //! Console can override though - Player* player = GetSession() ? GetSession()->GetPlayer() : NULL; + Player* player = GetSession() ? GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str()); @@ -57,7 +57,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(char* args) ticket->SaveToDB(); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*this, nullptr, target.c_str(), nullptr, nullptr, nullptr); sWorld.SendGMTicketText(msg.c_str()); return true; } @@ -82,7 +82,7 @@ bool ChatHandler::HandleGMTicketCloseByIdCommand(char* args) // Ticket should be assigned to the player who tries to close it. // Console can override though - Player* player = GetSession() ? GetSession()->GetPlayer() : NULL; + Player* player = GetSession() ? GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId()); @@ -92,7 +92,7 @@ bool ChatHandler::HandleGMTicketCloseByIdCommand(char* args) sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetObjectGuid() : ObjectGuid(uint64(-1))); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, player ? player->GetName() : "Console", NULL, NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*this, player ? player->GetName() : "Console", nullptr, nullptr, nullptr, nullptr); sWorld.SendGMTicketText(msg.c_str()); // Inform player, who submitted this ticket, that it is closed @@ -113,7 +113,7 @@ bool ChatHandler::HandleGMTicketCommentCommand(char* args) char* ticketIdStr = strtok((char*)args, " "); uint32 ticketId = atoi(ticketIdStr); - char* comment = strtok(NULL, "\n"); + char* comment = strtok(nullptr, "\n"); if (!comment) comment = ""; @@ -126,7 +126,7 @@ bool ChatHandler::HandleGMTicketCommentCommand(char* args) // Cannot comment ticket assigned to someone else //! Console excluded - Player* player = GetSession() ? GetSession()->GetPlayer() : NULL; + Player* player = GetSession() ? GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); @@ -137,7 +137,7 @@ bool ChatHandler::HandleGMTicketCommentCommand(char* args) ticket->SaveToDB(); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*this, nullptr, ticket->GetAssignedToName().c_str(), nullptr, nullptr, nullptr); msg += PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment); sWorld.SendGMTicketText(msg.c_str()); @@ -170,12 +170,12 @@ bool ChatHandler::HandleGMTicketCompleteCommand(char* args) return true; } - char* response = strtok(NULL, "\n"); + char* response = strtok(nullptr, "\n"); if (response) { // Cannot add response to ticket, assigned to someone else //! Console excluded - Player* player = GetSession() ? GetSession()->GetPlayer() : NULL; + Player* player = GetSession() ? GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); @@ -194,8 +194,8 @@ bool ChatHandler::HandleGMTicketCompleteCommand(char* args) if (Player* player = ticket->GetPlayer()) ticket->SendResponse(player->GetSession()); - std::string msg = ticket->FormatMessageString(*this, NULL, NULL, - NULL, NULL, GetSession() ? GetSession()->GetPlayer()->GetName() : "Console"); + std::string msg = ticket->FormatMessageString(*this, nullptr, nullptr, + nullptr, nullptr, GetSession() ? GetSession()->GetPlayer()->GetName() : "Console"); sWorld.SendGMTicketText(msg.c_str()); sTicketMgr->UpdateLastChange(); return true; @@ -220,7 +220,7 @@ bool ChatHandler::HandleGMTicketDeleteByIdCommand(char* args) return true; } - std::string msg = ticket->FormatMessageString(*this, NULL, NULL, NULL, GetSession() ? GetSession()->GetPlayer()->GetName() : "Console", NULL); + std::string msg = ticket->FormatMessageString(*this, nullptr, nullptr, nullptr, GetSession() ? GetSession()->GetPlayer()->GetName() : "Console", nullptr); sWorld.SendGMTicketText(msg.c_str()); sTicketMgr->RemoveTicket(ticket->GetId()); @@ -386,8 +386,8 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(char* args) ticket->SaveToDB(); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, NULL, assignedTo.c_str(), - GetSession() ? GetSession()->GetPlayer()->GetName() : "Console", NULL, NULL); + std::string msg = ticket->FormatMessageString(*this, nullptr, assignedTo.c_str(), + GetSession() ? GetSession()->GetPlayer()->GetName() : "Console", nullptr, nullptr); sWorld.SendGMTicketText(msg.c_str()); return true; @@ -395,7 +395,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(char* args) bool ChatHandler::ViewTicketByIdOrName(char* ticketId_c, char* name_c) { - GmTicket* ticket = NULL; + GmTicket* ticket = nullptr; // By ticket id if (ticketId_c && *ticketId_c) @@ -459,12 +459,12 @@ bool ChatHandler::HandleGMTicketGetByIdOrNameCommand(char* args) bool ChatHandler::HandleGMTicketGetByIdCommand(char* args) { - return ViewTicketByIdOrName(args, NULL); + return ViewTicketByIdOrName(args, nullptr); } bool ChatHandler::HandleGMTicketGetByNameCommand(char* args) { - return ViewTicketByIdOrName(NULL, args); + return ViewTicketByIdOrName(nullptr, args); } bool ChatHandler::HandleGMTicketResponseResetCommand(char* args) @@ -484,7 +484,7 @@ bool ChatHandler::HandleGMTicketResponseResetCommand(char* args) // Cannot add response to ticket, assigned to someone else //! Console excluded - Player* player = GetSession() ? GetSession()->GetPlayer() : NULL; + Player* player = GetSession() ? GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); @@ -505,7 +505,7 @@ bool _HandleGMTicketResponseAppendCommand(char* args, bool newLine, ChatHandler* char* ticketIdStr = strtok((char*)args, " "); uint32 ticketId = atoi(ticketIdStr); - char* response = strtok(NULL, "\n"); + char* response = strtok(nullptr, "\n"); if (!response) return false; @@ -518,7 +518,7 @@ bool _HandleGMTicketResponseAppendCommand(char* args, bool newLine, ChatHandler* // Cannot add response to ticket, assigned to someone else //! Console excluded - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); diff --git a/src/game/Commands/UnitCommands.cpp b/src/game/Commands/UnitCommands.cpp index 959428e5c..62c73ac0d 100644 --- a/src/game/Commands/UnitCommands.cpp +++ b/src/game/Commands/UnitCommands.cpp @@ -47,7 +47,7 @@ bool ChatHandler::HandleGUIDCommand(char* /*args*/) bool ChatHandler::HandleGPSCommand(char* args) { - WorldObject *obj = NULL; + WorldObject *obj = nullptr; if (*args) { if (ObjectGuid guid = ExtractGuidFromLink(&args)) @@ -314,7 +314,7 @@ bool ChatHandler::HandleAuraHelper(uint32 spellID, int32 duration, Unit* unit) eff == SPELL_EFFECT_APPLY_AURA || eff == SPELL_EFFECT_PERSISTENT_AREA_AURA) { - Aura* aur = CreateAura(spellInfo, SpellEffectIndex(i), NULL, holder, unit); + Aura* aur = CreateAura(spellInfo, SpellEffectIndex(i), nullptr, holder, unit); holder->AddAura(aur, SpellEffectIndex(i)); } } @@ -452,7 +452,7 @@ bool ChatHandler::HandleCastCommand(char* args) return false; } - bool triggered = ExtractLiteralArg(&args, "triggered") != NULL; + bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; if (!triggered && *args) // can be fail also at syntax error return false; @@ -478,7 +478,7 @@ bool ChatHandler::HandleCastBackCommand(char* args) if (!spell || !sSpellMgr.GetSpellEntry(spell)) return false; - bool triggered = ExtractLiteralArg(&args, "triggered") != NULL; + bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; if (!triggered && *args) // can be fail also at syntax error return false; @@ -514,7 +514,7 @@ bool ChatHandler::HandleCastDistCommand(char* args) if (!ExtractFloat(&args, dist)) return false; - bool triggered = ExtractLiteralArg(&args, "triggered") != NULL; + bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; if (!triggered && *args) // can be fail also at syntax error return false; @@ -548,7 +548,7 @@ bool ChatHandler::HandleCastTargetCommand(char* args) if (!spell || !sSpellMgr.GetSpellEntry(spell)) return false; - bool triggered = ExtractLiteralArg(&args, "triggered") != NULL; + bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; if (!triggered && *args) // can be fail also at syntax error return false; @@ -589,7 +589,7 @@ bool ChatHandler::HandleCastSelfCommand(char* args) return false; } - bool triggered = ExtractLiteralArg(&args, "triggered") != NULL; + bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; if (!triggered && *args) // can be fail also at syntax error return false; @@ -1084,7 +1084,7 @@ bool ChatHandler::HandleModifySpellPowerCommand(char *args) // dunno where spell power is stored so using a custom spell pTarget->RemoveAurasDueToSpell(18058); - pTarget->CastCustomSpell(pTarget, 18058, &amount, &amount, NULL, true); + pTarget->CastCustomSpell(pTarget, 18058, &amount, &amount, nullptr, true); PSendSysMessage(LANG_YOU_CHANGE_SP, pTarget->GetName(), amount); @@ -1407,7 +1407,7 @@ bool ChatHandler::HandleModifyASpeedCommand(char* args) } Unit *chr = GetSelectedUnit(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -1445,7 +1445,7 @@ bool ChatHandler::HandleModifyScaleCommand(char* args) } Unit *target = GetSelectedUnit(); - if (target == NULL) + if (target == nullptr) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -1490,7 +1490,7 @@ bool ChatHandler::HandleModifyHPCommand(char* args) } Unit *chr = GetSelectedUnit(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -1532,7 +1532,7 @@ bool ChatHandler::HandleModifyManaCommand(char* args) } Unit *chr = GetSelectedUnit(); - if (chr == NULL) + if (chr == nullptr) { SendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); @@ -1600,7 +1600,7 @@ bool ChatHandler::HandleDamageCommand(char* args) // flat melee damage without resistence/etc reduction if (!*args) { - m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_session->GetPlayer()->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); if (target != m_session->GetPlayer()) m_session->GetPlayer()->SendAttackStateUpdate(HITINFO_NORMALSWING2, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_NORMAL, 0); return true; @@ -1624,7 +1624,7 @@ bool ChatHandler::HandleDamageCommand(char* args) uint32 absorb = 0; int32 resist = 0; - target->CalculateDamageAbsorbAndResist(m_session->GetPlayer(), schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, NULL); + target->CalculateDamageAbsorbAndResist(m_session->GetPlayer(), schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, nullptr); const uint32 bonus = (resist < 0 ? uint32(std::abs(resist)) : 0); damage += bonus; @@ -1636,7 +1636,7 @@ bool ChatHandler::HandleDamageCommand(char* args) damage -= malus; m_session->GetPlayer()->DealDamageMods(target, damage, &absorb); - m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); + m_session->GetPlayer()->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false); m_session->GetPlayer()->SendAttackStateUpdate(HITINFO_NORMALSWING2, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_NORMAL, 0); return true; } @@ -1718,7 +1718,7 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/) case CHASE_MOTION_TYPE: { - Unit* target = NULL; + Unit* target = nullptr; if (unit->GetTypeId() == TYPEID_PLAYER) target = static_cast const*>(*itr)->GetTarget(); else @@ -1734,7 +1734,7 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/) } case FOLLOW_MOTION_TYPE: { - Unit* target = NULL; + Unit* target = nullptr; if (unit->GetTypeId() == TYPEID_PLAYER) target = static_cast const*>(*itr)->GetTarget(); else @@ -1850,13 +1850,13 @@ bool ChatHandler::HandleDieHelper(Unit* target) if (target->isAlive()) { if (sWorld.getConfig(CONFIG_BOOL_DIE_COMMAND_CREDIT)) - m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_session->GetPlayer()->DealDamage(target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); else { Creature* targetCreature = target->ToCreature(); if (targetCreature) - targetCreature->SetLootRecipient(NULL); - target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + targetCreature->SetLootRecipient(nullptr); + target->DealDamage(target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } } @@ -1899,7 +1899,7 @@ bool ChatHandler::HandleFearCommand(char* /*args*/) eff == SPELL_EFFECT_APPLY_AURA || eff == SPELL_EFFECT_PERSISTENT_AREA_AURA) { - Aura *aur = CreateAura(spellInfo, SpellEffectIndex(i), NULL, holder, target); + Aura *aur = CreateAura(spellInfo, SpellEffectIndex(i), nullptr, holder, target); holder->AddAura(aur, SpellEffectIndex(i)); } } diff --git a/src/game/Conditions.cpp b/src/game/Conditions.cpp index 9d495758b..c368b2e27 100644 --- a/src/game/Conditions.cpp +++ b/src/game/Conditions.cpp @@ -107,7 +107,7 @@ uint8 const* ConditionTargets = &ConditionTargetsInternal[3]; bool ConditionEntry::Meets(WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const { DEBUG_LOG("Condition-System: Check condition %u, type %i - called from %s with params target: %s, map %i, source %s", - m_entry, m_condition, conditionSourceToStr[conditionSourceType], target ? target->GetGuidStr().c_str() : "", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : ""); + m_entry, m_condition, conditionSourceToStr[conditionSourceType], target ? target->GetGuidStr().c_str() : "", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : ""); if (m_flags & CONDITION_FLAG_SWAP_TARGETS) std::swap(source, target); @@ -115,7 +115,7 @@ bool ConditionEntry::Meets(WorldObject const* target, Map const* map, WorldObjec if (!CheckParamRequirements(target, map, source)) { sLog.outErrorDb("CONDITION %u type %u used with bad parameters, called from %s, used with target: %s, map %i, source %s", - m_entry, m_condition, conditionSourceToStr[conditionSourceType], target ? target->GetGuidStr().c_str() : "NULL", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : "NULL"); + m_entry, m_condition, conditionSourceToStr[conditionSourceType], target ? target->GetGuidStr().c_str() : "nullptr", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : "nullptr"); return false; } diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index 4653fb717..f3cb2223c 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -27,7 +27,7 @@ CreatureGroupMember* CreatureGroup::AddMember(ObjectGuid guid, float followDist, float followAngle, uint32 memberFlags) { if (guid == _leaderGuid) - return NULL; + return nullptr; CreatureGroupMember*& member = _members[guid]; if (!member) member = new CreatureGroupMember(); @@ -114,7 +114,7 @@ void CreatureGroup::RespawnAll(Creature* except) Respawn(otherMember, nullptr); } -void CreatureGroup::Respawn(Creature* member, CreatureGroupMember const* memberEntry /* = NULL for leader */) +void CreatureGroup::Respawn(Creature* member, CreatureGroupMember const* memberEntry /* = nullptr for leader */) { // Prevent stack overflow (member->Respawn() can call CreatureGroup::Respawn, etc ...) if (_respawnGuard) diff --git a/src/game/Database/DBCStores.cpp b/src/game/Database/DBCStores.cpp index 6ebc9bff9..f3b5f6ff6 100644 --- a/src/game/Database/DBCStores.cpp +++ b/src/game/Database/DBCStores.cpp @@ -457,18 +457,18 @@ void LoadDBCStores(const std::string& dataPath) char const* GetPetName(uint32 petfamily, uint32 dbclang) { if (!petfamily) - return NULL; + return nullptr; CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily); if (!pet_family) - return NULL; - return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : NULL; + return nullptr; + return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr; } TalentSpellPos const* GetTalentSpellPos(uint32 spellId) { TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); if (itr == sTalentSpellPosMap.end()) - return NULL; + return nullptr; return &itr->second; } @@ -490,7 +490,7 @@ WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid { WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid)); if (i == sWMOAreaInfoByTripple.end()) - return NULL; + return nullptr; return i->second; } @@ -504,7 +504,7 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id) if (ch && ch->ChannelID == channel_id) return ch; } - return NULL; + return nullptr; } ChatChannelsEntry const* GetChannelEntryFor(const std::string& name) @@ -532,7 +532,7 @@ ChatChannelsEntry const* GetChannelEntryFor(const std::string& name) } } } - return NULL; + return nullptr; } /*[-ZERO] bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId) @@ -691,17 +691,17 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u return itr->second; } - return NULL; + return nullptr; } char const* GetRaceName(uint8 race, uint8 locale) { ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); - return raceEntry ? raceEntry->name[locale] : NULL; + return raceEntry ? raceEntry->name[locale] : nullptr; } char const* GetClassName(uint8 class_, uint8 locale) { ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); - return classEntry ? classEntry->name[locale] : NULL; + return classEntry ? classEntry->name[locale] : nullptr; } diff --git a/src/game/Database/DBCStructure.h b/src/game/Database/DBCStructure.h index d13f95479..120cec828 100644 --- a/src/game/Database/DBCStructure.h +++ b/src/game/Database/DBCStructure.h @@ -725,7 +725,7 @@ typedef std::map TaxiPathSetBySource; struct TaxiPathNodePtr { - TaxiPathNodePtr() : i_ptr(NULL) {} + TaxiPathNodePtr() : i_ptr(nullptr) {} TaxiPathNodePtr(TaxiPathNodeEntry const* ptr) : i_ptr(ptr) {} TaxiPathNodeEntry const* i_ptr; diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 22af89a35..eacaee2e6 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -29,7 +29,7 @@ #include "Opcodes.h" #include "Database/DatabaseImpl.h" -inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } +inline float GetAge(uint64 t) { return float(time(nullptr) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket @@ -39,7 +39,7 @@ GmTicket::GmTicket() : _id(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createT { } -GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), +GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(nullptr)), _lastModifiedTime(time(nullptr)), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false), _securityNeeded(SEC_MODERATOR) { @@ -156,7 +156,7 @@ void GmTicket::SendResponse(WorldSession* session) const std::string GmTicket::FormatMessageString(ChatHandler& handler, bool detailed) const { - time_t curTime = time(NULL); + time_t curTime = time(nullptr); std::stringstream ss; ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id); @@ -277,7 +277,7 @@ void GmTicket::SetChatLog(std::list time, std::string const& log) /////////////////////////////////////////////////////////////////////////////////////////////////// // Ticket manager TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), - _lastChange(time(NULL)) { } + _lastChange(time(nullptr)) { } TicketMgr::~TicketMgr() { @@ -464,7 +464,7 @@ void TicketMgr::ReloadTicketCallback(QueryResult* holder) if (!assignedTo.empty() || !closedBy.empty() || !completedBy.empty()) { NullChatHandler handler; - std::string msg = newTicket->FormatMessageString(handler, closedBy.empty() ? NULL : closedBy.c_str(), assignedTo.empty() ? NULL : assignedTo.c_str(), NULL, NULL, completedBy.empty() ? NULL : completedBy.c_str()); + std::string msg = newTicket->FormatMessageString(handler, closedBy.empty() ? nullptr : closedBy.c_str(), assignedTo.empty() ? nullptr : assignedTo.c_str(), nullptr, nullptr, completedBy.empty() ? nullptr : completedBy.c_str()); sWorld.SendGMTicketText(msg.c_str()); } } diff --git a/src/game/GMTicketMgr.h b/src/game/GMTicketMgr.h index c7324cfe1..590d69b16 100644 --- a/src/game/GMTicketMgr.h +++ b/src/game/GMTicketMgr.h @@ -125,7 +125,7 @@ public: void SetMessage(std::string const& message) { _message = message; - _lastModifiedTime = uint64(time(NULL)); + _lastModifiedTime = uint64(time(nullptr)); } void SetComment(std::string const& comment) { _comment = comment; } void SetViewed() { _viewed = true; } @@ -204,7 +204,7 @@ public: if (itr != _ticketList.end()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetTicketByPlayer(ObjectGuid playerGuid) @@ -213,7 +213,7 @@ public: if (itr->second && itr->second->IsFromPlayer(playerGuid) && !itr->second->IsClosed()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetOldestOpenTicket() @@ -222,7 +222,7 @@ public: if (itr->second && !itr->second->IsClosed() && !itr->second->IsCompleted()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetNextTicket(uint32 counter) @@ -231,7 +231,7 @@ public: if (itr->first > counter && !itr->second->IsClosed() && !itr->second->IsCompleted()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetPreviousTicket(uint32 counter) @@ -240,7 +240,7 @@ public: if (itr->first < counter && !itr->second->IsClosed() && !itr->second->IsCompleted()) return itr->second; - return NULL; + return nullptr; } void AddTicket(GmTicket* ticket); @@ -251,7 +251,7 @@ public: void SetStatus(bool status) { _status = status; } uint64 GetLastChange() const { return _lastChange; } - void UpdateLastChange() { _lastChange = uint64(time(NULL)); } + void UpdateLastChange() { _lastChange = uint64(time(nullptr)); } uint32 GetLastTicketId() const { return _lastTicketId; } uint32 GenerateTicketId() { return ++_lastTicketId; } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 8759718a6..8a45e9ae9 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -709,7 +709,7 @@ void GameEventMgr::Initialize(MapPersistentState* state) } // return the next event delay in ms -uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= NULL*/) +uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= nullptr*/) { // process hardcoded events time_t currenttime = time(nullptr); @@ -995,9 +995,9 @@ struct GameEventUpdateCreatureDataInMapsWorker { if (Creature* pCreature = map->GetCreature(i_guid)) { - pCreature->UpdateEntry(pCreature->GetOriginalEntry(), TEAM_NONE, i_data, i_activate ? i_event_data : NULL); + pCreature->UpdateEntry(pCreature->GetOriginalEntry(), TEAM_NONE, i_data, i_activate ? i_event_data : nullptr); - // spells not casted for event remove case (sent NULL into update), do it + // spells not casted for event remove case (sent nullptr into update), do it if (!i_activate) pCreature->ApplyGameEventSpells(i_event_data, false); } diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index d3fcb6ed5..b1f8b17ae 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -174,7 +174,7 @@ class MANGOS_DLL_SPEC GossipMenu // for using from scripts, don't must be inlined void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false); - void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage = NULL, bool Coded = false); + void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage = nullptr, bool Coded = false); void AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32 dtAction, int32 boxText = 0, bool Coded = false); void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; } diff --git a/src/game/Group/Group.cpp b/src/game/Group/Group.cpp index b4283238c..7deaa869c 100644 --- a/src/game/Group/Group.cpp +++ b/src/game/Group/Group.cpp @@ -80,8 +80,8 @@ void Roll::targetObjectBuildLink() //=================================================== Group::Group() : m_Id(0), m_groupType(GROUPTYPE_NORMAL), - m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), - m_subGroupsCounts(NULL), m_groupTeam(TEAM_NONE), m_leaderLastOnline(0), m_LFGAreaId(0) + m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), + m_subGroupsCounts(nullptr), m_groupTeam(TEAM_NONE), m_leaderLastOnline(0), m_LFGAreaId(0) { } @@ -91,9 +91,9 @@ Group::~Group() { DEBUG_LOG("Group::~Group: battleground group being deleted."); if (m_bgGroup->GetBgRaid(ALLIANCE) == this) - m_bgGroup->SetBgRaid(ALLIANCE, NULL); + m_bgGroup->SetBgRaid(ALLIANCE, nullptr); else if (m_bgGroup->GetBgRaid(HORDE) == this) - m_bgGroup->SetBgRaid(HORDE, NULL); + m_bgGroup->SetBgRaid(HORDE, nullptr); else sLog.outError("Group::~Group: battleground group is not linked to the correct battleground."); } @@ -276,7 +276,7 @@ uint32 Group::RemoveInvite(Player *player) { ASSERT(player->GetGroupInvite() == this); m_invitees.erase(player); - player->SetGroupInvite(NULL); + player->SetGroupInvite(nullptr); } return GetMembersCount(); } @@ -286,7 +286,7 @@ void Group::RemoveAllInvites() for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr) { ASSERT((*itr)->GetGroupInvite() == this); - (*itr)->SetGroupInvite(NULL); + (*itr)->SetGroupInvite(nullptr); } m_invitees.clear(); @@ -298,7 +298,7 @@ Player* Group::GetInvited(ObjectGuid guid) const if ((*itr)->GetObjectGuid() == guid) return (*itr); - return NULL; + return nullptr; } Player* Group::GetInvited(const std::string& name) const @@ -308,7 +308,7 @@ Player* Group::GetInvited(const std::string& name) const if ((*itr)->GetName() == name) return (*itr); } - return NULL; + return nullptr; } bool Group::AddMember(ObjectGuid guid, const char* name, uint8 joinMethod) @@ -474,9 +474,9 @@ void Group::Disband(bool hideDestroy) { //we can remove player who is in battleground from his original group if (player->GetOriginalGroup() == this) - player->SetOriginalGroup(NULL); + player->SetOriginalGroup(nullptr); else - player->SetGroup(NULL); + player->SetGroup(nullptr); } // quest related GO state dependent from raid membership @@ -526,7 +526,7 @@ void Group::Disband(bool hideDestroy) CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId='%u'", m_Id); CharacterDatabase.CommitTransaction(); - ResetInstances(INSTANCE_RESET_GROUP_DISBAND, NULL); + ResetInstances(INSTANCE_RESET_GROUP_DISBAND, nullptr); } _updateLeaderFlag(true); @@ -786,7 +786,7 @@ void Group::MasterLoot(Creature *creature, Loot* loot) WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); data << uint8(0); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *looter = itr->getSource(); if (!looter->IsInWorld()) @@ -802,7 +802,7 @@ void Group::MasterLoot(Creature *creature, Loot* loot) data.put(0, playerCount); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *looter = itr->getSource(); if (!looter->IsInWorld()) @@ -888,7 +888,7 @@ void Group::StartLootRoll(Creature* lootTarget, LootMethod method, Loot* loot, u Roll* r = new Roll(lootTarget->GetObjectGuid(), lootItem); //a vector is filled with only near party members - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *playerToRoll = itr->getSource(); if (!playerToRoll || !playerToRoll->GetSession() || !playerToRoll->IsInWorld()) @@ -1004,7 +1004,7 @@ void Group::CountSingleLooterRoll(Roll* roll) { item->is_blocked = false; item->lootOwner = playerGuid; - player->SendEquipError(msg, NULL, NULL, roll->itemid); + player->SendEquipError(msg, nullptr, nullptr, roll->itemid); } } @@ -1065,7 +1065,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI) { item->is_blocked = false; item->lootOwner = maxguid; - player->SendEquipError(msg, NULL, NULL, roll->itemid); + player->SendEquipError(msg, nullptr, nullptr, roll->itemid); } } else @@ -1115,7 +1115,7 @@ void Group::CountTheRoll(Rolls::iterator& rollI) else { item->is_blocked = false; - player->SendEquipError(msg, NULL, NULL, roll->itemid); + player->SendEquipError(msg, nullptr, nullptr, roll->itemid); } } } @@ -1174,7 +1174,7 @@ static void GetDataForXPAtKill_helper(Player* player, Unit const* victim, uint32 void Group::GetDataForXPAtKill(Unit const* victim, uint32& count, uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* member = itr->getSource(); if (!member || !member->isAlive() || !member->IsInWorld()) // only for alive @@ -1268,7 +1268,7 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) WorldPacket data; pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player *player = itr->getSource()) if (player != pPlayer && !player->IsInVisibleList(pPlayer)) // Possible unsafe call (cross maps groups) player->GetSession()->SendPacket(&data); @@ -1320,7 +1320,7 @@ void Group::UpdateOfflineLeader(time_t time, uint32 delay) void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignore) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pl = itr->getSource(); if (!pl || (ignore && pl->GetObjectGuid() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this)) @@ -1333,7 +1333,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int void Group::BroadcastReadyCheck(WorldPacket *packet) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pl = itr->getSource(); if (pl && pl->GetSession()) @@ -1405,7 +1405,7 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint { if (Group* invitedGroup = player->GetGroupInvite()) invitedGroup->RemoveInvite(player); - player->SetGroupInvite(NULL); + player->SetGroupInvite(nullptr); //if player is in group and he is being added to BG raid group, then call SetBattleGroundRaid() if (player->GetGroup() && isBGGroup()) @@ -1445,9 +1445,9 @@ bool Group::_removeMember(ObjectGuid guid) { //we can remove player who is in battleground from his original group if (player->GetOriginalGroup() == this) - player->SetOriginalGroup(NULL); + player->SetOriginalGroup(nullptr); else - player->SetGroup(NULL); + player->SetGroup(nullptr); } } @@ -1883,7 +1883,7 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, BattleGround Team team = Leader->GetTeam(); // check every member of the group to be able to join - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *member = itr->getSource(); // offline member? don't let join @@ -1915,7 +1915,7 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, BattleGround bool Group::InCombatToInstance(uint32 instanceId) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pPlayer = itr->getSource(); if (pPlayer->isInCombat() && pPlayer->GetInstanceId() == instanceId) @@ -2052,7 +2052,7 @@ InstanceGroupBind* Group::BindToInstance(DungeonPersistentState *state, bool per return &bind; } else - return NULL; + return nullptr; } void Group::UnbindInstance(uint32 mapid, bool unload) @@ -2160,8 +2160,8 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* pPlayerTap) uint32 count = 0; uint32 sum_level = 0; - Player* member_with_max_level = NULL; - Player* not_gray_member_with_max_level = NULL; + Player* member_with_max_level = nullptr; + Player* not_gray_member_with_max_level = nullptr; GetDataForXPAtKill(pVictim, count, sum_level, member_with_max_level, not_gray_member_with_max_level, pPlayerTap); @@ -2175,7 +2175,7 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* pPlayerTap) bool is_dungeon = PvP ? false : sMapStorage.LookupEntry(pVictim->GetMapId())->IsDungeon(); float group_rate = MaNGOS::XP::xp_in_group_rate(count, is_raid); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy || !pGroupGuy->IsInWorld()) @@ -2292,7 +2292,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) } // search next after current - Player* pNewLooter = NULL; + Player* pNewLooter = nullptr; for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr) { if (Player* player = ObjectAccessor::FindPlayer(itr->guid)) diff --git a/src/game/Group/Group.h b/src/game/Group/Group.h index 76473bc11..62e0d42ac 100644 --- a/src/game/Group/Group.h +++ b/src/game/Group/Group.h @@ -118,7 +118,7 @@ enum GroupUpdateFlags GROUP_UPDATE_FLAG_AURAS = 0x00000200, // 9 : uint32 mask, for each bit set uint16 spellid GROUP_UPDATE_FLAG_AURAS_NEGATIVE = 0x00000400, // 10: uint16 mask, for each bit set uint16 spellid GROUP_UPDATE_FLAG_PET_GUID = 0x00000800, // 11: uint64 pet guid - GROUP_UPDATE_FLAG_PET_NAME = 0x00001000, // 12: pet name, NULL terminated string + GROUP_UPDATE_FLAG_PET_NAME = 0x00001000, // 12: pet name, nullptr terminated string GROUP_UPDATE_FLAG_PET_MODEL_ID = 0x00002000, // 13: uint16, model id GROUP_UPDATE_FLAG_PET_CUR_HP = 0x00004000, // 14: uint16 pet cur health GROUP_UPDATE_FLAG_PET_MAX_HP = 0x00008000, // 15: uint16 pet max health @@ -165,7 +165,7 @@ struct InstanceGroupBind bool perm; /* permanent InstanceGroupBinds exist iff the leader has a permanent PlayerInstanceBind for the same instance. */ - InstanceGroupBind() : state(NULL), perm(false) {} + InstanceGroupBind() : state(nullptr), perm(false) {} }; /** request member stats checken **/ @@ -215,7 +215,7 @@ class MANGOS_DLL_SPEC Group uint32 GetId() const { return m_Id; } bool IsFull() const { return (m_groupType==GROUPTYPE_NORMAL) ? (m_memberSlots.size()>=MAX_GROUP_SIZE) : (m_memberSlots.size()>=MAX_RAID_SIZE); } bool isRaidGroup() const { return m_groupType==GROUPTYPE_RAID; } - bool isBGGroup() const { return m_bgGroup != NULL; } + bool isBGGroup() const { return m_bgGroup != nullptr; } bool IsCreated() const { return GetMembersCount() > 0; } ObjectGuid GetLeaderGuid() const { return m_leaderGuid; } const char * GetLeaderName() const { return m_leaderName.c_str(); } @@ -256,7 +256,7 @@ class MANGOS_DLL_SPEC Group GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); } uint32 GetMembersCount() const { return m_memberSlots.size(); } uint32 GetMembersMinCount() const { return (isBGGroup() ? 1 : 2); } - void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = NULL); + void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = nullptr); uint8 GetMemberGroup(ObjectGuid guid) const { member_citerator mslot = _getMemberCSlot(guid); diff --git a/src/game/Guild/Guild.cpp b/src/game/Guild/Guild.cpp index 58a7bcd31..210cf778a 100644 --- a/src/game/Guild/Guild.cpp +++ b/src/game/Guild/Guild.cpp @@ -45,7 +45,7 @@ void MemberSlot::SetMemberStats(Player* player) void MemberSlot::UpdateLogoutTime() { - LogoutTime = time(NULL); + LogoutTime = time(nullptr); } void MemberSlot::SetPNOTE(std::string pnote) @@ -253,7 +253,7 @@ GuildAddStatus Guild::AddMember(ObjectGuid plGuid, uint32 plRank) newmember.RankId = plRank; newmember.OFFnote = (std::string)""; newmember.Pnote = (std::string)""; - newmember.LogoutTime = time(NULL); + newmember.LogoutTime = time(nullptr); members[lowguid] = newmember; sGuildMgr.GuildMemberAdded(GetId(), lowguid); @@ -530,8 +530,8 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding) // or when he is removed from guild by gm command if (m_LeaderGuid == guid && !isDisbanding) { - MemberSlot* oldLeader = NULL; - MemberSlot* best = NULL; + MemberSlot* oldLeader = nullptr; + MemberSlot* best = nullptr; ObjectGuid newLeaderGUID; for (Guild::MemberList::iterator i = members.begin(); i != members.end(); ++i) { @@ -749,7 +749,7 @@ void Guild::Disband() sGuildMgr.RemoveGuild(m_Id); } -void Guild::Roster(WorldSession *session /*= NULL*/) +void Guild::Roster(WorldSession *session /*= nullptr*/) { // we can only guess size WorldPacket data(SMSG_GUILD_ROSTER, (4 + MOTD.length() + 1 + GINFO.length() + 1 + 4 + m_Ranks.size() * 4 + members.size() * 50)); @@ -788,7 +788,7 @@ void Guild::Roster(WorldSession *session /*= NULL*/) data << uint8(itr->second.Level); data << uint8(itr->second.Class); data << uint32(itr->second.ZoneId); - data << float(float(time(NULL) - itr->second.LogoutTime) / DAY); + data << float(float(time(nullptr) - itr->second.LogoutTime) / DAY); data << itr->second.Pnote; data << itr->second.OFFnote; } @@ -915,7 +915,7 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl NewEvent.PlayerGuid1 = playerGuid1.GetCounter(); NewEvent.PlayerGuid2 = playerGuid2.GetCounter(); NewEvent.NewRank = newRank; - NewEvent.TimeStamp = uint32(time(NULL)); + NewEvent.TimeStamp = uint32(time(nullptr)); // Count new LogGuid m_GuildEventLogNextGuid = (m_GuildEventLogNextGuid + 1) % sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT); // Check max records limit @@ -929,7 +929,7 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl m_Id, m_GuildEventLogNextGuid, uint32(NewEvent.EventType), NewEvent.PlayerGuid1, NewEvent.PlayerGuid2, uint32(NewEvent.NewRank), NewEvent.TimeStamp); } -void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 /*=NULL*/, char const* str2 /*=NULL*/, char const* str3 /*=NULL*/) +void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 /*=nullptr*/, char const* str2 /*=nullptr*/, char const* str3 /*=nullptr*/) { uint8 strCount = !str1 ? 0 : (!str2 ? 1 : (!str3 ? 2 : 3)); diff --git a/src/game/Guild/Guild.h b/src/game/Guild/Guild.h index d907a8c97..466b80874 100644 --- a/src/game/Guild/Guild.h +++ b/src/game/Guild/Guild.h @@ -262,14 +262,14 @@ class Guild void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId); void BroadcastPacket(WorldPacket *packet); - void BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL); - void BroadcastEvent(GuildEvents event, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL) + void BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 = nullptr, char const* str2 = nullptr, char const* str3 = nullptr); + void BroadcastEvent(GuildEvents event, char const* str1 = nullptr, char const* str2 = nullptr, char const* str3 = nullptr) { BroadcastEvent(event, ObjectGuid(), str1, str2, str3); } template - void BroadcastWorker(Do& _do, Player* except = NULL) + void BroadcastWorker(Do& _do, Player* except = nullptr) { for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) if(Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first))) @@ -299,7 +299,7 @@ class Guild MemberSlot* GetMemberSlot(ObjectGuid guid) { MemberList::iterator itr = members.find(guid.GetCounter()); - return itr != members.end() ? &itr->second : NULL; + return itr != members.end() ? &itr->second : nullptr; } MemberSlot* GetMemberSlot(const std::string& name) @@ -308,10 +308,10 @@ class Guild if(itr->second.Name == name) return &itr->second; - return NULL; + return nullptr; } - void Roster(WorldSession *session = NULL); // NULL = broadcast + void Roster(WorldSession *session = nullptr); // nullptr = broadcast void Query(WorldSession *session); // Guild EventLog diff --git a/src/game/Guild/GuildMgr.cpp b/src/game/Guild/GuildMgr.cpp index d9f28e75b..818070411 100644 --- a/src/game/Guild/GuildMgr.cpp +++ b/src/game/Guild/GuildMgr.cpp @@ -68,7 +68,7 @@ Guild* GuildMgr::GetGuildById(uint32 guildId) const if (itr != m_GuildMap.end()) return itr->second; - return NULL; + return nullptr; } Guild* GuildMgr::GetGuildByName(std::string const& name) const @@ -78,7 +78,7 @@ Guild* GuildMgr::GetGuildByName(std::string const& name) const if (itr->second->GetName() == name) return itr->second; - return NULL; + return nullptr; } Guild* GuildMgr::GetGuildByLeader(ObjectGuid const& guid) const @@ -88,7 +88,7 @@ Guild* GuildMgr::GetGuildByLeader(ObjectGuid const& guid) const if (itr->second->GetLeaderGuid() == guid) return itr->second; - return NULL; + return nullptr; } std::string GuildMgr::GetGuildNameById(uint32 guildId) const diff --git a/src/game/Guild/GuildMgr.h b/src/game/Guild/GuildMgr.h index a920eded0..43221e8f6 100644 --- a/src/game/Guild/GuildMgr.h +++ b/src/game/Guild/GuildMgr.h @@ -61,7 +61,7 @@ class GuildMgr std::map::iterator it = m_guid2guild.find(lowguid); if (it != m_guid2guild.end()) return GetGuildById(it->second); - return NULL; + return nullptr; } void CreatePetition(uint32 id, Player* player, const ObjectGuid& charterGuid, std::string& name); diff --git a/src/game/Handlers/AuctionHouseHandler.cpp b/src/game/Handlers/AuctionHouseHandler.cpp index f245b3206..a300bb7a3 100644 --- a/src/game/Handlers/AuctionHouseHandler.cpp +++ b/src/game/Handlers/AuctionHouseHandler.cpp @@ -209,7 +209,7 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction) AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(ObjectGuid guid) { - Unit* auctioneer = NULL; + Unit* auctioneer = nullptr; // GM case if (guid == GetPlayer()->GetObjectGuid()) @@ -219,7 +219,7 @@ AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(Objec if (GetPlayer()->GetAuctionAccessMode() == 0 && !ChatHandler(GetPlayer()).FindCommand("auction")) { DEBUG_LOG("%s attempt open auction in cheating way.", guid.GetString().c_str()); - return NULL; + return nullptr; } auctioneer = GetPlayer(); @@ -231,7 +231,7 @@ AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(Objec if (!auctioneer) { DEBUG_LOG("Auctioneeer %s accessed in cheating way.", guid.GetString().c_str()); - return NULL; + return nullptr; } } @@ -285,7 +285,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (!!limit && auctionHouse->GetAccountAuctionCount(GetAccountId()) >= limit) { ChatHandler(this).SendSysMessage("You have reached the limit of active auctions on your account."); - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_DATABASE); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_DATABASE); return; } @@ -318,33 +318,33 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (sAuctionMgr.GetAItem(itemGuid.GetCounter())) { sLog.outError("AuctionError, %s is sending %s, but item is already in another auction", pl->GetGuidStr().c_str(), itemGuid.GetString().c_str()); - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } // prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to auction) if (!it) { - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } // prevent selling item in bank slot if (_player->IsBankPos(it->GetPos())) { - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } if (!it->CanBeTraded()) { - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } if ((it->GetProto()->Flags & ITEM_FLAG_CONJURED) || it->GetUInt32Value(ITEM_FIELD_DURATION)) { - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } @@ -353,7 +353,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (pl->GetMoney() < deposit) { - SendAuctionCommandResult(NULL, AUCTION_STARTED, AUCTION_ERR_NOT_ENOUGH_MONEY); + SendAuctionCommandResult(nullptr, AUCTION_STARTED, AUCTION_ERR_NOT_ENOUGH_MONEY); return; } @@ -378,8 +378,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->bid = 0; AH->buyout = buyout; AH->lockedIpAddress = GetRemoteAddress().c_str(); - AH->depositTime = time(NULL); - AH->expireTime = time(NULL) + auction_time; + AH->depositTime = time(nullptr); + AH->expireTime = time(nullptr) + auction_time; AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; @@ -467,7 +467,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) if (!auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid) == pl->GetSession()->GetAccountId()) { // you cannot bid your another character auction: - SendAuctionCommandResult(NULL, AUCTION_BID_PLACED, AUCTION_ERR_BID_OWN); + SendAuctionCommandResult(nullptr, AUCTION_BID_PLACED, AUCTION_ERR_BID_OWN); return; } @@ -613,15 +613,15 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) else { sLog.outError("Auction id: %u has nonexistent item (item guid : %u)!!!", auction->Id, auction->itemGuidLow); - SendAuctionCommandResult(NULL, AUCTION_REMOVED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); + SendAuctionCommandResult(nullptr, AUCTION_REMOVED, AUCTION_ERR_INVENTORY, EQUIP_ERR_ITEM_NOT_FOUND); return; } } else { - SendAuctionCommandResult(NULL, AUCTION_REMOVED, AUCTION_ERR_DATABASE); + SendAuctionCommandResult(nullptr, AUCTION_REMOVED, AUCTION_ERR_DATABASE); // this code isn't possible ... maybe there should be ASSERT - sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId); + sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is nullptr", pl->GetGUIDLow(), auctionId); return; } diff --git a/src/game/Handlers/BattleGroundHandler.cpp b/src/game/Handlers/BattleGroundHandler.cpp index 94dcffd87..6c6df775b 100644 --- a/src/game/Handlers/BattleGroundHandler.cpp +++ b/src/game/Handlers/BattleGroundHandler.cpp @@ -236,7 +236,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) DEBUG_LOG("Battleground: the following players are joining as group:"); GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bgBracketId, isPremade, &excludedMembers); uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bgBracketId); - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *member = itr->getSource(); if (!member) continue; // this should never happen @@ -543,7 +543,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) WorldPacket data; // we must update all queues here - BattleGround *bg = NULL; + BattleGround *bg = nullptr; for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index bf369d4fb..54fd8a869 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -423,7 +423,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data) ObjectGuid playerGuid; recv_data >> playerGuid; - if (PlayerLoading() || GetPlayer() != NULL) + if (PlayerLoading() || GetPlayer() != nullptr) { sLog.outError("Player tryes to login again, AccountId = %d", GetAccountId()); return; @@ -486,7 +486,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) m_playerLoading = false; return; } - pCurrChar->GetSession()->SetPlayer(NULL); + pCurrChar->GetSession()->SetPlayer(nullptr); pCurrChar->SetSession(this); // Need to attach packet bcaster to the new socket pCurrChar->m_broadcaster->ChangeSocket(GetSocket()); @@ -530,7 +530,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) SetPlayer(pCurrChar); if (pCurrMasterPlayer) { - pCurrMasterPlayer->GetSession()->SetMasterPlayer(NULL); + pCurrMasterPlayer->GetSession()->SetMasterPlayer(nullptr); pCurrMasterPlayer->SetSession(this); m_masterPlayer = pCurrMasterPlayer; } @@ -878,7 +878,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) // and that there is no character with the desired new name CharacterDatabase.AsyncPQuery(&WorldSession::HandleChangePlayerNameOpcodeCallBack, GetAccountId(), newname, - "SELECT guid, name FROM characters WHERE guid = %u AND account = %u AND (at_login & %u) = %u AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')", + "SELECT guid, name FROM characters WHERE guid = %u AND account = %u AND (at_login & %u) = %u AND NOT EXISTS (SELECT nullptr FROM characters WHERE name = '%s')", guid.GetCounter(), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str() ); } diff --git a/src/game/Handlers/ChatHandler.cpp b/src/game/Handlers/ChatHandler.cpp index aab205f08..31544a9e1 100644 --- a/src/game/Handlers/ChatHandler.cpp +++ b/src/game/Handlers/ChatHandler.cpp @@ -115,7 +115,7 @@ uint32_t WorldSession::ChatCooldown() if (cooldown && cooldownMaxLvl > playerLevel) { - const auto currTime = time(NULL); + const auto currTime = time(nullptr); const auto delta = currTime - GetLastPubChanMsgTime(); if (cooldownScaling) @@ -339,7 +339,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } chn->Say(playerPointer->GetObjectGuid(), msg.c_str(), lang); - SetLastPubChanMsgTime(time(NULL)); + SetLastPubChanMsgTime(time(nullptr)); if (lang != LANG_ADDON && chn->HasFlag(Channel::ChannelFlags::CHANNEL_FLAG_GENERAL)) if (AntispamInterface *a = sAnticheatLib->GetAntispam()) @@ -352,7 +352,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (lang != LANG_ADDON) { normalizePlayerName(channel); - sWorld.LogChat(this, "Chan", msg, NULL, 0, channel.c_str()); + sWorld.LogChat(this, "Chan", msg, nullptr, 0, channel.c_str()); } } break; @@ -509,7 +509,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), _player->GetChatTag(), _player->GetObjectGuid(), _player->GetName()); group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetObjectGuid())); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Group", msg, NULL, group->GetId()); + sWorld.LogChat(this, "Group", msg, nullptr, group->GetId()); } break; case CHAT_MSG_GUILD: // Master side @@ -520,7 +520,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Guild", msg, NULL, GetMasterPlayer()->GetGuildId()); + sWorld.LogChat(this, "Guild", msg, nullptr, GetMasterPlayer()->GetGuildId()); break; } case CHAT_MSG_OFFICER: // Master side @@ -531,7 +531,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Officer", msg, NULL, GetMasterPlayer()->GetGuildId()); + sWorld.LogChat(this, "Officer", msg, nullptr, GetMasterPlayer()->GetGuildId()); break; } case CHAT_MSG_RAID: // Master side: TODO @@ -550,7 +550,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) group->BroadcastPacket(&data, false); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Raid", msg, NULL, group->GetId()); + sWorld.LogChat(this, "Raid", msg, nullptr, group->GetId()); } break; case CHAT_MSG_RAID_LEADER: // Master side: TODO @@ -568,7 +568,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, msg.c_str(), Language(lang), _player->GetChatTag(), _player->GetObjectGuid(), _player->GetName()); group->BroadcastPacket(&data, false); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Raid", msg, NULL, group->GetId()); + sWorld.LogChat(this, "Raid", msg, nullptr, group->GetId()); } break; @@ -585,7 +585,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) group->BroadcastPacket(&data, false); if (lang != LANG_ADDON) - sWorld.LogChat(this, "Raid", msg, NULL, group->GetId()); + sWorld.LogChat(this, "Raid", msg, nullptr, group->GetId()); } break; @@ -602,7 +602,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) group->BroadcastPacket(&data, false); if (lang != LANG_ADDON) - sWorld.LogChat(this, "BG", msg, NULL, group->GetId()); + sWorld.LogChat(this, "BG", msg, nullptr, group->GetId()); } break; @@ -619,7 +619,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) group->BroadcastPacket(&data, false); if (lang != LANG_ADDON) - sWorld.LogChat(this, "BG", msg, NULL, group->GetId()); + sWorld.LogChat(this, "BG", msg, nullptr, group->GetId()); } break; @@ -675,7 +675,7 @@ void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data) if (!GetPlayer()->CanSpeak()) { - std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); + std::string timeStr = secsToTimeString(m_muteTime - time(nullptr)); SendNotification(GetMangosString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); return; } @@ -700,7 +700,7 @@ public: void operator()(WorldPacket& data, int32 loc_idx) { - char const* nam = i_target ? i_target->GetNameForLocaleIdx(loc_idx) : NULL; + char const* nam = i_target ? i_target->GetNameForLocaleIdx(loc_idx) : nullptr; uint32 namlen = (nam ? strlen(nam) : 0) + 1; data.Initialize(SMSG_TEXT_EMOTE, (20 + namlen)); @@ -729,7 +729,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) if (!GetPlayer()->CanSpeak()) { - std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); + std::string timeStr = secsToTimeString(m_muteTime - time(nullptr)); SendNotification(GetMangosString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); return; } diff --git a/src/game/Handlers/CombatHandler.cpp b/src/game/Handlers/CombatHandler.cpp index 4d2aa6900..cca533995 100644 --- a/src/game/Handlers/CombatHandler.cpp +++ b/src/game/Handlers/CombatHandler.cpp @@ -42,7 +42,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data) if (!pEnemy) { // stop attack state at client - SendAttackStop(NULL); + SendAttackStop(nullptr); return; } diff --git a/src/game/Handlers/DuelHandler.cpp b/src/game/Handlers/DuelHandler.cpp index 940ddf6e3..3b3f9fcd6 100644 --- a/src/game/Handlers/DuelHandler.cpp +++ b/src/game/Handlers/DuelHandler.cpp @@ -45,7 +45,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName()); DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); - time_t now = time(NULL); + time_t now = time(nullptr); pl->duel->startTimer = now; plTarget->duel->startTimer = now; diff --git a/src/game/Handlers/GMTicketHandler.cpp b/src/game/Handlers/GMTicketHandler.cpp index 406eb29dd..743b30af0 100644 --- a/src/game/Handlers/GMTicketHandler.cpp +++ b/src/game/Handlers/GMTicketHandler.cpp @@ -42,7 +42,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/) sTicketMgr->SendTicket(this, ticket); } else - sTicketMgr->SendTicket(this, NULL); + sTicketMgr->SendTicket(this, nullptr); } void WorldSession::HandleGMTicketUpdateTextOpcode(WorldPacket & recv_data) @@ -86,7 +86,7 @@ void WorldSession::HandleGMTicketDeleteTicketOpcode(WorldPacket & /*recv_data*/) sWorld.SendGMTicketText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->GetId()); sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID()); - sTicketMgr->SendTicket(this, NULL); + sTicketMgr->SendTicket(this, nullptr); } } diff --git a/src/game/Handlers/GuildHandler.cpp b/src/game/Handlers/GuildHandler.cpp index aea1312f2..ecbaa33d8 100644 --- a/src/game/Handlers/GuildHandler.cpp +++ b/src/game/Handlers/GuildHandler.cpp @@ -72,7 +72,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) DEBUG_LOG("WORLD: Received CMSG_GUILD_INVITE"); std::string Invitedname, plname; - Player * player = NULL; + Player * player = nullptr; recvPacket >> Invitedname; diff --git a/src/game/Handlers/ItemHandler.cpp b/src/game/Handlers/ItemHandler.cpp index f85bfe0dc..0ca953b4c 100644 --- a/src/game/Handlers/ItemHandler.cpp +++ b/src/game/Handlers/ItemHandler.cpp @@ -50,13 +50,13 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data) if (!_player->IsValidPos(srcbag, srcslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } if (!_player->IsValidPos(dstbag, dstslot, false)) // can be autostore pos { - _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr); return; } @@ -77,13 +77,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recv_data) if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr); return; } @@ -135,13 +135,13 @@ void WorldSession::HandleSwapItem(WorldPacket & recv_data) if (!_player->IsValidPos(srcbag, srcslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } if (!_player->IsValidPos(dstbag, dstslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr); return; } @@ -170,7 +170,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) InventoryResult msg = _player->CanEquipItem(NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag()); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pSrcItem, NULL); + _player->SendEquipError(msg, pSrcItem, nullptr); return; } @@ -193,7 +193,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) msg = _player->CanUnequipItem(dest, !pSrcItem->IsBag()); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pDstItem, NULL); + _player->SendEquipError(msg, pDstItem, nullptr); return; } @@ -264,7 +264,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) InventoryResult msg = _player->CanUnequipItem(pos, false); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, _player->GetItemByPos(pos), NULL); + _player->SendEquipError(msg, _player->GetItemByPos(pos), nullptr); return; } } @@ -272,14 +272,14 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) Item *pItem = _player->GetItemByPos(bag, slot); if (!pItem) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } // checked at client side and not have server side appropriate error output if (pItem->GetProto()->Flags & ITEM_FLAG_INDESTRUCTIBLE) { - _player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, nullptr, nullptr); return; } @@ -476,13 +476,13 @@ void WorldSession::HandleReadItemOpcode(WorldPacket & recv_data) data << ObjectGuid(pItem->GetObjectGuid()); data << uint8(0); // 0..2, read failure reason? if == 1, use next command DETAIL_LOG("STORAGE: Unable to read item"); - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); } data << ObjectGuid(pItem->GetObjectGuid()); SendPacket(&data); } else - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); } void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recv_data) @@ -653,7 +653,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) if (!pCreature) { DEBUG_LOG("WORLD: HandleBuybackItem - %s not found or you can't interact with him.", vendorGuid.GetString().c_str()); - _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid(), 0); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid(), 0); return; } @@ -681,7 +681,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) _player->StoreItem(dest, pItem, true); } else - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } else @@ -760,7 +760,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid, uint8 menu_type) if (!pCreature) { DEBUG_LOG("WORLD: SendListInventory - %s not found or you can't interact with him.", vendorguid.GetString().c_str()); - _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid(), 0); + _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid(), 0); return; } @@ -863,7 +863,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos { - _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr); return; } @@ -882,7 +882,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos(src)); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } } @@ -891,7 +891,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } @@ -899,7 +899,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) if (dest.size() == 1 && dest[0].pos == src) { // just remove gray item state - _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + _player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); return; } @@ -997,7 +997,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } @@ -1005,7 +1005,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) if (dest.size() == 1 && dest[0].pos == pItem->GetPos()) { // just remove gray item state - _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + _player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); return; } @@ -1034,7 +1034,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } @@ -1049,7 +1049,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } @@ -1062,7 +1062,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) { if (!GetPlayer()->isAlive()) { - GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); + GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, nullptr, nullptr); return; } @@ -1075,7 +1075,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) { if (!_player->GetItemCount(item)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } @@ -1155,14 +1155,14 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) Item *gift = _player->GetItemByPos(gift_bag, gift_slot); if (!gift) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr); return; } // cheating: non-wrapper wrapper (all empty wrappers is stackable) if (!(gift->GetProto()->Flags & ITEM_FLAG_WRAPPER) || gift->GetMaxStackCount() == 1) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr); return; } @@ -1170,50 +1170,50 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) if (!item) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr); return; } if (item == gift) // not possible with packet from real client { - _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr); return; } if (item->IsEquipped()) { - _player->SendEquipError(EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, nullptr); return; } if (item->GetGuidValue(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED); { - _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr); return; } if (item->IsBag()) { - _player->SendEquipError(EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, nullptr); return; } if (item->IsSoulBound()) { - _player->SendEquipError(EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, nullptr); return; } if (item->GetMaxStackCount() != 1) { - _player->SendEquipError(EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, nullptr); return; } // maybe not correct check (it is better than nothing) if (item->GetProto()->MaxCount > 0) { - _player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, nullptr); return; } @@ -1221,7 +1221,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) // items multiple times by wrapping them during use if (_player->IsNonMeleeSpellCasted(true, false, false)) { - _player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); + _player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); return; } diff --git a/src/game/Handlers/LootHandler.cpp b/src/game/Handlers/LootHandler.cpp index 314a581de..343e9f1c1 100644 --- a/src/game/Handlers/LootHandler.cpp +++ b/src/game/Handlers/LootHandler.cpp @@ -43,7 +43,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) ObjectGuid lguid = player->GetLootGuid(); Loot *loot; uint8 lootSlot; - Item* pItem = NULL; + Item* pItem = nullptr; recv_data >> lootSlot; @@ -109,15 +109,15 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) } } - QuestItem *qitem = NULL; - QuestItem *ffaitem = NULL; - QuestItem *conditem = NULL; + QuestItem *qitem = nullptr; + QuestItem *ffaitem = nullptr; + QuestItem *conditem = nullptr; LootItem *item = loot->LootItemInSlot(lootSlot, player->GetGUIDLow(), &qitem, &ffaitem, &conditem); if (!item) { - player->SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, NULL); + player->SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr); return; } @@ -184,7 +184,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) player->OnReceivedItem(newitem); } else - player->SendEquipError(msg, NULL, NULL, item->itemid); + player->SendEquipError(msg, nullptr, nullptr, item->itemid); } void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) @@ -198,8 +198,8 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) if (!guid) return; - Loot *pLoot = NULL; - Item* pItem = NULL; + Loot *pLoot = nullptr; + Item* pItem = nullptr; bool shareMoneyWithGroup = true; switch (guid.GetHigh()) @@ -259,7 +259,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) Group *group = player->GetGroup(); std::vector playersNear; - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* playerGroup = itr->getSource(); if (!playerGroup) @@ -507,7 +507,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) if (group->GetLootMethod() != MASTER_LOOT) { loot->roundRobinPlayer = 0; - group->SendLooter(creature, NULL); + group->SendLooter(creature, nullptr); // force update of dynamic flags, otherwise other group's players still not able to loot. creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS); @@ -557,7 +557,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (_player->GetLootGuid() != lootguid) return; - Loot *pLoot = NULL; + Loot *pLoot = nullptr; if (lootguid.IsCreature()) { @@ -594,10 +594,10 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); if (msg != EQUIP_ERR_OK) { - target->SendEquipError(msg, NULL, NULL, item.itemid); + target->SendEquipError(msg, nullptr, nullptr, item.itemid); // send duplicate of error massage to master looter - _player->SendEquipError(msg, NULL, NULL, item.itemid); + _player->SendEquipError(msg, nullptr, nullptr, item.itemid); return; } diff --git a/src/game/Handlers/MailHandler.cpp b/src/game/Handlers/MailHandler.cpp index fc57fe085..a85c5238c 100644 --- a/src/game/Handlers/MailHandler.cpp +++ b/src/game/Handlers/MailHandler.cpp @@ -55,7 +55,7 @@ bool WorldSession::CheckMailBox(ObjectGuid guid) class WorldSession::AsyncMailSendRequest { public: - AsyncMailSendRequest(): rcTeam(TEAM_NONE), mailsCount(0xFF), receiverPtr(NULL), accountId(0), money(0), COD(0) {} + AsyncMailSendRequest(): rcTeam(TEAM_NONE), mailsCount(0xFF), receiverPtr(nullptr), accountId(0), money(0), COD(0) {} uint32 accountId; ObjectGuid senderGuid; ObjectGuid receiver; @@ -205,7 +205,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) ASSERT(receiverMasterPlayer); req->rcTeam = receiverMasterPlayer->GetTeam(); req->mailsCount = receiverMasterPlayer->GetMailSize(); - req->Callback(NULL); + req->Callback(nullptr); } else { @@ -253,7 +253,7 @@ void WorldSession::HandleSendMailCallback(WorldSession::AsyncMailSendRequest* re uint32 rc_account = sObjectMgr.GetPlayerAccountIdByGUID(req->receiver); - Item* item = NULL; + Item* item = nullptr; if (req->itemGuid) { @@ -432,7 +432,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data) pl->MarkMailsUpdated(); m->state = MAIL_STATE_CHANGED; - time_t time_now = time(NULL); + time_t time_now = time(nullptr); if ((m->expire_time - time_now) > (3 * DAY)) m->expire_time = time_now + (3 * DAY); } @@ -499,7 +499,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data) MasterPlayer *pl = GetMasterPlayer(); ASSERT(pl); Mail *m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr)) { pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR); return; @@ -561,7 +561,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) ASSERT(pl); Mail* m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr)) { pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -692,7 +692,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data) ASSERT(pl); Mail* m = pl->GetMail(mailId); - if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) + if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr)) { pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -735,7 +735,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size data << uint8(0); // mail's count - time_t cur_time = time(NULL); + time_t cur_time = time(nullptr); for (PlayerMails::iterator itr = pl->GetMailBegin(); itr != pl->GetMailEnd(); ++itr) { @@ -777,7 +777,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) data << uint32((*itr)->stationery); // stationery (Stationery.dbc) // 1.12.1 can have only single item - Item *item = (*itr)->items.size() > 0 ? pl->GetMItem((*itr)->items[0].item_guid) : NULL; + Item *item = (*itr)->items.size() > 0 ? pl->GetMItem((*itr)->items[0].item_guid) : nullptr; if (item) { @@ -798,7 +798,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) data << uint32((*itr)->money); // copper data << uint32((*itr)->COD); // Cash on delivery data << uint32((*itr)->checked); // flags - data << float(float((*itr)->expire_time - time(NULL)) / float(DAY));// Time + data << float(float((*itr)->expire_time - time(nullptr)) / float(DAY));// Time #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc) @@ -866,7 +866,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) Player* loadedPlayer = _player; Mail* m = pl->GetMail(mailId); - if (!m || (!m->itemTextId && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL) || m->checked & MAIL_CHECK_MASK_COPIED) + if (!m || (!m->itemTextId && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || m->checked & MAIL_CHECK_MASK_COPIED) { pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR); return; @@ -919,7 +919,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /**recv_data*/) data << uint32(0); // count uint32 count = 0; - time_t now = time(NULL); + time_t now = time(nullptr); for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr) { Mail *m = (*itr); diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp index 4c92e461d..4a1916b62 100644 --- a/src/game/Handlers/MiscHandler.cpp +++ b/src/game/Handlers/MiscHandler.cpp @@ -366,7 +366,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) data << uint32(0); data << uint8(0); SendPacket(&data); - LogoutRequest(time(NULL)); + LogoutRequest(time(nullptr)); } void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/) @@ -481,7 +481,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data) { if (!unit || unit == _player) { - pSpell->m_targets.setUnitTarget(NULL); + pSpell->m_targets.setUnitTarget(nullptr); pSpell->cancel(); return; } @@ -696,7 +696,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) return; // prevent resurrect before 30-sec delay after body release not finished - if (corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP) > time(NULL)) + if (corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP) > time(nullptr)) return; if (!corpse->IsWithinDistInMap(GetPlayer(), CORPSE_RECLAIM_RADIUS, true)) @@ -829,7 +829,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) return; } - // NULL if all values default (non teleport trigger) + // nullptr if all values default (non teleport trigger) AreaTriggerTeleport const* at = sObjectMgr.GetAreaTriggerTeleport(Trigger_ID); if (!at) return; diff --git a/src/game/Handlers/MovementHandler.cpp b/src/game/Handlers/MovementHandler.cpp index 6e7fc3524..3389fb8a3 100644 --- a/src/game/Handlers/MovementHandler.cpp +++ b/src/game/Handlers/MovementHandler.cpp @@ -239,7 +239,7 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recvData) DEBUG_LOG("Counter %u, time %u", counter, time / IN_MILLISECONDS); Unit *pMover = _player->GetMover(); - Player *pPlayerMover = pMover->GetTypeId() == TYPEID_PLAYER ? (Player*)pMover : NULL; + Player *pPlayerMover = pMover->GetTypeId() == TYPEID_PLAYER ? (Player*)pMover : nullptr; if (!pPlayerMover || !pPlayerMover->IsBeingTeleportedNear()) return; diff --git a/src/game/Handlers/NPCHandler.cpp b/src/game/Handlers/NPCHandler.cpp index 28d5ffa28..3598adaf0 100644 --- a/src/game/Handlers/NPCHandler.cpp +++ b/src/game/Handlers/NPCHandler.cpp @@ -301,7 +301,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data) } // Try to find the spell in npc_trainer. - TrainerSpell const* trainer_spell = cSpells ? cSpells->Find(spellId) : NULL; + TrainerSpell const* trainer_spell = cSpells ? cSpells->Find(spellId) : nullptr; // Not found, try find it in npc_trainer_template. if (!trainer_spell && tSpells) @@ -426,7 +426,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) pCreature->StopMoving(); - if (!sScriptMgr.OnGossipSelect(_player, pCreature, sender, action, code.empty() ? NULL : code.c_str())) + if (!sScriptMgr.OnGossipSelect(_player, pCreature, sender, action, code.empty() ? nullptr : code.c_str())) _player->OnGossipSelect(pCreature, gossipListId); } else if (guid.IsGameObject()) @@ -439,7 +439,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) return; } - if (!sScriptMgr.OnGossipSelect(_player, pGo, sender, action, code.empty() ? NULL : code.c_str())) + if (!sScriptMgr.OnGossipSelect(_player, pGo, sender, action, code.empty() ? nullptr : code.c_str())) _player->OnGossipSelect(pGo, gossipListId); } } @@ -471,7 +471,7 @@ void WorldSession::SendSpiritResurrect() _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard - WorldSafeLocsEntry const *corpseGrave = NULL; + WorldSafeLocsEntry const *corpseGrave = nullptr; Corpse *corpse = _player->GetCorpse(); if (corpse) corpseGrave = sObjectMgr.GetClosestGraveYard( @@ -741,7 +741,7 @@ void WorldSession::HandleUnstablePet(WorldPacket & recv_data) if (!newpet->LoadPetFromDB(_player, creature_id, petnumber)) { delete newpet; - newpet = NULL; + newpet = nullptr; SendStableResult(STABLE_ERR_STABLE); return; } diff --git a/src/game/Handlers/PetHandler.cpp b/src/game/Handlers/PetHandler.cpp index 95223ed8d..ebf544055 100644 --- a/src/game/Handlers/PetHandler.cpp +++ b/src/game/Handlers/PetHandler.cpp @@ -216,7 +216,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) case ACT_PASSIVE: // 0x01 case ACT_ENABLED: // 0xC1 spell { - Unit* unit_target = NULL; + Unit* unit_target = nullptr; if (targetGuid) unit_target = _player->GetMap()->GetUnit(targetGuid); @@ -527,7 +527,7 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data) CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); CharacterDatabase.CommitTransaction(); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); } void WorldSession::HandlePetAbandon(WorldPacket& recv_data) @@ -615,7 +615,7 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket) // relearn pet passives pet->LearnPetPassives(); - pet->m_resetTalentsTime = time(NULL); + pet->m_resetTalentsTime = time(nullptr); pet->m_resetTalentsCost = cost; GetPlayer()->ModifyMoney(-(int32)cost); @@ -700,7 +700,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) Spell *spell = new Spell(pet, spellInfo, false); spell->m_targets = targets; - SpellCastResult result = spell->CheckPetCast(NULL); + SpellCastResult result = spell->CheckPetCast(nullptr); if (result == SPELL_CAST_OK) { if (pet->IsPet()) diff --git a/src/game/Handlers/PetitionsHandler.cpp b/src/game/Handlers/PetitionsHandler.cpp index 08baff070..7c768444d 100644 --- a/src/game/Handlers/PetitionsHandler.cpp +++ b/src/game/Handlers/PetitionsHandler.cpp @@ -120,7 +120,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(charterid); if (!pProto) { - _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0); + _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, charterid, 0); return; } @@ -135,7 +135,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) InventoryResult msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, NULL, NULL, charterid); + _player->SendEquipError(msg, nullptr, nullptr, charterid); return; } diff --git a/src/game/Handlers/QueryHandler.cpp b/src/game/Handlers/QueryHandler.cpp index 7cf5663b2..680b4d063 100644 --- a/src/game/Handlers/QueryHandler.cpp +++ b/src/game/Handlers/QueryHandler.cpp @@ -165,7 +165,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid); - //if (unit == NULL) + //if (unit == nullptr) // sLog.outDebug( "WORLD: HandleCreatureQueryOpcode - (%u) NO SUCH UNIT! (GUID: %u, ENTRY: %u)", uint32(GUID_LOPART(guid)), guid, entry ); CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry); @@ -465,6 +465,6 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) void WorldSession::SendQueryTimeResponse() { WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4); - data << uint32(time(NULL)); + data << uint32(time(nullptr)); SendPacket(&data); } diff --git a/src/game/Handlers/QuestHandler.cpp b/src/game/Handlers/QuestHandler.cpp index bbc19081f..187a8bb5a 100644 --- a/src/game/Handlers/QuestHandler.cpp +++ b/src/game/Handlers/QuestHandler.cpp @@ -163,7 +163,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) { if (Group* pGroup = _player->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* pPlayer = itr->getSource(); @@ -385,7 +385,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data) return; if (_player->CanAddQuest(pQuest, true)) - _player->AddQuest(pQuest, NULL); // NULL, this prevent DB script from duplicate running + _player->AddQuest(pQuest, nullptr); // nullptr, this prevent DB script from duplicate running _player->ClearDividerGuid(); } @@ -429,7 +429,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) { if (Group* pGroup = _player->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pPlayer = itr->getSource(); diff --git a/src/game/Handlers/SpellHandler.cpp b/src/game/Handlers/SpellHandler.cpp index 9637a2e91..90e17092d 100644 --- a/src/game/Handlers/SpellHandler.cpp +++ b/src/game/Handlers/SpellHandler.cpp @@ -55,7 +55,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (!pItem) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } @@ -65,7 +65,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (!proto) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } @@ -73,7 +73,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } @@ -81,7 +81,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (msg != EQUIP_ERR_OK) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(msg, pItem, NULL); + pUser->SendEquipError(msg, pItem, nullptr); return; } @@ -89,7 +89,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (pItem->IsInTrade()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } @@ -102,7 +102,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (spellInfo->IsNonCombatSpell()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, nullptr); return; } } @@ -132,7 +132,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (!pItem->IsTargetValidForItemUse(targets.getUnitTarget())) { // free gray item after use fail - pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); // search spell for spell error uint32 spellid = 0; @@ -179,14 +179,14 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) Item *pItem = pUser->GetItemByPos(bagIndex, slot); if (!pItem) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr); return; } ItemPrototype const *proto = pItem->GetProto(); if (!proto) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } @@ -198,7 +198,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, nullptr); sLog.outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", pItem->GetGUIDLow() , lockId); return; } @@ -206,7 +206,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) // required picklocking if (lockInfo->Skill[1] || lockInfo->Skill[0]) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, nullptr); return; } } @@ -336,7 +336,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) return; } - // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message + // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) spellInfo = actualSpellInfo; } @@ -355,7 +355,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) _player->m_castingSpell = _player->GetComboPoints(); - Spell *spell = new Spell(_player, spellInfo, false, ObjectGuid(), NULL, targets.getUnitTarget()); + Spell *spell = new Spell(_player, spellInfo, false, ObjectGuid(), nullptr, targets.getUnitTarget()); // Nostalrius : Ivina spell->SetClientStarted(true); diff --git a/src/game/Handlers/TradeHandler.cpp b/src/game/Handlers/TradeHandler.cpp index 7cae044c2..15e8a8067 100644 --- a/src/game/Handlers/TradeHandler.cpp +++ b/src/game/Handlers/TradeHandler.cpp @@ -139,8 +139,8 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { ItemPosCountVec traderDst; ItemPosCountVec playerDst; - bool traderCanTrade = (myItems[i] == NULL || trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, myItems[i], false) == EQUIP_ERR_OK); - bool playerCanTrade = (hisItems[i] == NULL || _player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false) == EQUIP_ERR_OK); + bool traderCanTrade = (myItems[i] == nullptr || trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, myItems[i], false) == EQUIP_ERR_OK); + bool playerCanTrade = (hisItems[i] == nullptr || _player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, hisItems[i], false) == EQUIP_ERR_OK); if (traderCanTrade && playerCanTrade) { // Ok, if trade item exists and can be stored @@ -217,7 +217,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item **m if (Item* item = myTrade->GetItem(TradeSlots(i))) { DEBUG_LOG("player trade %s bag: %u slot: %u", item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot()); - //Can return NULL + //Can return nullptr myItems[i] = item; myItems[i]->SetInTrade(); } @@ -256,14 +256,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) TradeData* my_trade = _player->m_trade; if (!my_trade) return; - double lastModificationTimeInMS = difftime(time(NULL), my_trade->GetLastModificationTime()) * 1000; + double lastModificationTimeInMS = difftime(time(nullptr), my_trade->GetLastModificationTime()) * 1000; if (lastModificationTimeInMS < my_trade->GetScamPreventionDelay()) // if we are not outside the delay period since last modification { SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); return; } - my_trade->SetLastModificationTime(time(NULL)); // Update it + my_trade->SetLastModificationTime(time(nullptr)); // Update it Player* trader = my_trade->GetTrader(); @@ -271,8 +271,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) if (!his_trade) return; - Item *myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; - Item *hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; + Item *myItems[TRADE_SLOT_TRADED_COUNT] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; + Item *hisItems[TRADE_SLOT_TRADED_COUNT] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; bool myCanCompleteTrade = true, hisCanCompleteTrade = true; // set before checks to properly undo at problems (it already set in to client) @@ -333,10 +333,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) setAcceptTradeMode(my_trade, his_trade, myItems, hisItems); - Spell* my_spell = NULL; + Spell* my_spell = nullptr; SpellCastTargets my_targets; - Spell* his_spell = NULL; + Spell* his_spell = nullptr; SpellCastTargets his_targets; // not accept if spell can't be casted now (cheating) @@ -432,7 +432,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) trader->GetSession()->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS); my_trade->SetAccepted(false); his_trade->SetAccepted(false); - his_trade->SetLastModificationTime(time(NULL)); + his_trade->SetLastModificationTime(time(nullptr)); return; } else if (!hisCanCompleteTrade) @@ -443,7 +443,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) trader->GetSession()->SendNotification(LANG_NOT_FREE_TRADE_SLOTS); my_trade->SetAccepted(false); his_trade->SetAccepted(false); - his_trade->SetLastModificationTime(time(NULL)); + his_trade->SetLastModificationTime(time(nullptr)); return; } @@ -499,9 +499,9 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) // cleanup clearAcceptTradeMode(my_trade, his_trade); delete _player->m_trade; - _player->m_trade = NULL; + _player->m_trade = nullptr; delete trader->m_trade; - trader->m_trade = NULL; + trader->m_trade = nullptr; // desynchronized with the other saves here, let players save gold per their own serialized transaction _player->SaveInventoryAndGoldToDB(); @@ -667,8 +667,8 @@ void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket) // gold can be incorrect, but this is checked at trade finished. his_trade->SetAccepted(false); - his_trade->SetLastModificationTime(time(NULL)); - my_trade->SetLastModificationTime(time(NULL)); + his_trade->SetLastModificationTime(time(nullptr)); + my_trade->SetLastModificationTime(time(nullptr)); my_trade->SetMoney(gold); } @@ -721,8 +721,8 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) } his_trade->SetAccepted(false); - his_trade->SetLastModificationTime(time(NULL)); - my_trade->SetLastModificationTime(time(NULL)); + his_trade->SetLastModificationTime(time(nullptr)); + my_trade->SetLastModificationTime(time(nullptr)); my_trade->SetItem(TradeSlots(tradeSlot), item); } @@ -743,7 +743,7 @@ void WorldSession::HandleClearTradeItemOpcode(WorldPacket& recvPacket) return; his_trade->SetAccepted(false); - his_trade->SetLastModificationTime(time(NULL)); - my_trade->SetLastModificationTime(time(NULL)); - my_trade->SetItem(TradeSlots(tradeSlot), NULL); + his_trade->SetLastModificationTime(time(nullptr)); + my_trade->SetLastModificationTime(time(nullptr)); + my_trade->SetItem(TradeSlots(tradeSlot), nullptr); } diff --git a/src/game/HardcodedEvents.cpp b/src/game/HardcodedEvents.cpp index e6e795fad..b11c98dd5 100644 --- a/src/game/HardcodedEvents.cpp +++ b/src/game/HardcodedEvents.cpp @@ -578,7 +578,7 @@ void SilithusWarEffortBattle::Enable() float FinalZ = KalimdorMap->GetHeight(FinalX, FinalY, 0.0f, true, 100.0f); float FinalO = frand(0, M_PI_F * 2); - Creature* c = NULL; + Creature* c = nullptr; if (c = KalimdorMap->SummonCreature(14471, FinalX, FinalY, FinalZ, FinalO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { SummonedMobs.push_back(c); @@ -665,8 +665,8 @@ ScourgeInvasionEvent::ScourgeInvasionEvent() memset(&previousRemainingCounts[0], -1, sizeof(int) * 6); // At start up - sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(NULL)); - sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(NULL)); + sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(nullptr)); + sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(nullptr)); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_ZONE1, ZONEID_TANARIS); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_ZONE2, ZONEID_BLASTED_LANDS); @@ -829,7 +829,7 @@ void ScourgeInvasionEvent::Update() if (!invasion1Loaded || !invasion2Loaded) return; - time_t now = time(NULL); + time_t now = time(nullptr); bool attackStateChange = false; for (auto it = invasionPoints.begin(); it != invasionPoints.end(); ++it) @@ -918,8 +918,8 @@ void ScourgeInvasionEvent::Disable() } } - sObjectMgr.SetSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(NULL), true); - sObjectMgr.SetSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(NULL), true); + sObjectMgr.SetSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(nullptr), true); + sObjectMgr.SetSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(nullptr), true); sObjectMgr.SetSavedVariable(VARIABLE_SI_AZSHARA_REMAINING, 0, true); sObjectMgr.SetSavedVariable(VARIABLE_SI_BLASTED_LANDS_REMAINING, 0, true); @@ -998,7 +998,7 @@ bool ScourgeInvasionEvent::OnEnable(uint32 attackZoneVar, uint32 attackTimeVar) // chosen zone is unavailable the invasion will simply not be started, and a new attempt will be made next update void ScourgeInvasionEvent::StartNewInvasionIfTime(uint32 timeVariable, uint32 zoneVariable) { - time_t now = time(NULL); + time_t now = time(nullptr); // Not yet time if (now < sObjectMgr.GetSavedVariable(timeVariable)) return; diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 3f129506a..d49e8c076 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -67,7 +67,7 @@ private: LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance - LootStoreItem const * Roll(Loot const& loot) const; // Rolls an item from the group, returns NULL if all miss their chances + LootStoreItem const * Roll(Loot const& loot) const; // Rolls an item from the group, returns nullptr if all miss their chances bool hasConditionalEqualChancedItem; }; @@ -221,7 +221,7 @@ LootTemplate const* LootStore::GetLootFor(uint32 loot_id) const LootTemplateMap::const_iterator tab = m_LootTemplates.find(loot_id); if (tab == m_LootTemplates.end()) - return NULL; + return nullptr; return tab->second; } @@ -508,7 +508,7 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, { roundRobinPlayer = loot_owner->GetGUID(); _personal = false; - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* pl = itr->getSource()) { if (!looted || (pl->IsInWorld() && pl->IsAtGroupRewardDistance(looted))) @@ -563,7 +563,7 @@ void Loot::FillNotNormalLootFor(Player* pl) QuestItemList* Loot::FillFFALoot(Player* player) { if (!player->IsInWorld()) - return NULL; + return nullptr; QuestItemList *ql = new QuestItemList(); @@ -579,7 +579,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) if (ql->empty()) { delete ql; - return NULL; + return nullptr; } m_playerFFAItems[player->GetGUIDLow()] = ql; @@ -589,9 +589,9 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { if (!player->IsInWorld()) - return NULL; + return nullptr; - if (items.size() == MAX_NR_LOOT_ITEMS) return NULL; + if (items.size() == MAX_NR_LOOT_ITEMS) return nullptr; QuestItemList *ql = new QuestItemList(); for (uint8 i = 0; i < m_questItems.size(); ++i) @@ -617,7 +617,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) if (ql->empty()) { delete ql; - return NULL; + return nullptr; } m_playerQuestItems[player->GetGUIDLow()] = ql; @@ -627,7 +627,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player) { if (!player->IsInWorld()) - return NULL; + return nullptr; QuestItemList *ql = new QuestItemList(); @@ -647,7 +647,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player) if (ql->empty()) { delete ql; - return NULL; + return nullptr; } m_playerNonQuestNonFFAConditionalItems[player->GetGUIDLow()] = ql; @@ -736,7 +736,7 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) LootItem* Loot::LootItemInSlot(uint32 lootSlot, uint32 playerGuid, QuestItem **qitem, QuestItem **ffaitem, QuestItem **conditem) { - LootItem* item = NULL; + LootItem* item = nullptr; bool is_looted = true; if (lootSlot >= items.size()) { @@ -792,7 +792,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, uint32 playerGuid, QuestItem **q } if (is_looted) - return NULL; + return nullptr; return item; } @@ -1064,7 +1064,7 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item) } } -// Rolls an item from the group, returns NULL if all miss their chances +// Rolls an item from the group, returns nullptr if all miss their chances LootStoreItem const * LootTemplate::LootGroup::Roll(Loot const& loot) const { if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked @@ -1101,7 +1101,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll(Loot const& loot) const return &EqualChanced[indexesOk[urand(0, indexesOk.size() - 1)]]; } - return NULL; // Empty drop from the group + return nullptr; // Empty drop from the group } // True if group includes at least 1 quest drop entry @@ -1132,7 +1132,7 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const void LootTemplate::LootGroup::Process(Loot& loot) const { LootStoreItem const * item = Roll(loot); - if (item != NULL) + if (item != nullptr) loot.AddItem(*item); } diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 0b9a48337..ed15eecc4 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -170,7 +170,7 @@ class LootStore void Verify() const; void LoadAndCollectLootIds(LootIdSet& ids_set); - void CheckLootRefs(LootIdSet* ref_set = NULL) const;// check existence reference and remove it from ref_set + void CheckLootRefs(LootIdSet* ref_set = nullptr) const;// check existence reference and remove it from ref_set void ReportUnusedIds(LootIdSet const& ids_set) const; void ReportNotExistedId(uint32 id) const; @@ -238,9 +238,9 @@ class LootValidatorRefManager : public RefManager LootValidatorRef* getLast() { return (LootValidatorRef*)RefManager::getLast(); } iterator begin() { return iterator(getFirst()); } - iterator end() { return iterator(NULL); } + iterator end() { return iterator(nullptr); } iterator rbegin() { return iterator(getLast()); } - iterator rend() { return iterator(NULL); } + iterator rend() { return iterator(nullptr); } }; //===================================================== @@ -327,12 +327,12 @@ struct Loot void RemoveLooter(ObjectGuid guid) { m_playersLooting.erase(guid); } void generateMoneyLoot(uint32 minAmount, uint32 maxAmount); - bool FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError = false, WorldObject const* looted = NULL); + bool FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError = false, WorldObject const* looted = nullptr); // Inserts the item into the loot (called by LootTemplate processors) void AddItem(LootStoreItem const & item); - LootItem* LootItemInSlot(uint32 lootslot, uint32 playerGuid, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL); + LootItem* LootItemInSlot(uint32 lootslot, uint32 playerGuid, QuestItem** qitem = nullptr, QuestItem** ffaitem = nullptr, QuestItem** conditem = nullptr); uint32 GetMaxSlotInLootFor(uint32 playerGuid) const; WorldObject const* GetLootTarget() const { return m_lootTarget; } diff --git a/src/game/Mail/Mail.cpp b/src/game/Mail/Mail.cpp index 475a2ebb3..2682f00c4 100644 --- a/src/game/Mail/Mail.cpp +++ b/src/game/Mail/Mail.cpp @@ -166,7 +166,7 @@ bool MailDraft::prepareItems(Player* receiver) m_mailTemplateItemsNeed = false; - Loot mailLoot(NULL); + Loot mailLoot(nullptr); // can be empty mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver, true, true); @@ -295,7 +295,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid sender_guid, Ob */ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked, uint32 deliver_delay, uint32 expire_delay) { - Player* pReceiver = receiver.GetPlayer(); // can be NULL + Player* pReceiver = receiver.GetPlayer(); // can be nullptr MasterPlayer* masterReceiver = sObjectAccessor.FindMasterPlayer(receiver.GetPlayerGuid()); bool has_items = !m_items.empty(); @@ -309,7 +309,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende uint32 mailId = sObjectMgr.GenerateMailID(); - time_t deliver_time = time(NULL) + deliver_delay; + time_t deliver_time = time(nullptr) + deliver_delay; if (!expire_delay) { @@ -395,7 +395,7 @@ void Mail::prepareTemplateItems(Player* receiver) has_items = true; - Loot mailLoot(NULL); + Loot mailLoot(nullptr); // can be empty mailLoot.FillLoot(mailTemplateId, LootTemplates_Mail, receiver, true, true); diff --git a/src/game/Mail/Mail.h b/src/game/Mail/Mail.h index dcd9ff852..60fc48282 100644 --- a/src/game/Mail/Mail.h +++ b/src/game/Mail/Mail.h @@ -153,7 +153,7 @@ class MailSender class MailReceiver { public: // Constructors - explicit MailReceiver(ObjectGuid receiver_guid) : m_receiver(NULL), m_receiver_guid(receiver_guid) {} + explicit MailReceiver(ObjectGuid receiver_guid) : m_receiver(nullptr), m_receiver_guid(receiver_guid) {} MailReceiver(Player* receiver); MailReceiver(Player* receiver, ObjectGuid receiver_guid); public: // Accessors diff --git a/src/game/Mail/MassMailMgr.h b/src/game/Mail/MassMailMgr.h index cc294ca39..79fcc82df 100644 --- a/src/game/Mail/MassMailMgr.h +++ b/src/game/Mail/MassMailMgr.h @@ -114,7 +114,7 @@ class MassMailMgr { } - /// m_protoMail is owned by MassMail, so at copy original MassMail field set to NULL + /// m_protoMail is owned by MassMail, so at copy original MassMail field set to nullptr std::unique_ptr m_protoMail; MailSender m_sender; diff --git a/src/game/MapNodes/AbstractPlayer.cpp b/src/game/MapNodes/AbstractPlayer.cpp index 466db0e7e..c3bb495dc 100644 --- a/src/game/MapNodes/AbstractPlayer.cpp +++ b/src/game/MapNodes/AbstractPlayer.cpp @@ -38,16 +38,16 @@ template void PlayerWrapper::LeftChannel(Channel* c) { player.LeftChannel(c); } template -bool PlayerWrapper::ok() const { return (&player) != NULL; } +bool PlayerWrapper::ok() const { return (&player) != nullptr; } // Specializations template <> Player* PlayerWrapper::ToPlayer() const { return &player; } template <> -MasterPlayer* PlayerWrapper::ToMasterPlayer() const { return NULL; } +MasterPlayer* PlayerWrapper::ToMasterPlayer() const { return nullptr; } template <> -Player* PlayerWrapper::ToPlayer() const { return NULL; } +Player* PlayerWrapper::ToPlayer() const { return nullptr; } template <> MasterPlayer* PlayerWrapper::ToMasterPlayer() const { return &player; } diff --git a/src/game/MapNodes/AbstractPlayer.h b/src/game/MapNodes/AbstractPlayer.h index 1b1ef5581..84ca5ccdd 100644 --- a/src/game/MapNodes/AbstractPlayer.h +++ b/src/game/MapNodes/AbstractPlayer.h @@ -63,7 +63,7 @@ class PlayerWrapper final: public AbstractPlayer public: PlayerWrapper(T& pl) : player(pl) {} PlayerWrapper(T* pl) : player(*pl) {} - PlayerWrapper() : player(*((T*)NULL)) {} + PlayerWrapper() : player(*((T*)nullptr)) {} PlayerWrapper(PlayerWrapper const& other) : player(other.player) {} virtual ObjectGuid GetObjectGuid() const; diff --git a/src/game/MapNodes/Handlers/SessionTransfert.cpp b/src/game/MapNodes/Handlers/SessionTransfert.cpp index f314a745c..ae0bb791a 100644 --- a/src/game/MapNodes/Handlers/SessionTransfert.cpp +++ b/src/game/MapNodes/Handlers/SessionTransfert.cpp @@ -54,7 +54,7 @@ void NodeSession::HandleLoadSession(WorldPacket& pkt) PacketLoadSession_Header loadInfos; pkt.read((uint8*)&loadInfos, sizeof(loadInfos)); - WorldSession* wsess = new WorldSession(loadInfos.accountId, NULL, loadInfos.sec, loadInfos.muteTime, loadInfos.locale); + WorldSession* wsess = new WorldSession(loadInfos.accountId, nullptr, loadInfos.sec, loadInfos.muteTime, loadInfos.locale); wsess->SetAccountFlags(loadInfos.accountFlags); wsess->SetAccountMaxLevel(loadInfos.accountMaxLevel); wsess->SetMasterSession(this); @@ -167,7 +167,7 @@ void NodeSession::HandleSessionSocketClosed(WorldPacket& pkt) WorldSession* sess = sWorld.FindSession(accountId); if (!sess) return; - sess->SetMasterSession(NULL); // Will be disconnected after 120 seconds + sess->SetMasterSession(nullptr); // Will be disconnected after 120 seconds sess->ForcePlayerLogoutDelay(); } @@ -179,7 +179,7 @@ void NodeSession::HandleSessionLogoutComplete(WorldPacket& pkt) WorldSession* sess = sWorld.FindSession(accountId); if (!sess) return; - sess->SetNodeSession(NULL); + sess->SetNodeSession(nullptr); sess->LogoutPlayer(false); // Do not save the player, he was already saved on the Node } diff --git a/src/game/MapNodes/MapSocket.cpp b/src/game/MapNodes/MapSocket.cpp index aa2d07d53..8ea5329c8 100644 --- a/src/game/MapNodes/MapSocket.cpp +++ b/src/game/MapNodes/MapSocket.cpp @@ -45,7 +45,7 @@ int MapSocket::ProcessIncoming(WorldPacket* new_pct) { ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); - if (m_Session != NULL) + if (m_Session != nullptr) { // OK, give the packet to WorldSession aptr.release(); diff --git a/src/game/MapNodes/MasterPlayer.cpp b/src/game/MapNodes/MasterPlayer.cpp index 7b2550146..9bacf16f0 100644 --- a/src/game/MapNodes/MasterPlayer.cpp +++ b/src/game/MapNodes/MasterPlayer.cpp @@ -7,7 +7,7 @@ #include "ObjectAccessor.h" MasterPlayer::MasterPlayer(WorldSession* s): - m_session(s), m_social(NULL), m_mailsUpdated(false), + m_session(s), m_social(nullptr), m_mailsUpdated(false), m_speakTime(0), m_speakCount(0) { } @@ -64,7 +64,7 @@ void MasterPlayer::SaveToDB() void MasterPlayer::Update() { // undelivered mail - if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(NULL)) + if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(nullptr)) { SendNewMail(); ++unReadMails; @@ -201,7 +201,7 @@ void MasterPlayer::UpdateNextMailTimeAndUnreads() { // calculate next delivery time (min. from non-delivered mails // and recalculate unReadMail - time_t cTime = time(NULL); + time_t cTime = time(nullptr); m_nextMailDelivereTime = 0; unReadMails = 0; for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) @@ -218,7 +218,7 @@ void MasterPlayer::UpdateNextMailTimeAndUnreads() void MasterPlayer::AddNewMailDeliverTime(time_t deliver_time) { - if (deliver_time <= time(NULL)) // ready now + if (deliver_time <= time(nullptr)) // ready now { ++unReadMails; SendNewMail(); @@ -338,7 +338,7 @@ Mail* MasterPlayer::GetMail(uint32 id) if ((*itr)->messageID == id) return (*itr); } - return NULL; + return nullptr; } @@ -360,8 +360,8 @@ void MasterPlayer::SendInitialActionButtons() const ActionButton* MasterPlayer::addActionButton(uint8 button, uint32 action, uint8 type) { - if (!Player::IsActionButtonDataValid(button, action, type, NULL)) - return NULL; + if (!Player::IsActionButtonDataValid(button, action, type, nullptr)) + return nullptr; // it create new button (NEW state) if need or return existing ActionButton& ab = m_actionButtons[button]; diff --git a/src/game/MapNodes/MasterPlayer.h b/src/game/MapNodes/MasterPlayer.h index 53e4e96ce..38ab9139c 100644 --- a/src/game/MapNodes/MasterPlayer.h +++ b/src/game/MapNodes/MasterPlayer.h @@ -82,7 +82,7 @@ public: Item* GetMItem(uint32 id) { ItemMap::const_iterator itr = mMitems.find(id); - return itr != mMitems.end() ? itr->second : NULL; + return itr != mMitems.end() ? itr->second : nullptr; } void AddMItem(Item* it); diff --git a/src/game/MapNodes/MasterPlayerChat.cpp b/src/game/MapNodes/MasterPlayerChat.cpp index 245d328b5..e641238fc 100644 --- a/src/game/MapNodes/MasterPlayerChat.cpp +++ b/src/game/MapNodes/MasterPlayerChat.cpp @@ -13,7 +13,7 @@ void MasterPlayer::UpdateSpeakTime() if (GetSession()->GetSecurity() > SEC_PLAYER) return; - time_t current = time(NULL); + time_t current = time(nullptr); if (m_speakTime > current) { uint32 max_count = sWorld.getConfig(CONFIG_UINT32_CHATFLOOD_MESSAGE_COUNT); diff --git a/src/game/MapNodes/NodeSession.cpp b/src/game/MapNodes/NodeSession.cpp index ac74f593d..8964b6a5e 100644 --- a/src/game/MapNodes/NodeSession.cpp +++ b/src/game/MapNodes/NodeSession.cpp @@ -60,7 +60,7 @@ bool NodeSession::SafeUpdate(uint32 diff) if (m_socket && m_socket->IsClosed()) { m_socket->RemoveReference(); - m_socket = NULL; + m_socket = nullptr; return false; } @@ -134,7 +134,7 @@ void NodeSession::UnsafeUpdate(uint32 diff) void NodeSession::ProcessPacketsByType(uint32 type) { - WorldPacket* packet = NULL; + WorldPacket* packet = nullptr; while (m_socket && !m_socket->IsClosed() && m_recvQueue[type].next(packet)) ProcessPacket(packet); } diff --git a/src/game/MapNodes/NodesMgr.cpp b/src/game/MapNodes/NodesMgr.cpp index edd3ae384..2e2215207 100644 --- a/src/game/MapNodes/NodesMgr.cpp +++ b/src/game/MapNodes/NodesMgr.cpp @@ -62,7 +62,7 @@ bool NodesMgr::OnServerStartup() bool NodesMgr::TryConnectToMaster() { - MapSocket* s = NULL; + MapSocket* s = nullptr; if (sMapSocketMgr->Connect(m_masterListenPort, m_masterListenAddress, s) == -1) return false; @@ -105,6 +105,6 @@ NodeSession* NodesMgr::GetNodeById(uint32 id) { NodesMap::iterator it = m_nodes.find(id); if (it == m_nodes.end()) - return NULL; + return nullptr; return it->second; } diff --git a/src/game/MapNodes/NodesOpcodes.h b/src/game/MapNodes/NodesOpcodes.h index 6c21cc935..07c2482dd 100644 --- a/src/game/MapNodes/NodesOpcodes.h +++ b/src/game/MapNodes/NodesOpcodes.h @@ -74,7 +74,7 @@ public: NodeOpcodeMap::const_iterator itr = mOpcodeMap.find(id); if (itr != mOpcodeMap.end()) return &itr->second; - return NULL; + return nullptr; } static NodesOpcodes* instance() { diff --git a/src/game/MapNodes/Serializers/PlayerSerializer.cpp b/src/game/MapNodes/Serializers/PlayerSerializer.cpp index f4dcc62d0..3d8563ff2 100644 --- a/src/game/MapNodes/Serializers/PlayerSerializer.cpp +++ b/src/game/MapNodes/Serializers/PlayerSerializer.cpp @@ -13,7 +13,7 @@ bool Player::PrepareWakeUp(ObjectGuid guid) for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid()); - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); } SetGuidValue(PLAYER_FARSIGHT, ObjectGuid()); SetUInt32Value(PLAYER_TRACK_CREATURES, 0); diff --git a/src/game/MapNodes/Serializers/PlayerSerializer.h b/src/game/MapNodes/Serializers/PlayerSerializer.h index d6242367e..4377c6644 100644 --- a/src/game/MapNodes/Serializers/PlayerSerializer.h +++ b/src/game/MapNodes/Serializers/PlayerSerializer.h @@ -145,7 +145,7 @@ void Player::Serialize(OP& buf) { InitPlayerDisplayIds(); SetFactionForRace(getRace()); - SetCharm(NULL); + SetCharm(nullptr); } if (buf.IsRead()) @@ -304,7 +304,7 @@ void Player::SerializeInventory(MaNGOS::Serializer::ReadSerializer& buf) // From Player::_LoadInventory: if (!bag_guid) { - item->SetContainer(NULL); + item->SetContainer(nullptr); item->SetSlot(item_slot); if (IsInventoryPos(INVENTORY_SLOT_BAG_0, item_slot)) @@ -407,7 +407,7 @@ template <> void Player::SerializeSpellCooldowns(MaNGOS::Serializer::WriteSerializer& buf) { static uint32 last_spell_id = 0; - time_t currTime = time(NULL); + time_t currTime = time(nullptr); for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) { if (itr->second.end > currTime && itr->second.end <= currTime + infinityCooldownDelayCheck) diff --git a/src/game/Maps/GridMap.cpp b/src/game/Maps/GridMap.cpp index d3c80736e..52fdbdce5 100644 --- a/src/game/Maps/GridMap.cpp +++ b/src/game/Maps/GridMap.cpp @@ -43,14 +43,14 @@ GridMap::GridMap() // Area data m_gridArea = 0; - m_area_map = NULL; + m_area_map = nullptr; // Height level data m_gridHeight = INVALID_HEIGHT_VALUE; m_gridGetHeight = &GridMap::getHeightFromFlat; m_gridIntHeightMultiplier = 0; - m_V9 = NULL; - m_V8 = NULL; + m_V9 = nullptr; + m_V8 = nullptr; // Liquid data m_liquidType = 0; @@ -59,9 +59,9 @@ GridMap::GridMap() m_liquid_width = 0; m_liquid_height = 0; m_liquidLevel = INVALID_HEIGHT_VALUE; - m_liquidFlags = NULL; - m_liquidEntry = NULL; - m_liquid_map = NULL; + m_liquidFlags = nullptr; + m_liquidEntry = nullptr; + m_liquid_map = nullptr; } GridMap::~GridMap() @@ -126,12 +126,12 @@ void GridMap::unloadData() delete[] m_liquidFlags; delete[] m_liquid_map; - m_area_map = NULL; - m_V9 = NULL; - m_V8 = NULL; - m_liquidEntry = NULL; - m_liquidFlags = NULL; - m_liquid_map = NULL; + m_area_map = nullptr; + m_V9 = nullptr; + m_V8 = nullptr; + m_liquidEntry = nullptr; + m_liquidFlags = nullptr; + m_liquid_map = nullptr; m_gridGetHeight = &GridMap::getHeightFromFlat; } @@ -660,7 +660,7 @@ TerrainInfo::TerrainInfo(uint32 mapid) : m_mapId(mapid) { for (int i = 0; i < MAX_NUMBER_OF_GRIDS; ++i) { - m_GridMaps[i][k] = NULL; + m_GridMaps[i][k] = nullptr; m_GridRef[i][k] = 0; } } @@ -740,7 +740,7 @@ void TerrainInfo::CleanUpGrids(const uint32 diff) // delete those GridMap objects which have refcount = 0 if (pMap && iRef == 0) { - m_GridMaps[x][y] = NULL; + m_GridMaps[x][y] = nullptr; // delete grid data if reference count == 0 pMap->unloadData(); delete pMap; @@ -1086,7 +1086,7 @@ float TerrainInfo::GetWaterOrGroundLevel(Position const& position, float* pGroun { return GetWaterOrGroundLevel(position.x, position.y, position.z, pGround, swim); } -float TerrainInfo::GetWaterOrGroundLevel(float x, float y, float z, float* pGround /*= NULL*/, bool swim /*= false*/) const +float TerrainInfo::GetWaterOrGroundLevel(float x, float y, float z, float* pGround /*= nullptr*/, bool swim /*= false*/) const { if (const_cast(this)->GetGrid(x, y)) { @@ -1168,7 +1168,7 @@ GridMap* TerrainInfo::LoadMapAndVMap(const uint32 x, const uint32 y) return m_GridMaps[x][y]; } -float TerrainInfo::GetWaterLevel(float x, float y, float z, float* pGround /*= NULL*/) const +float TerrainInfo::GetWaterLevel(float x, float y, float z, float* pGround /*= nullptr*/) const { if (const_cast(this)->GetGrid(x, y)) { @@ -1214,7 +1214,7 @@ TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId) { Guard _guard(*this); - TerrainInfo* ptr = NULL; + TerrainInfo* ptr = nullptr; TerrainDataMap::const_iterator iter = i_TerrainMap.find(mapId); if (iter == i_TerrainMap.end()) { diff --git a/src/game/Maps/GridMap.h b/src/game/Maps/GridMap.h index 4f5718496..07c8d3808 100644 --- a/src/game/Maps/GridMap.h +++ b/src/game/Maps/GridMap.h @@ -222,9 +222,9 @@ class MANGOS_DLL_SPEC TerrainInfo : public Referencable // TODO: move all terrain/vmaps data info query functions // from 'Map' class into this class float GetHeightStatic(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; - float GetWaterLevel(float x, float y, float z, float* pGround = NULL) const; - float GetWaterOrGroundLevel(Position const& position, float* pGround = NULL, bool swim = false) const; - float GetWaterOrGroundLevel(float x, float y, float z, float* pGround = NULL, bool swim = false) const; + float GetWaterLevel(float x, float y, float z, float* pGround = nullptr) const; + float GetWaterOrGroundLevel(Position const& position, float* pGround = nullptr, bool swim = false) const; + float GetWaterOrGroundLevel(float x, float y, float z, float* pGround = nullptr, bool swim = false) const; bool IsInWater(float x, float y, float z, GridMapLiquidData* data = 0) const; bool IsUnderWater(float x, float y, float z) const; diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 72812a7a7..31f360b68 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -63,12 +63,12 @@ Map::~Map() sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size()); if (m_persistentState) - m_persistentState->SetUsedByMapState(NULL); // field pointer can be deleted after this + m_persistentState->SetUsedByMapState(nullptr); // field pointer can be deleted after this if (i_data) { delete i_data; - i_data = NULL; + i_data = nullptr; } //release reference count @@ -79,7 +79,7 @@ Map::~Map() sLog.outError("[MAP] Map %u (instance %u) deleted while there are still corpses to remove", GetId(), GetInstanceId()); delete m_weatherSystem; - m_weatherSystem = NULL; + m_weatherSystem = nullptr; } void Map::LoadMapAndVMap(int gx, int gy) @@ -95,10 +95,10 @@ void Map::LoadMapAndVMap(int gx, int gy) Map::Map(uint32 id, time_t expiry, uint32 InstanceId) : i_mapEntry(sMapStorage.LookupEntry(id)), i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), - m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_persistentState(NULL), + m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_persistentState(nullptr), m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()), i_gridExpiry(expiry), m_TerrainData(sTerrainMgr.LoadTerrain(id)), - i_data(NULL), i_script_id(0), m_unloading(false), m_crashed(false), + i_data(nullptr), i_script_id(0), m_unloading(false), m_crashed(false), _processingSendObjUpdates(false), _processingUnitsRelocation(false), m_updateFinished(false), m_updateDiffMod(0), m_GridActivationDistance(DEFAULT_VISIBILITY_DISTANCE), _lastPlayersUpdate(WorldTimer::getMSTime()), _lastMapUpdate(WorldTimer::getMSTime()), @@ -115,7 +115,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId) { //z code m_bLoadedGrids[idx][j] = false; - setNGrid(NULL, idx, j); + setNGrid(nullptr, idx, j); } } @@ -313,7 +313,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - if (grid == NULL) + if (grid == nullptr) { sLog.outInfo("[Map%u][CRASH] Grid [%u:%u] NOT loaded !!", i_id, cell.GridX(), cell.GridY()); throw new std::string("Crash AT EnsureGridLoaded"); @@ -430,7 +430,7 @@ Map::Add(T *obj) EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - MANGOS_ASSERT(grid != NULL); + MANGOS_ASSERT(grid != nullptr); AddToGrid(obj, grid, cell); obj->AddToWorld(); @@ -1144,7 +1144,7 @@ void Map::Remove(Player *player, bool remove) // after decrement+unlink, ++m_mapRefIter will continue correctly // when the first element of the list is being removed // nocheck_prev will return the padding element of the RefManager - // instead of NULL in the case of prev + // instead of nullptr in the case of prev if (m_mapRefIter == player->GetMapRef()) m_mapRefIter = m_mapRefIter->nocheck_prev(); player->GetMapRef().unlink(); @@ -1164,13 +1164,13 @@ void Map::Remove(Player *player, bool remove) if (!getNGrid(cell.data.Part.grid_x, cell.data.Part.grid_y)) { - sLog.outError("Map::Remove() i_grids was NULL x:%d, y:%d", cell.data.Part.grid_x, cell.data.Part.grid_y); + sLog.outError("Map::Remove() i_grids was nullptr x:%d, y:%d", cell.data.Part.grid_x, cell.data.Part.grid_y); return; } DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_MOVES, "Remove player %s from grid[%u,%u]", player->GetName(), cell.GridX(), cell.GridY()); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - MANGOS_ASSERT(grid != NULL); + MANGOS_ASSERT(grid != nullptr); RemoveFromGrid(player, grid, cell); @@ -1208,7 +1208,7 @@ Map::Remove(T *obj, bool remove) DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - MANGOS_ASSERT(grid != NULL); + MANGOS_ASSERT(grid != nullptr); if (obj->isActiveObject()) RemoveFromActive(obj); @@ -1433,7 +1433,7 @@ bool Map::CreatureRespawnRelocation(Creature *c, bool forGridUnload) bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce) { NGridType *grid = getNGrid(x, y); - MANGOS_ASSERT(grid != NULL); + MANGOS_ASSERT(grid != nullptr); { if (!pForce && ActiveObjectsNearGrid(x, y)) @@ -1454,14 +1454,14 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce) unloader.UnloadN(); delete getNGrid(x, y); - setNGrid(NULL, x, y); + setNGrid(nullptr, x, y); } int gx = (MAX_NUMBER_OF_GRIDS - 1) - x; int gy = (MAX_NUMBER_OF_GRIDS - 1) - y; // unload GridMap - it is reference-countable so will be deleted safely when lockCount < 1 - // also simply set Map's pointer to corresponding GridMap object to NULL + // also simply set Map's pointer to corresponding GridMap object to nullptr if (m_bLoadedGrids[gx][gy]) { m_bLoadedGrids[gx][gy] = false; @@ -2089,7 +2089,7 @@ bool DungeonMap::Add(Player *player) if (groupBind->state) sLog.outError("GroupBind save players: %d, group count: %d", groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount()); else - sLog.outError("GroupBind save NULL"); + sLog.outError("GroupBind save nullptr"); MANGOS_ASSERT(false); } // if the group/leader is permanently bound to the instance @@ -2117,7 +2117,7 @@ bool DungeonMap::Add(Player *player) // for normal instances cancel the reset schedule when the // first player enters (no players yet) SetResetSchedule(false); - player->AddInstanceEnterTime(GetInstanceId(), time(NULL)); + player->AddInstanceEnterTime(GetInstanceId(), time(nullptr)); DETAIL_LOG("MAP: Player '%s' is entering instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName()); // initialize unload state @@ -2268,7 +2268,7 @@ DungeonPersistentState* DungeonMap::GetPersistanceState() const /* ******* Battleground Instance Maps ******* */ BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId) - : Map(id, expiry, InstanceId), m_bg(NULL) + : Map(id, expiry, InstanceId), m_bg(nullptr) { //lets initialize visibility distance for BG BattleGroundMap::InitVisibilityDistance(); @@ -2449,7 +2449,7 @@ bool Map::FindScriptFinalTargets(WorldObject*& source, WorldObject*& target, con if (!((pSearcher = source) || (pSearcher = original_source))) { - sLog.outError("FindScriptTargets: Attempt to search for nearby creature in script with id %u but source is a NULL object.", script.id); + sLog.outError("FindScriptTargets: Attempt to search for nearby creature in script with id %u but source is a nullptr object.", script.id); return false; } @@ -2504,7 +2504,7 @@ bool Map::FindScriptFinalTargets(WorldObject*& source, WorldObject*& target, con if (!((pSearcher = source) || (pSearcher = original_source))) { - sLog.outError("FindScriptTargets: Attempt to search for nearby gameobject in script with id %u but source is a NULL object.", script.id); + sLog.outError("FindScriptTargets: Attempt to search for nearby gameobject in script with id %u but source is a nullptr object.", script.id); return false; } @@ -2646,7 +2646,7 @@ void Map::ScriptsProcess() Player* Map::GetPlayer(ObjectGuid guid) { Player* plr = ObjectAccessor::FindPlayer(guid); // return only in world players - return plr && plr->GetMap() == this ? plr : NULL; + return plr && plr->GetMap() == this ? plr : nullptr; } /** @@ -2659,7 +2659,7 @@ Player* Map::GetPlayer(ObjectGuid guid) Corpse* Map::GetCorpse(ObjectGuid guid) { Corpse * ret = ObjectAccessor::GetCorpseInMap(guid, GetId()); - return ret && ret->GetInstanceId() == GetInstanceId() ? ret : NULL; + return ret && ret->GetInstanceId() == GetInstanceId() ? ret : nullptr; } /** @@ -2679,16 +2679,16 @@ Creature* Map::GetAnyTypeCreature(ObjectGuid guid) break; } - return NULL; + return nullptr; } Transport* Map::GetTransport(ObjectGuid guid) { if (!guid.IsMOTransport()) - return NULL; + return nullptr; GameObject* go = GetGameObject(guid); - return go ? go->ToTransport() : NULL; + return go ? go->ToTransport() : nullptr; } /** @@ -2698,7 +2698,7 @@ Transport* Map::GetTransport(ObjectGuid guid) */ DynamicObject* Map::GetDynamicObject(ObjectGuid guid) { - return m_objectsStore.find(guid, (DynamicObject*)NULL); + return m_objectsStore.find(guid, (DynamicObject*)nullptr); } /** @@ -2837,7 +2837,7 @@ void Map::SendObjectUpdates() uint32 step = objectsCount / threads; uint32 i = 0; - ACE_Based::Thread** updaters = threads > 1 ? new ACE_Based::Thread*[threads - 1] : NULL; + ACE_Based::Thread** updaters = threads > 1 ? new ACE_Based::Thread*[threads - 1] : nullptr; ObjectUpdatePacketBuilder** objUpdaters = new ObjectUpdatePacketBuilder*[threads]; std::set::iterator itBegin = i_objectsToClientUpdate.begin(); std::set::iterator itEnd = i_objectsToClientUpdate.begin(); @@ -2948,7 +2948,7 @@ void Map::UpdateVisibilityForRelocations() uint32 step = objectsCount / threads; uint32 i = 0; - ACE_Based::Thread** updaters = threads > 1 ? new ACE_Based::Thread*[threads - 1] : NULL; + ACE_Based::Thread** updaters = threads > 1 ? new ACE_Based::Thread*[threads - 1] : nullptr; VisibilityUpdater** visUpdaters = new VisibilityUpdater*[threads]; std::set::iterator itBegin = i_unitsRelocated.begin(); std::set::iterator itEnd = i_unitsRelocated.begin(); @@ -3074,7 +3074,7 @@ private: * @param guid must be creature guid of whom to Simulate the yell, non-creature guids not supported at this moment * @param textId Id of the simulated text * @param language language of the text - * @param target, can be NULL + * @param target, can be nullptr */ void Map::MonsterYellToMap(ObjectGuid guid, int32 textId, Language language, Unit const* target) const { @@ -3103,7 +3103,7 @@ void Map::MonsterYellToMap(ObjectGuid guid, int32 textId, Language language, Uni * @param cinfo must be entry of Creature of whom to Simulate the yell * @param textId Id of the simulated text * @param language language of the text - * @param target, can be NULL + * @param target, can be nullptr * @param senderLowGuid provide way proper show yell for near spawned creature with known lowguid, * 0 accepted by client else if this not important */ @@ -3239,7 +3239,7 @@ bool Map::GetWalkHitPosition(Transport* transport, float srcX, float srcY, float } for (int i = 0; i < 3; ++i) endPosition[i] += hitNormal[i] * 0.5f; - if (dtStatusFailed(m_navMeshQuery->closestPointOnPoly(visited[visitedCount - 1], endPosition, endPosition, NULL))) + if (dtStatusFailed(m_navMeshQuery->closestPointOnPoly(visited[visitedCount - 1], endPosition, endPosition, nullptr))) return false; /// Compute complete path, and at each path step, check for dynamic LoS collision @@ -3252,8 +3252,8 @@ bool Map::GetWalkHitPosition(Transport* transport, float srcX, float srcY, float visited, // current path visitedCount, // length of current path pathPoints, // [out] path corner points - NULL, - NULL, + nullptr, + nullptr, (int*)&pointCount, 20, // maximum number of points/polygons to use DT_STRAIGHTPATH_ALL_CROSSINGS); @@ -3327,7 +3327,7 @@ bool Map::GetWalkRandomPosition(Transport* transport, float &x, float &y, float return false; for (int i = 0; i < 3; ++i) endPosition[i] += hitNormal[i] * 0.5f; - result = m_navMeshQuery->closestPointOnPoly(visited[visitedCount - 1], endPosition, endPosition, NULL); + result = m_navMeshQuery->closestPointOnPoly(visited[visitedCount - 1], endPosition, endPosition, nullptr); if (dtStatusFailed(result) || !MaNGOS::IsValidMapCoord(endPosition[2], endPosition[0], endPosition[1])) return false; @@ -3377,7 +3377,7 @@ void Map::CrashUnload() WorldSession* session = player->GetSession(); sLog.out(LOG_CHAR, "Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", session->GetAccountId(), session->GetRemoteAddress().c_str(), player->GetName() , player->GetGUIDLow()); sWorld.LogCharacter(player, "Logout"); - session->SetPlayer(NULL); + session->SetPlayer(nullptr); player->SaveInventoryAndGoldToDB(); // Prevent possible exploits player->UninviteFromGroup(); @@ -3406,8 +3406,8 @@ void Map::CrashUnload() if (m_persistentState) { - m_persistentState->SetUsedByMapState(NULL); // field pointer can be deleted after this - m_persistentState = NULL; + m_persistentState->SetUsedByMapState(nullptr); // field pointer can be deleted after this + m_persistentState = nullptr; } if (i_data) diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index e2c1792cf..ed3fb007e 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -426,7 +426,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); } bool IsContinent() const { return i_mapEntry && i_mapEntry->IsContinent(); } - // can't be NULL for loaded map + // can't be nullptr for loaded map MapPersistentState* GetPersistentState() const { return m_persistentState; } void AddObjectToRemoveList(WorldObject *obj); @@ -997,7 +997,7 @@ class MANGOS_DLL_SPEC WorldMap : public Map WorldMap(uint32 id, time_t expiry, uint32 instance = 0) : Map(id, expiry, instance) {} ~WorldMap() {} - // can't be NULL for loaded map + // can't be nullptr for loaded map WorldPersistentState* GetPersistanceState() const; }; @@ -1019,7 +1019,7 @@ class MANGOS_DLL_SPEC DungeonMap : public Map void SetResetSchedule(bool on); uint32 GetMaxPlayers() const; - // can't be NULL for loaded map + // can't be nullptr for loaded map DungeonPersistentState* GetPersistanceState() const; void InitVisibilityDistance() override; @@ -1049,7 +1049,7 @@ class MANGOS_DLL_SPEC BattleGroundMap : public Map BattleGround* GetBG() const { return m_bg; } void SetBG(BattleGround* bg) { m_bg = bg; } - // can't be NULL for loaded map + // can't be nullptr for loaded map BattleGroundPersistentState* GetPersistanceState() const; private: diff --git a/src/game/Maps/MapManager.cpp b/src/game/Maps/MapManager.cpp index 69aeede63..5d201962a 100644 --- a/src/game/Maps/MapManager.cpp +++ b/src/game/Maps/MapManager.cpp @@ -40,7 +40,7 @@ MapManager::MapManager() : i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)), i_MaxInstanceId(RESERVED_INSTANCES_LAST), i_GridStateErrorCount(0), - i_continentUpdateFinished(NULL), + i_continentUpdateFinished(nullptr), i_maxContinentThread(0), asyncMapUpdating(false) { @@ -112,11 +112,11 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj) //if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId()); Guard _guard(*this); - Map * m = NULL; + Map * m = nullptr; const MapEntry* entry = sMapStorage.LookupEntry(id); if (!entry) - return NULL; + return nullptr; if (entry->Instanceable()) { @@ -134,7 +134,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj) if (id > 1) // Not a continent => Never instanciate this (deeprun tram, etc ...) instanceId = 0; m = FindMap(id, instanceId); - if (m == NULL) + if (m == nullptr) { m = new WorldMap(id, i_gridCleanUpDelay, instanceId); //add map into container @@ -164,7 +164,7 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const MapMapType::const_iterator iter = i_maps.find(MapID(mapid, instanceId)); if (iter == i_maps.end()) - return NULL; + return nullptr; return iter->second; } @@ -357,7 +357,7 @@ void MapManager::Update(uint32 diff) delete asyncUpdateThreads[tid]; } delete[] i_continentUpdateFinished; - i_continentUpdateFinished = NULL; + i_continentUpdateFinished = nullptr; asyncMapUpdating = false; // Execute far teleports after all map updates have finished @@ -481,8 +481,8 @@ uint32 MapManager::GetNumPlayersInInstances() Map* MapManager::CreateInstance(uint32 id, Player * player) { Guard _guard(*this); - Map* map = NULL; - Map * pNewMap = NULL; + Map* map = nullptr; + Map * pNewMap = nullptr; uint32 NewInstanceId = 0; // instanceId of the resulting map bool newlyGeneratedInstanceId = false; const MapEntry* entry = sMapStorage.LookupEntry(id); @@ -586,7 +586,7 @@ DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, DungeonPe DungeonMap *map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId); // Dungeons can have saved instance data - bool load_data = save != NULL; + bool load_data = save != nullptr; map->CreateInstanceData(load_data); map->SpawnActiveObjects(); return map; diff --git a/src/game/Maps/MapManager.h b/src/game/Maps/MapManager.h index 36b4fd047..43fc93779 100644 --- a/src/game/Maps/MapManager.h +++ b/src/game/Maps/MapManager.h @@ -87,7 +87,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton MapMapType; - uint32 GetContinentInstanceId(uint32 mapId, float x, float y, bool* transitionArea = NULL); + uint32 GetContinentInstanceId(uint32 mapId, float x, float y, bool* transitionArea = nullptr); Map* CreateMap(uint32, const WorldObject* obj); Map* CreateBgMap(uint32 mapid, BattleGround* bg); Map* CreateTestMap(uint32 mapid, bool instanced, float posX, float posY); @@ -196,7 +196,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singletonfirst) < now) { DungeonResetEvent &event = m_resetTimeQueue.begin()->second; @@ -655,12 +655,12 @@ MapPersistentState *MapPersistentStateManager::GetPersistentState(uint32 mapId, if (instanceId) { PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.find(instanceId); - return itr != m_instanceSaveByInstanceId.end() ? itr->second : NULL; + return itr != m_instanceSaveByInstanceId.end() ? itr->second : nullptr; } else { PersistentStateMap::iterator itr = m_instanceSaveByMapId.find(mapId); - return itr != m_instanceSaveByMapId.end() ? itr->second : NULL; + return itr != m_instanceSaveByMapId.end() ? itr->second : nullptr; } } diff --git a/src/game/Maps/MapPersistentStateMgr.h b/src/game/Maps/MapPersistentStateMgr.h index bcf30649d..1e30dcc1f 100644 --- a/src/game/Maps/MapPersistentStateMgr.h +++ b/src/game/Maps/MapPersistentStateMgr.h @@ -78,7 +78,7 @@ class MapPersistentState const MapEntry* GetMapEntry() const; bool IsUsedByMap() const { return m_usedByMap; } - Map* GetMap() const { return m_usedByMap; } // Can be NULL if map not loaded for persistent state + Map* GetMap() const { return m_usedByMap; } // Can be nullptr if map not loaded for persistent state void SetUsedByMapState(Map* map) { m_usedByMap = map; @@ -128,7 +128,7 @@ class MapPersistentState uint32 m_instanceid; uint32 m_mapid; - Map* m_usedByMap; // NULL if map not loaded, non-NULL lock MapPersistentState from unload + Map* m_usedByMap; // nullptr if map not loaded, non-nullptr lock MapPersistentState from unload // persistent data RespawnTimes m_creatureRespawnTimes; // lock MapPersistentState from unload, for example for temporary bound dungeon unload delay @@ -324,10 +324,10 @@ class MANGOS_DLL_DECL MapPersistentStateManager : public MaNGOS::Singleton MapReference const* getLast() const { return (MapReference const*)RefManager::getLast(); } iterator begin() { return iterator(getFirst()); } - iterator end() { return iterator(NULL); } + iterator end() { return iterator(nullptr); } iterator rbegin() { return iterator(getLast()); } - iterator rend() { return iterator(NULL); } + iterator rend() { return iterator(nullptr); } const_iterator begin() const { return const_iterator(getFirst()); } - const_iterator end() const { return const_iterator(NULL); } + const_iterator end() const { return const_iterator(nullptr); } }; #endif diff --git a/src/game/Maps/MoveMap.cpp b/src/game/Maps/MoveMap.cpp index 7655be0d3..61e642dfe 100644 --- a/src/game/Maps/MoveMap.cpp +++ b/src/game/Maps/MoveMap.cpp @@ -28,11 +28,11 @@ namespace MMAP { // ######################## MMapFactory ######################## // our global singelton copy -MMapManager *g_MMapManager = NULL; +MMapManager *g_MMapManager = nullptr; MMapManager* MMapFactory::createOrGetMMapManager() { - if (g_MMapManager == NULL) + if (g_MMapManager == nullptr) g_MMapManager = new MMapManager(); return g_MMapManager; @@ -43,7 +43,7 @@ void MMapFactory::clear() if (g_MMapManager) { delete g_MMapManager; - g_MMapManager = NULL; + g_MMapManager = nullptr; } } @@ -235,7 +235,7 @@ bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y) dtTileRef tileRef = mmap->mmapLoadedTiles[packedGridPos]; // unload, and mark as non loaded - if (DT_SUCCESS != mmap->navMesh->removeTile(tileRef, NULL, NULL)) + if (DT_SUCCESS != mmap->navMesh->removeTile(tileRef, nullptr, nullptr)) { // this is technically a memory leak // if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used @@ -268,7 +268,7 @@ bool MMapManager::unloadMap(uint32 mapId) { uint32 x = (i->first >> 16); uint32 y = (i->first & 0x0000FFFF); - if (DT_SUCCESS != mmap->navMesh->removeTile(i->second, NULL, NULL)) + if (DT_SUCCESS != mmap->navMesh->removeTile(i->second, nullptr, nullptr)) sLog.outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); else --loadedTiles; @@ -310,7 +310,7 @@ bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId) dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId) { if (loadedMMaps.find(mapId) == loadedMMaps.end()) - return NULL; + return nullptr; return loadedMMaps[mapId]->navMesh; } @@ -318,14 +318,14 @@ dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId) dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId) { if (loadedMMaps.find(mapId) == loadedMMaps.end()) - return NULL; + return nullptr; uint32 tid = (uintptr_t) ACE_Based::Thread::currentId(); MMapData* mmap = loadedMMaps[mapId]; mmap->navMeshQueries_lock.acquire_read(); NavMeshQuerySet::iterator it = mmap->navMeshQueries.find(tid); - dtNavMeshQuery* navMeshQuery = NULL; + dtNavMeshQuery* navMeshQuery = nullptr; if (it == mmap->navMeshQueries.end()) { mmap->navMeshQueries_lock.release(); @@ -339,7 +339,7 @@ dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId) mmap->navMeshQueries_lock.release(); dtFreeNavMeshQuery(navMeshQuery); sLog.outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u thread %u", mapId, tid); - return NULL; + return nullptr; } DETAIL_LOG("MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u thread %u", mapId, tid); @@ -422,7 +422,7 @@ bool MMapManager::loadGameObject(uint32 displayId) dtNavMeshQuery const* MMapManager::GetModelNavMeshQuery(uint32 displayId) { if (loadedModels.find(displayId) == loadedModels.end()) - return NULL; + return nullptr; uint32 tid = (uintptr_t) ACE_Based::Thread::currentId(); MMapData* mmap = loadedModels[displayId]; @@ -438,7 +438,7 @@ dtNavMeshQuery const* MMapManager::GetModelNavMeshQuery(uint32 displayId) { dtFreeNavMeshQuery(query); sLog.outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for displayid %03u tid %u", displayId, tid); - return NULL; + return nullptr; } DETAIL_LOG("MMAP:GetNavMeshQuery: created dtNavMeshQuery for displayid %03u tid %u", displayId, tid); diff --git a/src/game/Maps/PathFinder.cpp b/src/game/Maps/PathFinder.cpp index ed6d8c0fa..b77a02eb7 100644 --- a/src/game/Maps/PathFinder.cpp +++ b/src/game/Maps/PathFinder.cpp @@ -35,7 +35,7 @@ PathInfo::PathInfo(const Unit* owner) : m_polyLength(0), m_type(PATHFIND_BLANK), m_useStraightPath(false), m_forceDestination(false), m_pointPathLimit(MAX_POINT_PATH_LENGTH), - m_sourceUnit(owner), m_navMesh(NULL), m_navMeshQuery(NULL), m_transport(NULL), m_targetAllowedFlags(0) + m_sourceUnit(owner), m_navMesh(nullptr), m_navMeshQuery(nullptr), m_transport(nullptr), m_targetAllowedFlags(0) { //DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ PathFinder::PathInfo for %u \n", m_sourceUnit->GetGUIDLow()); createFilter(); @@ -393,8 +393,8 @@ void PathInfo::BuildPointPath(const float *startPoint, const float *endPoint, fl m_pathPolyRefs, // current path m_polyLength, // lenth of current path pathPoints, // [out] path corner points - NULL, // [out] flags - NULL, // [out] shortened path + nullptr, // [out] flags + nullptr, // [out] shortened path (int*)&pointCount, m_pointPathLimit); // maximum number of points/polygons to use } @@ -561,7 +561,7 @@ bool PathInfo::HaveTiles(const Vector3& p) const // check if the start and end point have a .mmtile loaded m_navMesh->calcTileLoc(point, &tx, &ty); - return (m_navMesh->getTileAt(tx, ty, 0) != NULL); + return (m_navMesh->getTileAt(tx, ty, 0) != nullptr); } uint32 PathInfo::fixupCorridor(dtPolyRef* path, const uint32 npath, const uint32 maxPath, diff --git a/src/game/Maps/Pool/PoolManager.cpp b/src/game/Maps/Pool/PoolManager.cpp index 9405a00dc..2ef18763b 100644 --- a/src/game/Maps/Pool/PoolManager.cpp +++ b/src/game/Maps/Pool/PoolManager.cpp @@ -246,7 +246,7 @@ PoolObject* PoolGroup::RollOne(SpawnedPoolData& spawns, uint32 triggerFrom) } } - return NULL; + return nullptr; } // Main method to despawn a creature or gameobject in a pool @@ -487,7 +487,7 @@ void PoolGroup::Spawn1Object(MapPersistentState& mapState, PoolObject* } // for not loaded grid just update respawn time (avoid work for instances until implemented support) else if (!instantly) - mapState.SaveCreatureRespawnTime(obj->guid, time(NULL) + data->GetRandomRespawnTime()); + mapState.SaveCreatureRespawnTime(obj->guid, time(nullptr) + data->GetRandomRespawnTime()); } } @@ -537,7 +537,7 @@ void PoolGroup::Spawn1Object(MapPersistentState& mapState, PoolObjec { // for spawned by default object only if (data->spawntimesecsmin >= 0) - mapState.SaveGORespawnTime(obj->guid, time(NULL) + data->ComputeRespawnDelay(data->GetRandomRespawnTime())); + mapState.SaveGORespawnTime(obj->guid, time(nullptr) + data->ComputeRespawnDelay(data->GetRandomRespawnTime())); } } } diff --git a/src/game/Maps/Pool/PoolManager.h b/src/game/Maps/Pool/PoolManager.h index 1bd3e9195..6a98b96fb 100644 --- a/src/game/Maps/Pool/PoolManager.h +++ b/src/game/Maps/Pool/PoolManager.h @@ -44,7 +44,7 @@ struct PoolTemplateData MapEntry const* mapEntry; // Map id used for pool creature/gameobject spams. In case non-instanceable map // it can be not unique but base at sharing same pool system dynamic data in this case this is not important. - // NULL is no spawns by some reason + // nullptr is no spawns by some reason uint32 MaxLimit; uint32 PoolFlags; uint32 InstanceId; diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index 3154b26a2..ec4269ca8 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -39,7 +39,7 @@ bool Map::ScriptCommand_Talk(const ScriptInfo& script, WorldObject* source, Worl if (!pSource) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for a NULL or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for a nullptr or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -72,7 +72,7 @@ bool Map::ScriptCommand_Emote(const ScriptInfo& script, WorldObject* source, Wor if (!pSource) { - sLog.outError("SCRIPT_COMMAND_EMOTE (script id %u) call for a NULL or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_EMOTE (script id %u) call for a nullptr or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -96,7 +96,7 @@ bool Map::ScriptCommand_FieldSet(const ScriptInfo& script, WorldObject* source, { if (!source) { - sLog.outError("SCRIPT_COMMAND_FIELD_SET (script id %u) call for a NULL object, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_FIELD_SET (script id %u) call for a nullptr object, skipping.", script.id); return ShouldAbortScript(script); } @@ -119,7 +119,7 @@ bool Map::ScriptCommand_MoveTo(const ScriptInfo& script, WorldObject* source, Wo if (!pSource) { - sLog.outError("SCRIPT_COMMAND_MOVE_TO (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MOVE_TO (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -156,7 +156,7 @@ bool Map::ScriptCommand_MoveTo(const ScriptInfo& script, WorldObject* source, Wo } else { - sLog.outError("SCRIPT_COMMAND_MOVE_TO (script id %u) call with datalong = %u for a NULL or non-worldobject target, skipping.", script.id, script.moveTo.coordinatesType); + sLog.outError("SCRIPT_COMMAND_MOVE_TO (script id %u) call with datalong = %u for a nullptr or non-worldobject target, skipping.", script.id, script.moveTo.coordinatesType); return ShouldAbortScript(script); } } @@ -181,7 +181,7 @@ bool Map::ScriptCommand_ModifyFlags(const ScriptInfo& script, WorldObject* sourc { if (!source) { - sLog.outError("SCRIPT_COMMAND_MODIFY_FLAGS (script id %u) call for a NULL object, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_MODIFY_FLAGS (script id %u) call for a nullptr object, skipping.", script.id); return ShouldAbortScript(script); } @@ -217,7 +217,7 @@ bool Map::ScriptCommand_InterruptCasts(const ScriptInfo& script, WorldObject* so if (!pSource) { - sLog.outError("SCRIPT_COMMAND_INTERRUPT_CAST (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_INTERRUPT_CAST (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -233,7 +233,7 @@ bool Map::ScriptCommand_TeleportTo(const ScriptInfo& script, WorldObject* source if (!pSource) { - sLog.outError("SCRIPT_COMMAND_TELEPORT_TO (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_TELEPORT_TO (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -252,7 +252,7 @@ bool Map::ScriptCommand_QuestExplored(const ScriptInfo& script, WorldObject* sou if (!((pPlayer = ToPlayer(target)) || (pPlayer = ToPlayer(source)))) { - sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for a NULL player, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for a nullptr player, skipping.", script.id); return ShouldAbortScript(script); } @@ -293,7 +293,7 @@ bool Map::ScriptCommand_KillCredit(const ScriptInfo& script, WorldObject* source } else { - sLog.outError("SCRIPT_COMMAND_KILL_CREDIT (script id %u) call for a NULL object, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_KILL_CREDIT (script id %u) call for a nullptr object, skipping.", script.id); return ShouldAbortScript(script); } @@ -353,7 +353,7 @@ bool Map::ScriptCommand_SummonCreature(const ScriptInfo& script, WorldObject* so { if (!script.summonCreature.creatureEntry) { - sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for a NULL creature, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for a nullptr creature, skipping.", script.id); return ShouldAbortScript(script); } @@ -361,7 +361,7 @@ bool Map::ScriptCommand_SummonCreature(const ScriptInfo& script, WorldObject* so if (!pSummoner) { - sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for a NULL or non-worldobject source (TypeId: %u, skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for a nullptr or non-worldobject source (TypeId: %u, skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -531,13 +531,13 @@ bool Map::ScriptCommand_ActivateGameObject(const ScriptInfo& script, WorldObject if (!((pUser = ToUnit(source)) || (pUser = ToUnit(target)))) { - sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT (script id %u) call for a NULL user, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT (script id %u) call for a nullptr user, skipping.", script.id); return ShouldAbortScript(script); } if (!((pGo = ToGameObject(target)) || (pGo = ToGameObject(source)))) { - sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT (script id %u) call for a NULL gameobject, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_ACTIVATE_OBJECT (script id %u) call for a nullptr gameobject, skipping.", script.id); return ShouldAbortScript(script); } @@ -552,7 +552,7 @@ bool Map::ScriptCommand_RemoveAura(const ScriptInfo& script, WorldObject* source if (!pSource) { - sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -568,7 +568,7 @@ bool Map::ScriptCommand_CastSpell(const ScriptInfo& script, WorldObject* source, if (!source) { - sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for a NULL source, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for a nullptr source, skipping.", script.id); return ShouldAbortScript(script); } @@ -595,7 +595,7 @@ bool Map::ScriptCommand_PlaySound(const ScriptInfo& script, WorldObject* source, if (!pSource) { - sLog.outError("SCRIPT_COMMAND_PLAY_SOUND (script id %u) call for a NULL or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_PLAY_SOUND (script id %u) call for a nullptr or non-worldobject source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -603,7 +603,7 @@ bool Map::ScriptCommand_PlaySound(const ScriptInfo& script, WorldObject* source, if ((script.playSound.flags & SF_PLAYSOUND_ONLY_TO_TARGET) && !(pTarget = ToPlayer(target))) { - sLog.outError("SCRIPT_COMMAND_PLAY_SOUND (script id %u) in targeted mode call for a NULL or non-player target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_PLAY_SOUND (script id %u) in targeted mode call for a nullptr or non-player target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -622,7 +622,7 @@ bool Map::ScriptCommand_CreateItem(const ScriptInfo& script, WorldObject* source if (!((pReceiver = ToPlayer(target)) || (pReceiver = ToPlayer(source)))) { - sLog.outError("SCRIPT_COMMAND_CREATE_ITEM (script id %u) call for a NULL or non-player object (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_CREATE_ITEM (script id %u) call for a nullptr or non-player object (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -639,7 +639,7 @@ bool Map::ScriptCommand_DespawnCreature(const ScriptInfo& script, WorldObject* s if (!pSource) { - sLog.outError("SCRIPT_COMMAND_DESPAWN_CREATURE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_DESPAWN_CREATURE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -658,7 +658,7 @@ bool Map::ScriptCommand_SetEquipment(const ScriptInfo& script, WorldObject* sour if (!pSource) { - sLog.outError("SCRIPT_COMMAND_DESPAWN_CREATURE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_DESPAWN_CREATURE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -695,7 +695,7 @@ bool Map::ScriptCommand_SetMovementType(const ScriptInfo& script, WorldObject* s pTarget = ToUnit(source); else { - sLog.outError("SCRIPT_COMMAND_MOVEMENT (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MOVEMENT (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -777,7 +777,7 @@ bool Map::ScriptCommand_SetActiveObject(const ScriptInfo& script, WorldObject* s if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_SET_ACTIVEOBJECT (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_ACTIVEOBJECT (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -793,7 +793,7 @@ bool Map::ScriptCommand_SetFaction(const ScriptInfo& script, WorldObject* source if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_SET_FACTION (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_FACTION (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -812,7 +812,7 @@ bool Map::ScriptCommand_Morph(const ScriptInfo& script, WorldObject* source, Wor if (!((pSource = ToUnit(source)) || (pSource = ToUnit(target)))) { - sLog.outError("SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (script id %u) call for a NULL or non-unit source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (script id %u) call for a nullptr or non-unit source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -841,7 +841,7 @@ bool Map::ScriptCommand_Mount(const ScriptInfo& script, WorldObject* source, Wor if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -868,7 +868,7 @@ bool Map::ScriptCommand_SetRun(const ScriptInfo& script, WorldObject* source, Wo if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_SET_RUN (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_RUN (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -885,7 +885,7 @@ bool Map::ScriptCommand_AttackStart(const ScriptInfo& script, WorldObject* sourc if (!pAttacker || !pTarget) { - sLog.outError("SCRIPT_COMMAND_ATTACK_START (script id %u) call for a NULL source or target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ATTACK_START (script id %u) call for a nullptr source or target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -911,7 +911,7 @@ bool Map::ScriptCommand_UpdateEntry(const ScriptInfo& script, WorldObject* sourc if (!pSource) { - sLog.outError("SCRIPT_COMMAND_UPDATE_ENTRY (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_UPDATE_ENTRY (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -928,7 +928,7 @@ bool Map::ScriptCommand_SetStandState(const ScriptInfo& script, WorldObject* sou if (!pSource) { - sLog.outError("SCRIPT_COMMAND_STAND_STATE (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_STAND_STATE (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -947,7 +947,7 @@ bool Map::ScriptCommand_ModifyThreat(const ScriptInfo& script, WorldObject* sour if (!pSource) { - sLog.outError("SCRIPT_COMMAND_MODIFY_THREAT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MODIFY_THREAT (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -994,7 +994,7 @@ bool Map::ScriptCommand_TerminateScript(const ScriptInfo& script, WorldObject* s WorldObject* pSearcher; if (!((pSearcher = source) || (pSearcher = target))) { - sLog.outError("SCRIPT_COMMAND_TERMINATE_SCRIPT (script id %u) call for a NULL object, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_TERMINATE_SCRIPT (script id %u) call for a nullptr object, skipping.", script.id); return ShouldAbortScript(script); } @@ -1043,7 +1043,7 @@ bool Map::ScriptCommand_Evade(const ScriptInfo& script, WorldObject* source, Wor if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_ENTER_EVADE_MODE (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ENTER_EVADE_MODE (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1060,7 +1060,7 @@ bool Map::ScriptCommand_SetHomePosition(const ScriptInfo& script, WorldObject* s if (!((pSource = ToCreature(source)) || (pSource = ToCreature(target)))) { - sLog.outError("SCRIPT_COMMAND_SET_HOME_POSITION (script id %u) call for a NULL or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_HOME_POSITION (script id %u) call for a nullptr or non-creature source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1093,7 +1093,7 @@ bool Map::ScriptCommand_TurnTo(const ScriptInfo& script, WorldObject* source, Wo if (!pSource) { - sLog.outError("SCRIPT_COMMAND_TURN_TO (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_TURN_TO (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1130,7 +1130,7 @@ bool Map::ScriptCommand_MeetingStone(const ScriptInfo& script, WorldObject* sour if (!((pPlayer = ToPlayer(target)) || (pPlayer = ToPlayer(source)))) { - sLog.outError("SCRIPT_COMMAND_MEETINGSTONE (script id %u) call for a NULL or non-player source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_MEETINGSTONE (script id %u) call for a nullptr or non-player source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1195,7 +1195,7 @@ bool Map::ScriptCommand_SetData64(const ScriptInfo& script, WorldObject* source, pInst->SetData64(script.setData64.field, source->GetGUID()); else { - sLog.outError("SCRIPT_COMMAND_SET_INST_DATA64 (script id %u) call for a NULL source, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_SET_INST_DATA64 (script id %u) call for a nullptr source, skipping.", script.id); return ShouldAbortScript(script); } break; @@ -1245,7 +1245,7 @@ bool Map::ScriptCommand_RemoveItem(const ScriptInfo& script, WorldObject* source if (!((pPlayer = ToPlayer(target)) || (pPlayer = ToPlayer(source)))) { - sLog.outError("SCRIPT_COMMAND_REMOVE_ITEM (script id %u) call for a NULL or non-player source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_REMOVE_ITEM (script id %u) call for a nullptr or non-player source and target (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", script.id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1261,7 +1261,7 @@ bool Map::ScriptCommand_RemoveGameObject(const ScriptInfo& script, WorldObject* if (!((pGo = ToGameObject(target)) || (pGo = ToGameObject(source)))) { - sLog.outError("SCRIPT_COMMAND_REMOVE_OBJECT (script id %u) call for a NULL gameobject, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_REMOVE_OBJECT (script id %u) call for a nullptr gameobject, skipping.", script.id); return ShouldAbortScript(script); } @@ -1277,7 +1277,7 @@ bool Map::ScriptCommand_SetMeleeAttack(const ScriptInfo& script, WorldObject* so if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_MELEE_ATTACK (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_MELEE_ATTACK (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1294,7 +1294,7 @@ bool Map::ScriptCommand_SetCombatMovement(const ScriptInfo& script, WorldObject* if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_COMBAT_MOVEMENT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_COMBAT_MOVEMENT (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1311,7 +1311,7 @@ bool Map::ScriptCommand_SetPhase(const ScriptInfo& script, WorldObject* source, if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_PHASE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_PHASE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1355,7 +1355,7 @@ bool Map::ScriptCommand_SetPhaseRandom(const ScriptInfo& script, WorldObject* so if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_PHASE_RANDOM (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_PHASE_RANDOM (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1386,7 +1386,7 @@ bool Map::ScriptCommand_SetPhaseRange(const ScriptInfo& script, WorldObject* sou if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_PHASE_RANGE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_PHASE_RANGE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1407,7 +1407,7 @@ bool Map::ScriptCommand_Flee(const ScriptInfo& script, WorldObject* source, Worl if (!pSource) { - sLog.outError("SCRIPT_COMMAND_FLEE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_FLEE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1429,7 +1429,7 @@ bool Map::ScriptCommand_DealDamage(const ScriptInfo& script, WorldObject* source if (!pSource) { - sLog.outError("SCRIPT_COMMAND_DEAL_DAMAGE (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_DEAL_DAMAGE (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1437,7 +1437,7 @@ bool Map::ScriptCommand_DealDamage(const ScriptInfo& script, WorldObject* source if (!pTarget) { - sLog.outError("SCRIPT_COMMAND_DEAL_DAMAGE (script id %u) call for a NULL or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_DEAL_DAMAGE (script id %u) call for a nullptr or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1457,7 +1457,7 @@ bool Map::ScriptCommand_ZoneCombatPulse(const ScriptInfo& script, WorldObject* s if (!pSource) { - sLog.outError("SCRIPT_COMMAND_ZONE_COMBAT_PULSE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ZONE_COMBAT_PULSE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1476,7 +1476,7 @@ bool Map::ScriptCommand_CallForHelp(const ScriptInfo& script, WorldObject* sourc if (!pSource) { - sLog.outError("SCRIPT_COMMAND_CALL_FOR_HELP (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_CALL_FOR_HELP (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1495,7 +1495,7 @@ bool Map::ScriptCommand_SetSheath(const ScriptInfo& script, WorldObject* source, if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_SHEATH (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_SHEATH (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1511,7 +1511,7 @@ bool Map::ScriptCommand_Invincibility(const ScriptInfo& script, WorldObject* sou if (!pSource) { - sLog.outError("SCRIPT_COMMAND_INVINCIBILITY (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_INVINCIBILITY (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1551,7 +1551,7 @@ bool Map::ScriptCommand_CreatureSpells(const ScriptInfo& script, WorldObject* so if (!pSource) { - sLog.outError("SCRIPT_COMMAND_CREATURE_SPELLS (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_CREATURE_SPELLS (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1591,7 +1591,7 @@ bool Map::ScriptCommand_RemoveGuardians(const ScriptInfo& script, WorldObject* s if (!pSource) { - sLog.outError("SCRIPT_COMMAND_REMOVE_GUARDIANS (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_REMOVE_GUARDIANS (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1612,7 +1612,7 @@ bool Map::ScriptCommand_AddSpellCooldown(const ScriptInfo& script, WorldObject* if (!pSource) { - sLog.outError("SCRIPT_COMMAND_ADD_SPELL_COOLDOWN (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ADD_SPELL_COOLDOWN (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1630,7 +1630,7 @@ bool Map::ScriptCommand_RemoveSpellCooldown(const ScriptInfo& script, WorldObjec if (!pSource) { - sLog.outError("SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1649,7 +1649,7 @@ bool Map::ScriptCommand_SetReactState(const ScriptInfo& script, WorldObject* sou if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_REACT_STATE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_REACT_STATE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1665,7 +1665,7 @@ bool Map::ScriptCommand_StartWaypoints(const ScriptInfo& script, WorldObject* so if (!pSource) { - sLog.outError("SCRIPT_COMMAND_START_WAYPOINTS (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_START_WAYPOINTS (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1705,7 +1705,7 @@ bool Map::ScriptCommand_AddMapEventTarget(const ScriptInfo& script, WorldObject* { if (!source) { - sLog.outError("SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET (script id %u) call for a NULL source, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET (script id %u) call for a nullptr source, skipping.", script.id); return ShouldAbortScript(script); } @@ -1859,7 +1859,7 @@ bool Map::ScriptCommand_SetDefaultMovement(const ScriptInfo& script, WorldObject if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -1881,7 +1881,7 @@ bool Map::ScriptCommand_StartScriptForAll(const ScriptInfo& script, WorldObject* { if (!source) { - sLog.outError("SCRIPT_COMMAND_START_SCRIPT_FOR_ALL (script id %u) call for a NULL source, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_START_SCRIPT_FOR_ALL (script id %u) call for a nullptr source, skipping.", script.id); return ShouldAbortScript(script); } @@ -1968,7 +1968,7 @@ bool Map::ScriptCommand_FailQuest(const ScriptInfo& script, WorldObject* source, pSource->GroupEventFailHappens(script.failQuest.questId); else { - sLog.outError("SCRIPT_COMMAND_FAIL_QUEST (script id %u) call for a NULL object, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_FAIL_QUEST (script id %u) call for a nullptr object, skipping.", script.id); return ShouldAbortScript(script); } @@ -1982,7 +1982,7 @@ bool Map::ScriptCommand_RespawnCreature(const ScriptInfo& script, WorldObject* s if (!pSource) { - sLog.outError("SCRIPT_COMMAND_RESPAWN_CREATURE (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_RESPAWN_CREATURE (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2006,7 +2006,7 @@ bool Map::ScriptCommand_AssistUnit(const ScriptInfo& script, WorldObject* source if (!pSource) { - sLog.outError("SCRIPT_COMMAND_ASSIST_UNIT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ASSIST_UNIT (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2014,7 +2014,7 @@ bool Map::ScriptCommand_AssistUnit(const ScriptInfo& script, WorldObject* source if (!pTarget) { - sLog.outError("SCRIPT_COMMAND_ASSIST_UNIT (script id %u) call for a NULL or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ASSIST_UNIT (script id %u) call for a nullptr or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2050,7 +2050,7 @@ bool Map::ScriptCommand_CombatStop(const ScriptInfo& script, WorldObject* source if (!pSource) { - sLog.outError("SCRIPT_COMMAND_COMBAT_STOP (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_COMBAT_STOP (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2070,7 +2070,7 @@ bool Map::ScriptCommand_AddAura(const ScriptInfo& script, WorldObject* source, W if (!pSource) { - sLog.outError("SCRIPT_COMMAND_ADD_AURA (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ADD_AURA (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2086,7 +2086,7 @@ bool Map::ScriptCommand_AddThreat(const ScriptInfo& script, WorldObject* source, if (!pSource) { - sLog.outError("SCRIPT_COMMAND_ADD_THREAT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ADD_THREAT (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2097,7 +2097,7 @@ bool Map::ScriptCommand_AddThreat(const ScriptInfo& script, WorldObject* source, if (!pTarget) { - sLog.outError("SCRIPT_COMMAND_ADD_THREAT (script id %u) call for a NULL or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_ADD_THREAT (script id %u) call for a nullptr or non-unit target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2112,7 +2112,7 @@ bool Map::ScriptCommand_SummonObject(const ScriptInfo& script, WorldObject* sour { if (!source) { - sLog.outError("SCRIPT_COMMAND_SUMMON_OBJECT (script id %u) call for a NULL source, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_SUMMON_OBJECT (script id %u) call for a nullptr source, skipping.", script.id); return ShouldAbortScript(script); } @@ -2133,7 +2133,7 @@ bool Map::ScriptCommand_SetFly(const ScriptInfo& script, WorldObject* source, Wo if (!pSource) { - sLog.outError("SCRIPT_COMMAND_SET_FLY (script id %u) call for a NULL or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_SET_FLY (script id %u) call for a nullptr or non-unit source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2149,7 +2149,7 @@ bool Map::ScriptCommand_JoinCreatureGroup(const ScriptInfo& script, WorldObject* if (!pSource) { - sLog.outError("SCRIPT_COMMAND_JOIN_CREATURE_GROUP (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_JOIN_CREATURE_GROUP (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2157,7 +2157,7 @@ bool Map::ScriptCommand_JoinCreatureGroup(const ScriptInfo& script, WorldObject* if (!pTarget) { - sLog.outError("SCRIPT_COMMAND_JOIN_CREATURE_GROUP (script id %u) call for a NULL or non-creature target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_JOIN_CREATURE_GROUP (script id %u) call for a nullptr or non-creature target (TypeId: %u), skipping.", script.id, target ? target->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2173,7 +2173,7 @@ bool Map::ScriptCommand_LeaveCreatureGroup(const ScriptInfo& script, WorldObject if (!pSource) { - sLog.outError("SCRIPT_COMMAND_LEAVE_CREATURE_GROUP (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + sLog.outError("SCRIPT_COMMAND_LEAVE_CREATURE_GROUP (script id %u) call for a nullptr or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); return ShouldAbortScript(script); } @@ -2189,7 +2189,7 @@ bool Map::ScriptCommand_SetGoState(const ScriptInfo& script, WorldObject* source if (!((pGo = ToGameObject(target)) || (pGo = ToGameObject(source)))) { - sLog.outError("SCRIPT_COMMAND_SET_GO_STATE (script id %u) call for a NULL gameobject, skipping.", script.id); + sLog.outError("SCRIPT_COMMAND_SET_GO_STATE (script id %u) call for a nullptr gameobject, skipping.", script.id); return ShouldAbortScript(script); } diff --git a/src/game/Maps/ZoneScriptMgr.cpp b/src/game/Maps/ZoneScriptMgr.cpp index 71fb735bd..cad5cc474 100644 --- a/src/game/Maps/ZoneScriptMgr.cpp +++ b/src/game/Maps/ZoneScriptMgr.cpp @@ -55,7 +55,7 @@ void ZoneScriptMgr::InitMapZoneScripts(uint32 mapId, Map* pMap) pScript = (*it)->GetZoneScript(); if (!pScript) { - sLog.outError("Could not initialize ZoneScript object. Got NULL pointer from script."); + sLog.outError("Could not initialize ZoneScript object. Got nullptr pointer from script."); continue; } pScript->SetMap(pMap); diff --git a/src/game/Movement/TargetedMovementGenerator.cpp b/src/game/Movement/TargetedMovementGenerator.cpp index 3b47c1276..c7188a8ed 100644 --- a/src/game/Movement/TargetedMovementGenerator.cpp +++ b/src/game/Movement/TargetedMovementGenerator.cpp @@ -46,7 +46,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) bool losChecked = false; bool losResult = false; - Transport* transport = NULL; + Transport* transport = nullptr; bool isPet = (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->IsPet()); if (isPet) transport = i_target.getTarget()->GetTransport(); diff --git a/src/game/Movement/WaypointManager.h b/src/game/Movement/WaypointManager.h index 1851e7ad9..b5e79acb7 100644 --- a/src/game/Movement/WaypointManager.h +++ b/src/game/Movement/WaypointManager.h @@ -59,7 +59,7 @@ struct WaypointNode float wander_distance; uint32 script_id; // Added may 2010. WaypointBehavior w/DB data should in time be removed. WaypointBehavior * behavior; - WaypointNode() : x(0.0f), y(0.0f), z(0.0f), orientation(0.0f), delay(0), wander_distance(0.0f), script_id(0), behavior(NULL) {} + WaypointNode() : x(0.0f), y(0.0f), z(0.0f), orientation(0.0f), delay(0), wander_distance(0.0f), script_id(0), behavior(nullptr) {} WaypointNode(float _x, float _y, float _z, float _o, uint32 _delay, float _wander_distance, uint32 _script_id, WaypointBehavior * _behavior) : x(_x), y(_y), z(_z), orientation(_o), delay(_delay), script_id(_script_id), behavior(_behavior), wander_distance(_wander_distance) {} }; @@ -88,9 +88,9 @@ class WaypointManager // Creators need to be sure that creature_movement_template is always valid for summons. // Mob that can be summoned anywhere should not have creature_movement_template for example. - WaypointPath* GetDefaultPath(uint32 entry, uint32 lowGuid, WaypointPathOrigin* wpOrigin = NULL) + WaypointPath* GetDefaultPath(uint32 entry, uint32 lowGuid, WaypointPathOrigin* wpOrigin = nullptr) { - WaypointPath* path = NULL; + WaypointPath* path = nullptr; path = GetPath(lowGuid); if (path && wpOrigin) *wpOrigin = PATH_FROM_GUID; diff --git a/src/game/Movement/WaypointMovementGenerator.h b/src/game/Movement/WaypointMovementGenerator.h index 8e0bd8bd9..f4ef1bff9 100644 --- a/src/game/Movement/WaypointMovementGenerator.h +++ b/src/game/Movement/WaypointMovementGenerator.h @@ -71,7 +71,7 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator { public: WaypointMovementGenerator(Creature &, bool repeating = true) : i_nextMoveTime(0), m_isArrivalDone(false), m_repeating(repeating), m_lastReachedWaypoint(0), m_isWandering(false) {} - ~WaypointMovementGenerator() { i_path = NULL; } + ~WaypointMovementGenerator() { i_path = nullptr; } void Initialize(Creature &u); void Interrupt(Creature &); void Finalize(Creature &); diff --git a/src/game/Movement/spline/MoveSplineInit.cpp b/src/game/Movement/spline/MoveSplineInit.cpp index cac3dc55c..d47798ad8 100644 --- a/src/game/Movement/spline/MoveSplineInit.cpp +++ b/src/game/Movement/spline/MoveSplineInit.cpp @@ -61,7 +61,7 @@ int32 MoveSplineInit::Launch() float realSpeedRun = 0.0f; MoveSpline& move_spline = *unit.movespline; - Transport* newTransport = NULL; + Transport* newTransport = nullptr; if (args.transportGuid) newTransport = HashMapHolder::Find(ObjectGuid(HIGHGUID_MO_TRANSPORT, args.transportGuid)); Vector3 real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ()); @@ -70,7 +70,7 @@ int32 MoveSplineInit::Launch() if (!move_spline.Finalized()) { real_position = move_spline.ComputePosition(); - Transport* oldTransport = NULL; + Transport* oldTransport = nullptr; if (move_spline.GetTransportGuid()) oldTransport = HashMapHolder::Find(ObjectGuid(HIGHGUID_MO_TRANSPORT, move_spline.GetTransportGuid())); if (oldTransport) @@ -171,7 +171,7 @@ int32 MoveSplineInit::Launch() compress = false; #endif - MovementData mvtData(compress ? NULL : &unit); + MovementData mvtData(compress ? nullptr : &unit); // Nostalrius: client has a hardcoded limit to spline movement speed : 4*runSpeed. // We need to fix this, in case of charges for example (if character has movement slowing effects) if (args.velocity > 4 * realSpeedRun && !args.flags.done) // From client diff --git a/src/game/Movement/spline/util.cpp b/src/game/Movement/spline/util.cpp index 14e11aa7c..0498c7f91 100644 --- a/src/game/Movement/spline/util.cpp +++ b/src/game/Movement/spline/util.cpp @@ -194,7 +194,7 @@ void print_flags(Flags t, const char * (&names)[N], std::string& str) { for (int i = 0; i < N; ++i) { - if ((t & (Flags)(1 << i)) && names[i] != NULL) + if ((t & (Flags)(1 << i)) && names[i] != nullptr) str.append(" ").append(names[i]); } } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index f8d35fe96..7b4ea3a2f 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -56,13 +56,13 @@ Unit* ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid) { if (!guid) - return NULL; + return nullptr; if (guid.IsPlayer()) return FindPlayer(guid); if (!u.IsInWorld()) - return NULL; + return nullptr; return u.GetMap()->GetAnyTypeCreature(guid); } @@ -71,9 +71,9 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid) { Corpse * ret = HashMapHolder::Find(guid); if (!ret) - return NULL; + return nullptr; if (ret->GetMapId() != mapid) - return NULL; + return nullptr; return ret; } @@ -104,7 +104,7 @@ Player* ObjectAccessor::FindPlayerByNameNotInWorld(const char *name) if (it != playerNameToPlayerPointer.end()) return it->second; - return NULL; + return nullptr; } Player* ObjectAccessor::FindPlayerByName(const char *name) @@ -125,13 +125,13 @@ MasterPlayer* ObjectAccessor::FindMasterPlayer(const char *name) if (it != playerNameToMasterPlayerPointer.end()) return it->second; - return NULL; + return nullptr; } MasterPlayer* ObjectAccessor::FindMasterPlayer(ObjectGuid guid) { if (!guid) - return NULL; + return nullptr; return HashMapHolder::Find(guid);; } @@ -145,7 +145,7 @@ PlayerPointer ObjectAccessor::FindPlayerPointer(ObjectGuid guid) MasterPlayer* mplr = FindMasterPlayer(guid); if (mplr) return PlayerPointer(new PlayerWrapper(mplr)); - return PlayerPointer(NULL); + return PlayerPointer(nullptr); } PlayerPointer ObjectAccessor::FindPlayerPointer(const char* name) @@ -156,7 +156,7 @@ PlayerPointer ObjectAccessor::FindPlayerPointer(const char* name) MasterPlayer* mplr = FindMasterPlayer(name); if (mplr) return PlayerPointer(new PlayerWrapper(mplr)); - return PlayerPointer(NULL); + return PlayerPointer(nullptr); } void @@ -187,7 +187,7 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); if (iter == i_player2corpse.end()) - return NULL; + return nullptr; MANGOS_ASSERT(iter->second->GetType() != CORPSE_BONES); @@ -290,7 +290,7 @@ void ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, Player* loot void ObjectAccessor::RemoveOldCorpses() { - time_t now = time(NULL); + time_t now = time(nullptr); Player2CorpsesMapType::iterator next; for (Player2CorpsesMapType::iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); itr = next) { diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index def6c976b..2409ea083 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -72,7 +72,7 @@ class HashMapHolder { ReadGuard guard(i_lock); typename MapType::iterator itr = m_objectMap.find(guid); - return (itr != m_objectMap.end()) ? itr->second : NULL; + return (itr != m_objectMap.end()) ? itr->second : nullptr; } static MapType& GetContainer() { return m_objectMap; } @@ -116,7 +116,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton(Map* map, uint32 guid) template void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager &m, uint32 &count, Map* map, GridType& grid) { - BattleGround* bg = map->IsBattleGround() ? ((BattleGroundMap*)map)->GetBG() : NULL; + BattleGround* bg = map->IsBattleGround() ? ((BattleGroundMap*)map)->GetBG() : nullptr; for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid) { diff --git a/src/game/ObjectPosSelector.cpp b/src/game/ObjectPosSelector.cpp index ecd1bfb09..62ff53b45 100644 --- a/src/game/ObjectPosSelector.cpp +++ b/src/game/ObjectPosSelector.cpp @@ -40,8 +40,8 @@ ObjectPosSelector::ObjectPosSelector(float x, float y, float size, float dist) m_smallStepOk[USED_POS_PLUS] = false; m_smallStepOk[USED_POS_MINUS] = false; - m_smallStepNextUsedPos[USED_POS_PLUS] = NULL; - m_smallStepNextUsedPos[USED_POS_MINUS] = NULL; + m_smallStepNextUsedPos[USED_POS_PLUS] = nullptr; + m_smallStepNextUsedPos[USED_POS_MINUS] = nullptr; } ObjectPosSelector::UsedPosList::value_type const* ObjectPosSelector::nextUsedPos(UsedPosType uptype) @@ -55,7 +55,7 @@ ObjectPosSelector::UsedPosList::value_type const* ObjectPosSelector::nextUsedPos if (!m_UsedPosLists[~uptype].empty()) return &*m_UsedPosLists[~uptype].rbegin(); else - return NULL; + return nullptr; } else return &*itr; diff --git a/src/game/Objects/Bag.cpp b/src/game/Objects/Bag.cpp index 81161424b..435ad1643 100644 --- a/src/game/Objects/Bag.cpp +++ b/src/game/Objects/Bag.cpp @@ -85,7 +85,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, ObjectGuid ownerGuid) for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid()); - m_bagslot[i] = NULL; + m_bagslot[i] = nullptr; } return true; @@ -110,7 +110,7 @@ bool Bag::LoadFromDB(uint32 guidLow, ObjectGuid ownerGuid, Field* fields, uint32 if (m_bagslot[i]) { delete m_bagslot[i]; - m_bagslot[i] = NULL; + m_bagslot[i] = nullptr; } } @@ -141,9 +141,9 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/) MANGOS_ASSERT(slot < MAX_BAG_SIZE); if (m_bagslot[slot]) - m_bagslot[slot]->SetContainer(NULL); + m_bagslot[slot]->SetContainer(nullptr); - m_bagslot[slot] = NULL; + m_bagslot[slot] = nullptr; SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid()); } @@ -187,7 +187,7 @@ Item* Bag::GetItemByEntry(uint32 item) const if (m_bagslot[i] && m_bagslot[i]->GetEntry() == item) return m_bagslot[i]; - return NULL; + return nullptr; } uint32 Bag::GetItemCount(uint32 item, Item* eItem) const @@ -217,5 +217,5 @@ Item* Bag::GetItemByPos(uint8 slot) const if (slot < GetBagSize()) return m_bagslot[slot]; - return NULL; + return nullptr; } diff --git a/src/game/Objects/Bag.h b/src/game/Objects/Bag.h index 24577f785..95b4ca659 100644 --- a/src/game/Objects/Bag.h +++ b/src/game/Objects/Bag.h @@ -48,7 +48,7 @@ class Bag : public Item Item* GetItemByPos(uint8 slot) const; Item* GetItemByEntry(uint32 item) const; - uint32 GetItemCount(uint32 item, Item* eItem = NULL) const; + uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const; uint8 GetSlotByItemGUID(ObjectGuid guid) const; bool IsEmpty() const; diff --git a/src/game/Objects/Corpse.cpp b/src/game/Objects/Corpse.cpp index 9352f3c5e..3b7b131cc 100644 --- a/src/game/Objects/Corpse.cpp +++ b/src/game/Objects/Corpse.cpp @@ -30,7 +30,7 @@ #include "World.h" #include "ObjectMgr.h" -Corpse::Corpse(CorpseType type) : WorldObject(), loot(NULL), lootRecipient(NULL), m_faction(NULL) +Corpse::Corpse(CorpseType type) : WorldObject(), loot(nullptr), lootRecipient(nullptr), m_faction(nullptr) { m_objectType |= TYPEMASK_CORPSE; m_objectTypeId = TYPEID_CORPSE; @@ -40,7 +40,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(), loot(NULL), lootRecipient(NULL) m_type = type; - m_time = time(NULL); + m_time = time(nullptr); lootForBody = false; } diff --git a/src/game/Objects/Corpse.h b/src/game/Objects/Corpse.h index 0e117aee3..19d9d9a5e 100644 --- a/src/game/Objects/Corpse.h +++ b/src/game/Objects/Corpse.h @@ -71,7 +71,7 @@ class Corpse : public WorldObject ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(CORPSE_FIELD_OWNER); } time_t const& GetGhostTime() const { return m_time; } - void ResetGhostTime() { m_time = time(NULL); } + void ResetGhostTime() { m_time = time(nullptr); } CorpseType GetType() const { return m_type; } ReputationRank GetReactionTo(WorldObject const* target) const final override; diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 9e1e2b80f..38430853f 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -266,7 +266,7 @@ void Creature::RemoveCorpse() /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 Entry, Team team, CreatureData const* data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/) +bool Creature::InitEntry(uint32 Entry, Team team, CreatureData const* data /*=nullptr*/, GameEventCreatureData const* eventData /*=nullptr*/) { // use game event entry if any instead default suggested if (eventData && eventData->entry_id) @@ -423,7 +423,7 @@ void Creature::UnloadCreatureAddon(const CreatureDataAddon* data) } } -bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/, bool preserveHPAndPower /*=true*/) +bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData *data /*=nullptr*/, GameEventCreatureData const* eventData /*=nullptr*/, bool preserveHPAndPower /*=true*/) { bool addonReload = false; @@ -552,7 +552,7 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData *data /*= return true; } -uint32 Creature::ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *data /*= NULL*/, GameEventCreatureData const* eventData /*=NULL*/) +uint32 Creature::ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *data /*= nullptr*/, GameEventCreatureData const* eventData /*=nullptr*/) { // Use creature event model explicit, override any other static models if (eventData && eventData->modelid) @@ -1026,7 +1026,7 @@ bool Creature::AIM_Initialize() return true; } -bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team, uint32 firstCreatureId, const CreatureData *data /*= NULL*/, GameEventCreatureData const* eventData /*= NULL*/) +bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team, uint32 firstCreatureId, const CreatureData *data /*= nullptr*/, GameEventCreatureData const* eventData /*= nullptr*/) { SetMap(cPos.GetMap()); @@ -1254,7 +1254,7 @@ bool Creature::CanTrainAndResetTalentsOf(Player* pPlayer) const */ Player* Creature::GetOriginalLootRecipient() const { - return m_lootRecipientGuid ? ObjectAccessor::FindPlayer(m_lootRecipientGuid) : NULL; + return m_lootRecipientGuid ? ObjectAccessor::FindPlayer(m_lootRecipientGuid) : nullptr; } /** @@ -1263,7 +1263,7 @@ Player* Creature::GetOriginalLootRecipient() const Group* Creature::GetGroupLootRecipient() const { // original recipient group if set and not disbanded - return m_lootGroupRecipientId ? sObjectMgr.GetGroupById(m_lootGroupRecipientId) : NULL; + return m_lootGroupRecipientId ? sObjectMgr.GetGroupById(m_lootGroupRecipientId) : nullptr; } /** @@ -1306,7 +1306,7 @@ void Creature::SetLootRecipient(Unit *unit) { // set the player whose group should receive the right // to loot the creature after it dies - // should be set to NULL after the loot disappears + // should be set to nullptr after the loot disappears if (!unit) { @@ -1566,7 +1566,7 @@ float Creature::GetSpellDamageMod(int32 Rank) } } -bool Creature::CreateFromProto(uint32 guidlow, CreatureInfo const* cinfo, Team team, uint32 firstCreatureId, const CreatureData *data /*=NULL*/, GameEventCreatureData const* eventData /*=NULL*/) +bool Creature::CreateFromProto(uint32 guidlow, CreatureInfo const* cinfo, Team team, uint32 firstCreatureId, const CreatureData *data /*=nullptr*/, GameEventCreatureData const* eventData /*=nullptr*/) { SetZoneScript(); m_originalEntry = cinfo->entry; @@ -2920,7 +2920,7 @@ VendorItemData const* Creature::GetVendorItems() const VendorItemData const* Creature::GetVendorTemplateItems() const { uint32 vendorId = GetCreatureInfo()->vendor_id; - return vendorId ? sObjectMgr.GetNpcVendorTemplateItemList(vendorId) : NULL; + return vendorId ? sObjectMgr.GetNpcVendorTemplateItemList(vendorId) : nullptr; } uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) @@ -3005,7 +3005,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us TrainerSpellData const* Creature::GetTrainerTemplateSpells() const { uint32 trainerId = GetCreatureInfo()->trainer_id; - return trainerId ? sObjectMgr.GetNpcTrainerTemplateSpells(trainerId) : NULL; + return trainerId ? sObjectMgr.GetNpcTrainerTemplateSpells(trainerId) : nullptr; } TrainerSpellData const* Creature::GetTrainerSpells() const diff --git a/src/game/Objects/GameObject.cpp b/src/game/Objects/GameObject.cpp index d94f4dea0..b0149a64b 100644 --- a/src/game/Objects/GameObject.cpp +++ b/src/game/Objects/GameObject.cpp @@ -49,7 +49,7 @@ GameObject::GameObject() : WorldObject(), loot(this), - m_goInfo(NULL), + m_goInfo(nullptr), m_visible(true) { m_objectType |= TYPEMASK_GAMEOBJECT; @@ -64,8 +64,8 @@ GameObject::GameObject() : WorldObject(), m_useTimes = 0; m_spellId = 0; m_cooldownTime = 0; - i_AI = NULL; - m_model = NULL; + i_AI = nullptr; + m_model = nullptr; m_rotation = 0; m_playerGroupId = 0; m_summonTarget = ObjectGuid(); @@ -288,14 +288,14 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) // Unit* owner = GetOwner(); // if (owner && ((Player*)owner)->isInCombat()) if (GetGOInfo()->trap.startDelay) - m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay; + m_cooldownTime = time(nullptr) + GetGOInfo()->trap.startDelay; m_lootState = GO_READY; break; } case GAMEOBJECT_TYPE_FISHINGNODE: { // fishing code (bobber ready) - if (time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME) + if (time(nullptr) > m_respawnTime - FISHING_BOBBER_READY_TIME) { // splash bobber (bobber ready now) Unit* caster = GetOwner(); @@ -325,7 +325,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) { if (m_respawnTime > 0) // timer on { - if (m_respawnTime <= time(NULL)) // timer expired + if (m_respawnTime <= time(nullptr)) // timer expired { m_respawnTime = 0; ClearAllUsesData(); @@ -386,12 +386,12 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) GameObjectInfo const* goInfo = GetGOInfo(); if (goInfo->type == GAMEOBJECT_TYPE_TRAP) { - if (m_cooldownTime >= time(NULL)) + if (m_cooldownTime >= time(nullptr)) return; // traps Unit* owner = GetOwner(); - Unit* ok = NULL; // pointer to appropriate target if found any + Unit* ok = nullptr; // pointer to appropriate target if found any bool IsBattleGroundTrap = false; //FIXME: this is activation radius (in different casting radius that must be selected from spell data) @@ -444,7 +444,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) // environmental damage spells already have around enemies targeting but this not help in case nonexistent GO casting support // affect only players - Player* p_ok = NULL; + Player* p_ok = nullptr; MaNGOS::AnyPlayerInObjectRangeCheck p_check(this, radius); MaNGOS::PlayerSearcher checker(p_ok, p_check); Cell::VisitWorldObjects(this, checker, radius); @@ -459,7 +459,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) CastSpell(ok, goInfo->trap.spellId, true, nullptr, nullptr, GetObjectGuid()); // use template cooldown if provided - m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); + m_cooldownTime = time(nullptr) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); // count charges if (goInfo->trap.charges > 0) @@ -506,19 +506,19 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) { case GAMEOBJECT_TYPE_DOOR: // Ustaag { - if ((m_cooldownTime < time(NULL)) && (GetGOInfo()->GetAutoCloseTime() != 0)) + if ((m_cooldownTime < time(nullptr)) && (GetGOInfo()->GetAutoCloseTime() != 0)) ResetDoorOrButton(); break; } case GAMEOBJECT_TYPE_BUTTON: { - if ((m_cooldownTime < time(NULL)) && (GetGOInfo()->GetAutoCloseTime() != 0)) // Ustaag - //if (m_respawnDelayTime && (m_cooldownTime < time(NULL))) + if ((m_cooldownTime < time(nullptr)) && (GetGOInfo()->GetAutoCloseTime() != 0)) // Ustaag + //if (m_respawnDelayTime && (m_cooldownTime < time(nullptr))) ResetDoorOrButton(); break; } case GAMEOBJECT_TYPE_GOOBER: - if (m_cooldownTime < time(NULL)) + if (m_cooldownTime < time(nullptr)) { RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); @@ -544,7 +544,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) for (GuidsSet::const_iterator itr = m_UniqueUsers.begin(); itr != m_UniqueUsers.end(); ++itr) { if (Player* owner = GetMap()->GetPlayer(*itr)) - owner->CastSpell(owner, spellId, false, NULL, NULL, GetObjectGuid()); + owner->CastSpell(owner, spellId, false, nullptr, nullptr, GetObjectGuid()); } ClearAllUsesData(); @@ -588,7 +588,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) if (m_spawnedByDefault) { - m_respawnTime = time(NULL) + ComputeRespawnDelay(); + m_respawnTime = time(nullptr) + ComputeRespawnDelay(); } else m_respawnTime = 0; @@ -914,7 +914,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) m_respawnTime = map->GetPersistentState()->GetGORespawnTime(GetGUIDLow()); // ready to respawn - if (m_respawnTime && m_respawnTime <= time(NULL)) + if (m_respawnTime && m_respawnTime <= time(nullptr)) { m_respawnTime = 0; map->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), 0); @@ -1005,13 +1005,13 @@ bool GameObject::IsTransport() const Unit* GameObject::GetOwner() const { if (!FindMap()) - return NULL; + return nullptr; return FindMap()->GetUnit(GetOwnerGuid()); } void GameObject::SaveRespawnTime() { - if (m_respawnTime > time(NULL) && m_spawnedByDefault) + if (m_respawnTime > time(nullptr) && m_spawnedByDefault) GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), m_respawnTime); } @@ -1073,7 +1073,7 @@ void GameObject::Respawn() { if (m_spawnedByDefault && m_respawnTime > 0) { - m_respawnTime = time(NULL); + m_respawnTime = time(nullptr); GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), 0); } } @@ -1204,7 +1204,7 @@ void GameObject::TriggerLinkedGameObject(Unit* target) range = Spells::GetSpellMaxRange(sSpellRangeStore.LookupEntry(trapSpell->rangeIndex)); // search nearest linked GO - GameObject* trapGO = NULL; + GameObject* trapGO = nullptr; { // search closest with base of used GO, using max range of trap spell as search radius (why? See above) @@ -1233,7 +1233,7 @@ void GameObject::RespawnLinkedGameObject() float range = 0.5f; // search nearest linked GO - GameObject* trapGO = NULL; + GameObject* trapGO = nullptr; { // search closest with base of used GO, using max range of trap spell as search radius MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*this, trapEntry, range); @@ -1249,7 +1249,7 @@ void GameObject::RespawnLinkedGameObject() GameObject* GameObject::LookupFishingHoleAround(float range) { - GameObject* ok = NULL; + GameObject* ok = nullptr; MaNGOS::NearestGameObjectFishingHoleCheck u_check(*this, range); MaNGOS::GameObjectSearcher checker(ok, u_check); @@ -1280,7 +1280,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f SwitchDoorOrButton(true, alternative); SetLootState(GO_ACTIVATED); - m_cooldownTime = time(NULL) + time_to_restore; + m_cooldownTime = time(nullptr) + time_to_restore; } void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */) @@ -1543,7 +1543,7 @@ void GameObject::Use(Unit* user) else SetGoState(GO_STATE_ACTIVE); - m_cooldownTime = time(NULL) + time_to_restore; + m_cooldownTime = time(nullptr) + time_to_restore; // cast this spell later if provided spellId = info->goober.spellId; @@ -1609,7 +1609,7 @@ void GameObject::Use(Unit* user) // normal chance bool success = skill >= zone_skill && chance >= roll; - GameObject* fishingHole = NULL; + GameObject* fishingHole = nullptr; // overwrite fail in case fishhole if allowed (after 3.3.0) if (!success) @@ -2284,7 +2284,7 @@ void GameObject::SpawnInMaps(uint32 db_guid, GameObjectData const* data) bool GameObject::HasStaticDBSpawnData() const { - return sObjectMgr.GetGOData(GetGUIDLow()) != NULL; + return sObjectMgr.GetGOData(GetGUIDLow()) != nullptr; } void GameObject::UpdateCollisionState() diff --git a/src/game/Objects/GameObject.h b/src/game/Objects/GameObject.h index 29292021f..fe14f25be 100644 --- a/src/game/Objects/GameObject.h +++ b/src/game/Objects/GameObject.h @@ -624,7 +624,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject time_t GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const { - time_t now = time(NULL); + time_t now = time(nullptr); if(m_respawnTime > now) return m_respawnTime; else @@ -635,7 +635,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void JustDespawnedWaitingRespawn(); void SetRespawnTime(time_t respawn) { - m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0; + m_respawnTime = respawn > 0 ? time(nullptr) + respawn : 0; m_respawnDelayTime = respawn > 0 ? uint32(respawn) : 0; } void SetRespawnDelay(time_t respawn) @@ -755,8 +755,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject // Transports system uint64 GetRotation() const { return m_rotation; } - Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return NULL; } - Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return NULL; } + Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return nullptr; } + Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return nullptr; } bool IsVisible() const { return m_visible; } void SetVisible(bool b); diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 723d22d39..2cfa077dd 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -2429,7 +2429,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, UpdateGroundPositionZ(x, y, z); } -void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NULL*/) const +void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= nullptr*/) const { // Nostalrius: ignored by client if unit is not loaded WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 4 + 8); @@ -2441,7 +2441,7 @@ void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NU SendObjectMessageToSet(&data, true); } -void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL*/) const +void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= nullptr*/) const { WorldPacket data(SMSG_PLAY_SOUND, 4); data << uint32(sound_id); @@ -2451,7 +2451,7 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL SendMessageToSet(&data, true); } -void WorldObject::PlayDirectMusic(uint32 music_id, Player const* target /*= NULL*/) const +void WorldObject::PlayDirectMusic(uint32 music_id, Player const* target /*= nullptr*/) const { WorldPacket data(SMSG_PLAY_MUSIC, 4); data << uint32(music_id); @@ -4123,7 +4123,7 @@ uint32 WorldObject::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAt // differentiate for weapon damage based spells bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || spellProto->HasEffect(SPELL_EFFECT_SCHOOL_DAMAGE))); - Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType, true, false) : NULL; + Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType, true, false) : nullptr; uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); uint32 schoolMask = spellProto ? spellProto->GetSpellSchoolMask() : GetMeleeDamageSchoolMask(); @@ -4397,7 +4397,7 @@ uint32 WorldObject::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellP float DoneTotalMod = 1.0f; int32 DoneTotal = 0; - Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(BASE_ATTACK, true, false) : NULL; + Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(BASE_ATTACK, true, false) : nullptr; // Creature damage if (GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet()) @@ -4736,7 +4736,7 @@ bool WorldObject::CheckAndIncreaseCastCounter() void WorldObject::SetCurrentCastedSpell(Spell * pSpell) { - MANGOS_ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells + MANGOS_ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer(); @@ -5056,9 +5056,9 @@ void WorldObject::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool trig Spell *spell; if (Unit* pUnit = ToUnit()) - spell = new Spell(pUnit, spellInfo, triggered, originalCaster, triggeredBy, NULL, triggeredByParent); + spell = new Spell(pUnit, spellInfo, triggered, originalCaster, triggeredBy, nullptr, triggeredByParent); else if (GameObject* pGameObject = ToGameObject()) - spell = new Spell(pGameObject, spellInfo, triggered, originalCaster, triggeredBy, NULL, triggeredByParent); + spell = new Spell(pGameObject, spellInfo, triggered, originalCaster, triggeredBy, nullptr, triggeredByParent); else return; diff --git a/src/game/Objects/Pet.cpp b/src/game/Objects/Pet.cpp index de7b44081..bc2ea455b 100644 --- a/src/game/Objects/Pet.cpp +++ b/src/game/Objects/Pet.cpp @@ -1076,7 +1076,7 @@ bool Pet::CanLearnPetSpell(uint32 spellId) const return false; } -void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/) +void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= nullptr*/) { if (m_removed || m_unSummoned) return; @@ -1096,7 +1096,7 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/) return; } - Player* p_owner = owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : NULL; + Player* p_owner = owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : nullptr; if (p_owner) { @@ -1267,7 +1267,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) { if (!creature) { - sLog.outError("CRITICAL: NULL pointer passed into CreateBaseAtCreature()"); + sLog.outError("CRITICAL: nullptr pointer passed into CreateBaseAtCreature()"); return false; } @@ -2127,7 +2127,7 @@ void Pet::InitPetCreateSpells() if (CreateSpells) { Unit* owner = GetOwner(); - Player* p_owner = owner && owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : NULL; + Player* p_owner = owner && owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : nullptr; for (uint8 i = 0; i < 4; ++i) { diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index e1fbb9b6b..68d1cbf9c 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -272,7 +272,7 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi) } SpellModifier::SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, SpellEffectIndex eff, int16 _charges /*= 0*/) : - op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), ownerAura(NULL) + op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), ownerAura(nullptr) { mask = sSpellMgr.GetSpellAffectMask(spellEntry->Id, eff); } @@ -286,7 +286,7 @@ SpellModifier::SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, A bool SpellModifier::isAffectedOnSpell(SpellEntry const *spell) const { SpellEntry const *affect_spell = sSpellMgr.GetSpellEntry(spellId); - // False if affect_spell == NULL or spellFamily not equal + // False if affect_spell == nullptr or spellFamily not equal if (!affect_spell || affect_spell->SpellFamilyName != spell->SpellFamilyName) return false; return spell->IsFitToFamilyMask(mask); @@ -301,7 +301,7 @@ TradeData* TradeData::GetTraderData() const Item* TradeData::GetItem(TradeSlots slot) const { - return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL; + return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : nullptr; } bool TradeData::HasItem(ObjectGuid item_guid) const @@ -339,7 +339,7 @@ void TradeData::FillTransactionLog(TransactionPart& log) const Item* TradeData::GetSpellCastItem() const { - return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL; + return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : nullptr; } void TradeData::SetItem(TradeSlots slot, Item* item) @@ -364,7 +364,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item) SetSpell(0); } -void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/) +void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= nullptr*/) { ObjectGuid itemGuid = castItem ? castItem->GetObjectGuid() : ObjectGuid(); @@ -474,11 +474,11 @@ Player::Player(WorldSession *session) : Unit(), memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT); // group is initialized in the reference constructor - SetGroupInvite(NULL); + SetGroupInvite(nullptr); m_groupUpdateMask = 0; m_auraUpdateMask = 0; - duel = NULL; + duel = nullptr; m_GuildIdInvited = 0; @@ -494,7 +494,7 @@ Player::Player(WorldSession *session) : Unit(), m_bHasBeenAliveAtDelayedTeleport = true; // overwrite always at setup teleport data, so not used infact m_teleport_options = 0; - m_trade = NULL; + m_trade = nullptr; m_cinematic = 0; @@ -524,7 +524,7 @@ Player::Player(WorldSession *session) : Unit(), m_bgBattleGroundQueueID[j].invitedToInstance = 0; } - m_logintime = time(NULL); + m_logintime = time(nullptr); m_Last_tick = m_logintime; m_WeaponProficiency = 0; m_ArmorProficiency = 0; @@ -575,7 +575,7 @@ Player::Player(WorldSession *session) : Unit(), // Phasing worldMask = WORLD_DEFAULT_CHAR; - i_AI = NULL; + i_AI = nullptr; _playerOptions = 0x0; m_DbSaveDisabled = false; @@ -676,7 +676,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c } for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i) - m_items[i] = NULL; + m_items[i] = nullptr; SetLocationMapId(info->mapId); Relocate(info->positionX, info->positionY, info->positionZ, info->orientation); @@ -736,7 +736,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c SetUInt32Value(PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_UINT32_START_PLAYER_MONEY)); // Played time - m_Last_tick = time(NULL); + m_Last_tick = time(nullptr); m_Played_time[PLAYED_TIME_TOTAL] = 0; m_Played_time[PLAYED_TIME_LEVEL] = 0; @@ -852,7 +852,7 @@ Item* Player::StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount) return pItem; } - return NULL; + return nullptr; } void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen) @@ -891,9 +891,9 @@ uint32 Player::EnvironmentalDamage(EnvironmentalDamageType type, uint32 damage) int32 resist = 0; if ((type == DAMAGE_LAVA) || (type == DAMAGE_FIRE)) - CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist, NULL); + CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist, nullptr); else if (type == DAMAGE_SLIME) - CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist, NULL); + CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist, nullptr); const uint32 bonus = (resist < 0 ? uint32(std::abs(resist)) : 0); damage += bonus; @@ -904,7 +904,7 @@ uint32 Player::EnvironmentalDamage(EnvironmentalDamageType type, uint32 damage) SendEnvironmentalDamageLog(type, damage, absorb, resist); - uint32 final_damage = DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + uint32 final_damage = DealDamage(this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); if (type == DAMAGE_FALL && !isAlive()) // DealDamage not apply item durability loss at self damage { @@ -1129,7 +1129,7 @@ void Player::Update(uint32 update_diff, uint32 p_time) i_AI->UpdateAI(p_time); SetCanDelayTeleport(false); - time_t now = time(NULL); + time_t now = time(nullptr); UpdatePvPFlagTimer(update_diff); @@ -1195,13 +1195,13 @@ void Player::Update(uint32 update_diff, uint32 p_time) { if (roll_chance_i(3) && GetTimeInnEnter() > 0) //freeze update { - time_t time_inn = time(NULL) - GetTimeInnEnter(); + time_t time_inn = time(nullptr) - GetTimeInnEnter(); if (time_inn >= 10) //freeze update { float bubble = 0.125f * sWorld.getConfig(CONFIG_FLOAT_RATE_REST_INGAME); //speed collect rest bonus (section/in hour) SetRestBonus(GetRestBonus() + time_inn * ((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000)*bubble); - UpdateInnerTime(time(NULL)); + UpdateInnerTime(time(nullptr)); } } } @@ -1452,8 +1452,8 @@ void Player::UpdateCinematic(uint32 diff) return; cinematic_last_check = cinematic_elapsed_time; - Position const* tpPosition = NULL; - if ((tpPosition = sObjectMgr.GetCinematicPosition(watching_cinematic_entry, cinematic_elapsed_time)) == NULL) + Position const* tpPosition = nullptr; + if ((tpPosition = sObjectMgr.GetCinematicPosition(watching_cinematic_entry, cinematic_elapsed_time)) == nullptr) tpPosition = sObjectMgr.GetCinematicInitialPosition(watching_cinematic_entry); if (!tpPosition) @@ -1930,7 +1930,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati } else { - Map* oldmap = IsInWorld() ? GetMap() : NULL; + Map* oldmap = IsInWorld() ? GetMap() : nullptr; // check if we can enter before stopping combat / removing pet / totems / interrupting spells // Check enter rights before map getting to avoid creating instance copy for player @@ -1960,7 +1960,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati bool Player::ExecuteTeleportFar(ScheduledTeleportData *data) { - Map* oldmap = IsInWorld() ? GetMap() : NULL; + Map* oldmap = IsInWorld() ? GetMap() : nullptr; // check if we can enter before stopping combat / removing pet / totems / interrupting spells // Check enter rights before map getting to avoid creating instance copy for player @@ -2748,7 +2748,7 @@ bool Player::IsGroupVisibleFor(Player const* p) const bool Player::IsInSameGroupWith(Player const* p) const { - return (p == this || (GetGroup() != NULL && + return (p == this || (GetGroup() != nullptr && GetGroup()->SameSubGroup((Player*)this, (Player*)p))); } @@ -2785,7 +2785,7 @@ void Player::RemoveFromGroup(Group* group, ObjectGuid guid) // group->Disband(); already disbanded in RemoveMember sObjectMgr.RemoveGroup(group); delete group; - // removemember sets the player's group pointer to NULL + // removemember sets the player's group pointer to nullptr } } } @@ -3715,7 +3715,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) // last check 1.12 WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + m_spells.size() * 8); data << GetObjectGuid(); - time_t curTime = time(NULL); + time_t curTime = time(nullptr); for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) @@ -3751,7 +3751,7 @@ void Player::_LoadSpellCooldowns(QueryResult *result) if (result) { - time_t curTime = time(NULL); + time_t curTime = time(nullptr); do { @@ -3806,7 +3806,7 @@ void Player::_SaveSpellCooldowns() SqlStatement stmt = CharacterDatabase.CreateStatement(deleteSpellCooldown, "DELETE FROM character_spell_cooldown WHERE guid = ?"); stmt.PExecute(GetGUIDLow()); - time_t curTime = time(NULL); + time_t curTime = time(nullptr); time_t infTime = curTime + infinityCooldownDelayCheck; // remove outdated and save active @@ -3940,7 +3940,7 @@ bool Player::ResetTalents(bool no_cost) m_resetTalentsMultiplier = sWorld.getConfig(CONFIG_UINT32_RESPEC_MAX_MULTIPLIER); } - m_resetTalentsTime = time(NULL); + m_resetTalentsTime = time(nullptr); } //FIXME: remove pet before or after unlearn spells? for now after unlearn to allow removing of talent related, pet affecting auras @@ -4079,21 +4079,21 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c { for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); } for (int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); } for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); @@ -4109,7 +4109,7 @@ void Player::DestroyForPlayer(Player *target) const for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->DestroyForPlayer(target); @@ -4119,14 +4119,14 @@ void Player::DestroyForPlayer(Player *target) const { for (int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->DestroyForPlayer(target); } for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->DestroyForPlayer(target); @@ -4409,7 +4409,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe } // The character gets unlinked from the account, the name gets freed up and appears as deleted ingame case 1: - CharacterDatabase.PExecute("UPDATE characters SET deleteInfos_Name=name, deleteInfos_Account=account, deleteDate='" UI64FMTD "', name='', account=0 WHERE guid=%u", uint64(time(NULL)), lowguid); + CharacterDatabase.PExecute("UPDATE characters SET deleteInfos_Name=name, deleteInfos_Account=account, deleteDate='" UI64FMTD "', name='', account=0 WHERE guid=%u", uint64(time(nullptr)), lowguid); break; default: sLog.outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); @@ -4442,7 +4442,7 @@ void Player::DeleteOldCharacters() */ void Player::DeleteOldCharacters(uint32 keepDays) { - QueryResult *resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "' LIMIT 0,2", uint64(time(NULL) - time_t(keepDays * DAY))); + QueryResult *resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "' LIMIT 0,2", uint64(time(nullptr) - time_t(keepDays * DAY))); if (resultChars) { do @@ -4628,7 +4628,7 @@ Corpse* Player::CreateCorpse() if (!corpse->Create(sObjectMgr.GenerateCorpseLowGuid(), this)) { delete corpse; - return NULL; + return nullptr; } uint8 skin = GetByteValue(PLAYER_BYTES, 0); @@ -6125,7 +6125,7 @@ void Player::CheckAreaExploreAndOutdoor() else XP = uint32(sObjectMgr.GetBaseXP(p->AreaLevel) * explorationRate); - GiveXP(XP, NULL); + GiveXP(XP, nullptr); SendExplorationExperience(area, XP); } DETAIL_LOG("PLAYER: Player %u discovered a new area: %u", GetGUIDLow(), area); @@ -7122,8 +7122,8 @@ void Player::UpdateEquipSpellsAtFormChange() if (!spellInfo) continue; - ApplyEquipSpell(spellInfo, NULL, false, true); // remove spells that not fit to form - ApplyEquipSpell(spellInfo, NULL, true, true); // add spells that fit form but not active + ApplyEquipSpell(spellInfo, nullptr, false, true); // remove spells that not fit to form + ApplyEquipSpell(spellInfo, nullptr, true, true); // add spells that fit form but not active } } } @@ -7605,7 +7605,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, Player* pVictim) bones->loot.clear(); // It may need a better formula // Now it works like this: lvl10: ~6copper, lvl70: ~9silver - if (pVictim != NULL) + if (pVictim != nullptr) { uint32 level = pVictim->getLevel(); bones->loot.gold = (uint32)(urand(50, 150) * 0.016f * pow(((float)level) / 5.76f, 2.5f) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); @@ -8172,26 +8172,26 @@ void Player::SetSheath(SheathState sheathed) switch (sheathed) { case SHEATH_STATE_UNARMED: // no prepared weapon - SetVirtualItemSlot(0, NULL); - SetVirtualItemSlot(1, NULL); - SetVirtualItemSlot(2, NULL); + SetVirtualItemSlot(0, nullptr); + SetVirtualItemSlot(1, nullptr); + SetVirtualItemSlot(2, nullptr); break; case SHEATH_STATE_MELEE: // prepared melee weapon { SetVirtualItemSlot(0, GetWeaponForAttack(BASE_ATTACK, true, true)); SetVirtualItemSlot(1, GetWeaponForAttack(OFF_ATTACK, true, true)); - SetVirtualItemSlot(2, NULL); + SetVirtualItemSlot(2, nullptr); }; break; case SHEATH_STATE_RANGED: // prepared ranged weapon - SetVirtualItemSlot(0, NULL); - SetVirtualItemSlot(1, NULL); + SetVirtualItemSlot(0, nullptr); + SetVirtualItemSlot(1, nullptr); SetVirtualItemSlot(2, GetWeaponForAttack(RANGED_ATTACK, true, true)); break; default: - SetVirtualItemSlot(0, NULL); - SetVirtualItemSlot(1, NULL); - SetVirtualItemSlot(2, NULL); + SetVirtualItemSlot(0, nullptr); + SetVirtualItemSlot(1, nullptr); + SetVirtualItemSlot(2, nullptr); break; } Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players... @@ -8496,7 +8496,7 @@ Item* Player::GetItemByGuid(ObjectGuid guid) const if (pItem->GetObjectGuid() == guid) return pItem; - return NULL; + return nullptr; } Item* Player::GetItemByPos(uint16 pos) const @@ -8517,7 +8517,7 @@ Item* Player::GetItemByPos(uint8 bag, uint8 slot) const if (pBag) return pBag->GetItemByPos(slot); } - return NULL; + return nullptr; } Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bool useable) const @@ -8535,18 +8535,18 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bo slot = EQUIPMENT_SLOT_RANGED; break; default: - return NULL; + return nullptr; } Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (!item || item->GetProto()->Class != ITEM_CLASS_WEAPON) - return NULL; + return nullptr; if (useable && !CanUseEquippedWeapon(attackType)) - return NULL; + return nullptr; if (nonbroken && item->IsBroken()) - return NULL; + return nullptr; return item; } @@ -8795,7 +8795,7 @@ InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, Item // ignore move item (this slot will be empty at move) if (pItem2 == pSrcItem) - pItem2 = NULL; + pItem2 = nullptr; // Fix dupe exploit (move non empty bag) if (pSrcItem && pSrcItem->IsBag() && !((Bag*)pSrcItem)->IsEmpty()) @@ -8904,10 +8904,10 @@ InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, It // ignore move item (this slot will be empty at move) if (pItem2 == pSrcItem) - pItem2 = NULL; + pItem2 = nullptr; // if merge skip empty, if !merge skip non-empty - if ((pItem2 != NULL) != merge) + if ((pItem2 != nullptr) != merge) continue; uint32 need_space = pProto->GetMaxStackSize(); @@ -8957,10 +8957,10 @@ InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 s // ignore move item (this slot will be empty at move) if (pItem2 == pSrcItem) - pItem2 = NULL; + pItem2 = nullptr; // if merge skip empty, if !merge skip non-empty - if ((pItem2 != NULL) != merge) + if ((pItem2 != nullptr) != merge) continue; uint32 need_space = pProto->GetMaxStackSize(); @@ -10076,7 +10076,7 @@ void Player::SetAmmo(uint32 item) InventoryResult msg = CanUseAmmo(item); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, NULL, NULL, item); + SendEquipError(msg, nullptr, nullptr, item); return; } } @@ -10117,7 +10117,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) { if (!pItem) - return NULL; + return nullptr; Item* lastItem = pItem; @@ -10179,7 +10179,7 @@ Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool pItem->SetGuidValue(ITEM_FIELD_OWNER, GetObjectGuid()); pItem->SetSlot(slot); - pItem->SetContainer(NULL); + pItem->SetContainer(nullptr); if (IsInWorld() && update) { @@ -10250,7 +10250,7 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update) return EquipItem(pos, pItem, update); } - return NULL; + return nullptr; } Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) @@ -10413,7 +10413,7 @@ void Player::VisualizeItem(uint8 slot, Item *pItem) pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetObjectGuid()); pItem->SetGuidValue(ITEM_FIELD_OWNER, GetObjectGuid()); pItem->SetSlot(slot); - pItem->SetContainer(NULL); + pItem->SetContainer(nullptr); if (slot < EQUIPMENT_SLOT_END) SetVisibleItemSlot(slot, pItem); @@ -10463,11 +10463,11 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) } } - m_items[slot] = NULL; + m_items[slot] = nullptr; SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid()); if (slot < EQUIPMENT_SLOT_END) - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); } else { @@ -10578,10 +10578,10 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) RemoveItemDependentAurasAndCasts(pItem); // equipment visual show - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); } - m_items[slot] = NULL; + m_items[slot] = nullptr; } else if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag)) pBag->RemoveItem(slot, update); @@ -10908,14 +10908,14 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) Item *pSrcItem = GetItemByPos(srcbag, srcslot); if (!pSrcItem) { - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr); return; } if (pSrcItem->HasGeneratedLoot()) // prevent split looting item (stackable items can has only temporary loot and this meaning that loot window open) { //best error message found for attempting to split while looting - SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, nullptr); return; } @@ -10923,7 +10923,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) if (pSrcItem->GetCount() == count) { GetSession()->ProcessAnticheatAction("PassiveAnticheat", "Attempt to split full item stack", CHEAT_ACTION_LOG | CHEAT_ACTION_REPORT_GMS); - SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, nullptr); return; } @@ -10931,7 +10931,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) if (pSrcItem->GetCount() < count) { GetSession()->ProcessAnticheatAction("PassiveAnticheat", "Attempt to split more items than have", CHEAT_ACTION_LOG | CHEAT_ACTION_REPORT_GMS); - SendEquipError(EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, nullptr); return; } @@ -10950,7 +10950,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) Item *pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) { - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr); return; } @@ -10965,7 +10965,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) { delete pNewItem; pSrcItem->SetCount(pSrcItem->GetCount() + count); - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -10985,7 +10985,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) { delete pNewItem; pSrcItem->SetCount(pSrcItem->GetCount() + count); - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -11005,7 +11005,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) { delete pNewItem; pSrcItem->SetCount(pSrcItem->GetCount() + count); - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -11098,7 +11098,7 @@ void Player::SwapItem(uint16 src, uint16 dst) InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -11111,7 +11111,7 @@ void Player::SwapItem(uint16 src, uint16 dst) InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -11124,7 +11124,7 @@ void Player::SwapItem(uint16 src, uint16 dst) InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, pSrcItem, NULL); + SendEquipError(msg, pSrcItem, nullptr); return; } @@ -11230,8 +11230,8 @@ void Player::SwapItem(uint16 src, uint16 dst) // Check bag swap with item exchange (one from empty in not bag possition (equipped (not possible in fact) or store) if (pSrcItem->IsBag() && pDstItem->IsBag()) { - Bag* emptyBag = NULL; - Bag* fullBag = NULL; + Bag* emptyBag = nullptr; + Bag* fullBag = nullptr; if (((Bag*)pSrcItem)->IsEmpty() && !IsBagPos(src)) { emptyBag = (Bag*)pSrcItem; @@ -11424,7 +11424,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) DEBUG_LOG("STORAGE: GetItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; - return NULL; + return nullptr; } void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) @@ -11439,7 +11439,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) if (del) pItem->SetState(ITEM_REMOVED, this); } - m_items[slot] = NULL; + m_items[slot] = nullptr; #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 uint32 eslot = slot - BUYBACK_SLOT_START; @@ -11528,9 +11528,9 @@ void Player::TradeCancel(bool sendback) // cleanup delete m_trade; - m_trade = NULL; + m_trade = nullptr; delete trader->m_trade; - trader->m_trade = NULL; + trader->m_trade = nullptr; } } @@ -12157,7 +12157,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId) } case GOSSIP_OPTION_SPIRITHEALER: if (isDead()) - ((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, NULL, NULL, GetObjectGuid()); + ((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, nullptr, nullptr, GetObjectGuid()); break; case GOSSIP_OPTION_QUESTGIVER: PrepareQuestMenu(guid); @@ -12443,7 +12443,7 @@ Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const *pQuest) if (GameObject *pGameObject = _map->GetGameObject(guid)) rbounds = sObjectMgr.GetGOQuestRelationsMapBounds(pGameObject->GetEntry()); else - return NULL; + return nullptr; } uint32 nextQuestID = pQuest->GetNextQuestInChain(); @@ -12453,7 +12453,7 @@ Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const *pQuest) return sObjectMgr.GetQuestTemplate(nextQuestID); } - return NULL; + return nullptr; } /** @@ -12629,7 +12629,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, bool msg) const GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i]) { if (msg) - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, pQuest->ReqItemId[i]); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr, pQuest->ReqItemId[i]); return false; } } @@ -12666,7 +12666,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) const else if (res == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) SendQuestFailedAtTaker(pQuest->GetQuestId(), INVALIDREASON_QUEST_FAILED_DUPLICATE_ITEM); else - SendEquipError(res, NULL, NULL, pQuest->RewChoiceItemId[reward]); + SendEquipError(res, nullptr, nullptr, pQuest->RewChoiceItemId[reward]); return false; } } @@ -12687,7 +12687,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) const else if (res == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) SendQuestFailedAtTaker(pQuest->GetQuestId(), INVALIDREASON_QUEST_FAILED_DUPLICATE_ITEM); else - SendEquipError(res, NULL, NULL); + SendEquipError(res, nullptr, nullptr); return false; } numRewardedItems += dest.size(); @@ -12696,7 +12696,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) const } if (CountFreeInventorySlots() < numRewardedItems) { - SendEquipError(EQUIP_ERR_INVENTORY_FULL, NULL, NULL); + SendEquipError(EQUIP_ERR_INVENTORY_FULL, nullptr, nullptr); return false; } return true; @@ -12765,7 +12765,7 @@ void Player::AddQuest(Quest const *pQuest, Object *questGiver) AddTimedQuest(quest_id); questStatusData.m_timer = limittime * IN_MILLISECONDS; - qtime = static_cast(time(NULL)) + limittime; + qtime = static_cast(time(nullptr)) + limittime; } else questStatusData.m_timer = 0; @@ -13030,7 +13030,7 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, WorldObject* questE uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue(this) * (GetPersonalXpRate() >= 0.0f ? GetPersonalXpRate() : sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST))); if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) - GiveXP(XP , NULL); + GiveXP(XP , nullptr); else if (int32 money = pQuest->GetRewMoneyMaxLevelAtComplete()) LogModifyMoney(money, "QuestMaxLevel", questEnder->GetObjectGuid(), quest_id); @@ -13519,7 +13519,7 @@ bool Player::CanGiveQuestSourceItemIfNeed(Quest const *pQuest, ItemPosCountVec* else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) SendQuestFailedAtTaker(pQuest->GetQuestId(), INVALIDREASON_QUEST_FAILED_DUPLICATE_ITEM); else - SendEquipError(msg, NULL, NULL, srcitem); + SendEquipError(msg, nullptr, nullptr, srcitem); } return false; @@ -13576,7 +13576,7 @@ bool Player::TakeOrReplaceQuestStartItems(uint32 quest_id, bool msg, bool giveQu if (res != EQUIP_ERR_OK) { if (msg) - SendEquipError(res, NULL, NULL, srcItemID); + SendEquipError(res, nullptr, nullptr, srcItemID); return false; } @@ -13720,7 +13720,7 @@ void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject) { if (Group *pGroup = GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pGroupGuy = itr->getSource(); @@ -14493,12 +14493,12 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid()); - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); if (m_items[slot]) { delete m_items[slot]; - m_items[slot] = NULL; + m_items[slot] = nullptr; } } @@ -14508,7 +14508,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) //Need to call it to initialize m_team (m_team can be calculated from race) //Other way is to saves m_team into characters table. SetFactionForRace(getRace()); - SetCharm(NULL); + SetCharm(nullptr); // load home bind and check in same time class/race pair, it used later for restore broken positions if (!_LoadHomeBind(holder->GetResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND))) @@ -14650,7 +14650,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) SaveRecallPosition(); - time_t now = time(NULL); + time_t now = time(nullptr); time_t logoutTime = time_t(fields[22].GetUInt64()); // since last logout (in seconds) @@ -14703,8 +14703,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) SetUInt32Value(UNIT_CHANNEL_SPELL, 0); // clear charm/summon related fields - SetCharm(NULL); - SetPet(NULL); + SetCharm(nullptr); + SetPet(nullptr); SetTargetGuid(ObjectGuid()); SetCharmerGuid(ObjectGuid()); SetOwnerGuid(ObjectGuid()); @@ -14786,7 +14786,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeam())) { // problems with taxi path loading - TaxiNodesEntry const* nodeEntry = NULL; + TaxiNodesEntry const* nodeEntry = nullptr; if (uint32 node_id = m_taxi.GetTaxiSource()) nodeEntry = sObjectMgr.GetTaxiNodeEntry(node_id); @@ -15174,7 +15174,7 @@ void Player::LoadAura(AuraSaveStruct& s, uint32 timediff) if ((s.effIndexMask & (1 << i)) == 0 || !spellproto->EffectApplyAuraName[i]) continue; - Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), NULL, holder, this); + Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), nullptr, holder, this); if (!s.damage[i]) s.damage[i] = aura->GetModifier()->m_amount; @@ -15315,7 +15315,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff, bool &has_epic // the item/bag is not in a bag if (!bag_guid) { - item->SetContainer(NULL); + item->SetContainer(nullptr); item->SetSlot(slot); if (IsInventoryPos(INVENTORY_SLOT_BAG_0, slot)) @@ -15657,7 +15657,7 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid) if (itr != m_boundInstances.end()) return &itr->second; else - return NULL; + return nullptr; } void Player::UnbindInstance(uint32 mapid, bool unload) @@ -15718,7 +15718,7 @@ InstancePlayerBind* Player::BindToInstance(DungeonPersistentState *state, bool p return &bind; } else - return NULL; + return nullptr; } DungeonPersistentState* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid) @@ -16041,7 +16041,7 @@ void Player::SaveToDB(bool online, bool force) uberInsert.addUInt32(m_Played_time[PLAYED_TIME_LEVEL]); uberInsert.addFloat(finiteAlways(m_rest_bonus)); - uberInsert.addUInt64(uint64(time(NULL))); + uberInsert.addUInt64(uint64(time(nullptr))); uberInsert.addUInt32(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0); //save, far from tavern/city //save, but in tavern/city @@ -16301,7 +16301,7 @@ void Player::_SaveInventory() // Plusieurs tests anti dupli ... Item *test = GetItemByPos(item->GetBagSlot(), item->GetSlot()); - if (test == NULL) + if (test == nullptr) { uint32 bagTestGUID = 0; if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot())) @@ -16602,7 +16602,7 @@ void Player::outDebugStatsValues() const bool Player::CanSpeak() const { - return GetSession()->m_muteTime <= time(NULL); + return GetSession()->m_muteTime <= time(nullptr); } /*********************************************************/ @@ -16807,7 +16807,7 @@ bool Player::IsInInterFactionMode() const return true; Map * tMap = FindMap(); - if ((tMap != NULL) && (tMap->IsDungeon())) + if ((tMap != nullptr) && (tMap->IsDungeon())) return true; return false; @@ -16845,7 +16845,7 @@ void Player::RemoveMiniPet() Pet* Player::GetMiniPet() const { if (m_miniPetGuid.IsEmpty()) - return NULL; + return nullptr; return GetMap()->GetPet(m_miniPetGuid); } @@ -17156,7 +17156,7 @@ SpellModifier* Player::GetSpellMod(SpellModOp op, uint32 spellId) const if ((*itr)->spellId == spellId) return *itr; - return NULL; + return nullptr; } // Restore spellmods in case of failed cast @@ -17335,7 +17335,7 @@ void Player::SetRestBonus(float rest_bonus_new) SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, uint32(m_rest_bonus)); } -bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc /*= NULL*/, uint32 spellid /*= 0*/, bool nocheck) +bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 0*/, bool nocheck) { if (nodes.size() < 2) return false; @@ -17436,7 +17436,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc return false; } } - // node must have pos if taxi master case (npc != NULL) + // node must have pos if taxi master case (npc != nullptr) else if (npc) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); @@ -17536,8 +17536,8 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc else // single path m_taxi.AddTaxiDestination(lastNode); - // get mount model (in case non taximaster (npc==NULL) allow more wide lookup) - uint32 mount_display_id = sObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); + // get mount model (in case non taximaster (npc==nullptr) allow more wide lookup) + uint32 mount_display_id = sObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == nullptr); // in spell case allow 0 model if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) @@ -17598,7 +17598,7 @@ bool Player::ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid /*= 0*/, boo nodes[0] = entry->from; nodes[1] = entry->to; - return ActivateTaxiPathTo(nodes, NULL, spellid, nocheck); + return ActivateTaxiPathTo(nodes, nullptr, spellid, nocheck); } void Player::ContinueTaxiFlight() @@ -17815,7 +17815,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item); if (!pProto) { - SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0); return false; } @@ -17823,7 +17823,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, if (!pCreature) { DEBUG_LOG("WORLD: BuyItemFromVendor - %s not found or you can't interact with him.", vendorGuid.GetString().c_str()); - SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); + SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item, 0); return false; } @@ -17903,7 +17903,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, return false; } - Item* pItem = NULL; + Item* pItem = nullptr; if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot)) { @@ -17911,7 +17911,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, InventoryResult msg = CanStoreNewItem(bag, slot, dest, item, totalCount); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, NULL, NULL, item); + SendEquipError(msg, nullptr, nullptr, item); return false; } @@ -17923,7 +17923,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, { if (totalCount != 1) { - SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL); + SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, nullptr, nullptr); return false; } @@ -17931,7 +17931,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, InventoryResult msg = CanEquipNewItem(slot, dest, item, false); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, NULL, NULL, item); + SendEquipError(msg, nullptr, nullptr, item); return false; } @@ -17944,7 +17944,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, } else { - SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr); return false; } @@ -18066,7 +18066,7 @@ void Player::SetBattleGroundEntryPoint(uint32 mapId, float x, float y, float z, m_bgData.m_needSave = true; } -void Player::SetBattleGroundEntryPoint(Player* leader /*= NULL*/, bool queuedAtBGPortal /*= false*/) +void Player::SetBattleGroundEntryPoint(Player* leader /*= nullptr*/, bool queuedAtBGPortal /*= false*/) { // Already in BG ? Then we already have a teleport back point if (InBattleGround()) @@ -18398,7 +18398,7 @@ void Player::SetComboPoints() } /*else { - // can be NULL, and then points=0. Use unknown; to reset points of some sort? + // can be nullptr, and then points=0. Use unknown; to reset points of some sort? data << PackedGuid(); data << uint8(0); GetSession()->SendPacket(&data); @@ -18453,11 +18453,11 @@ void Player::ClearComboPoints() void Player::SetGroup(Group *group, int8 subgroup) { - if (group == NULL) + if (group == nullptr) m_group.unlink(); else { - // never use SetGroup without a subgroup unless you specify NULL for group + // never use SetGroup without a subgroup unless you specify nullptr for group MANGOS_ASSERT(subgroup >= 0); m_group.link(group, this); m_group.setSubGroup((uint8)subgroup); @@ -18596,7 +18596,7 @@ void Player::ApplyEquipCooldown(Item * pItem) if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; - time_t now = time(NULL); + time_t now = time(nullptr); time_t currentCd = GetSpellCooldownDelay(spellData.SpellId); if (currentCd < 30) { @@ -18756,7 +18756,7 @@ void Player::SetSemaphoreTeleportFar(bool semphsetting) BattleGround* Player::GetBattleGround() const { if (GetBattleGroundId() == 0) - return NULL; + return nullptr; return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgData.bgTypeID); } @@ -18862,7 +18862,7 @@ float Player::GetReputationPriceDiscount(Creature const* pCreature) const if arg not provided then considered train action mode and level checked * @return true if spell available for show in trainer list (with skip level check) or training. */ -bool Player::IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel /*= NULL*/) const +bool Player::IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel /*= nullptr*/) const { uint32 racemask = getRaceMask(); uint32 classmask = getClassMask(); @@ -18951,7 +18951,7 @@ bool Player::HasQuestForGO(int32 GOId) const void Player::UpdateForQuestWorldObjects() { - // Don't process updates if we're not in the world (map is NULL) + // Don't process updates if we're not in the world (map is nullptr) if (!IsInWorld() || !FindMap()) return; @@ -18985,7 +18985,7 @@ void Player::SummonIfPossible(bool agree) } // expire and auto declined - if (m_summon_expire < time(NULL)) + if (m_summon_expire < time(nullptr)) return; // stop taxi flight at summon @@ -19293,7 +19293,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar // prepare data for near group iteration if (Group *pGroup = GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -19316,7 +19316,7 @@ void Player::RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spell // prepare data for near group iteration if (Group *pGroup = GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -19471,7 +19471,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const (!pvp && !sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE))) return copseReclaimDelay[0]; - time_t now = time(NULL); + time_t now = time(nullptr); // 0..2 full period uint32 count = (now < m_deathExpireTime) ? uint32((m_deathExpireTime - now) / DEATH_EXPIRE_STEP) : 0; if (count >= 2) @@ -19487,7 +19487,7 @@ void Player::UpdateCorpseReclaimDelay() (!pvp && !sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE))) return; - time_t now = time(NULL); + time_t now = time(nullptr); if (now < m_deathExpireTime) { // full and partly periods 1..3 @@ -19547,12 +19547,12 @@ Player* Player::GetNextRandomRaidMember(float radius) { Group *pGroup = GetGroup(); if (!pGroup) - return NULL; + return nullptr; std::vector nearMembers; nearMembers.reserve(pGroup->GetMembersCount()); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->getSource(); @@ -19563,7 +19563,7 @@ Player* Player::GetNextRandomRaidMember(float radius) } if (nearMembers.empty()) - return NULL; + return nullptr; uint32 randTarget = urand(0, nearMembers.size() - 1); return nearMembers[randTarget]; @@ -19618,16 +19618,16 @@ void Player::RemoveFromBattleGroundRaid() m_group.link(group, this); m_group.setSubGroup(GetOriginalSubGroup()); } - SetOriginalGroup(NULL); + SetOriginalGroup(nullptr); } void Player::SetOriginalGroup(Group *group, int8 subgroup) { - if (group == NULL) + if (group == nullptr) m_originalGroup.unlink(); else { - // never use SetOriginalGroup without a subgroup unless you specify NULL for group + // never use SetOriginalGroup without a subgroup unless you specify nullptr for group ASSERT(subgroup >= 0); m_originalGroup.link(group, this); m_originalGroup.setSubGroup((uint8)subgroup); @@ -19791,7 +19791,7 @@ void Player::AutoStoreLoot(Loot& loot, bool broadcast, uint8 bag, uint8 slot) msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, lootItem->itemid, lootItem->count); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, NULL, NULL, lootItem->itemid); + SendEquipError(msg, nullptr, nullptr, lootItem->itemid); continue; } @@ -20345,7 +20345,7 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask) break; } - return NULL; + return nullptr; } void Player::SetRestType(RestType n_r_type, uint32 areaTriggerId /*= 0*/) @@ -20365,7 +20365,7 @@ void Player::SetRestType(RestType n_r_type, uint32 areaTriggerId /*= 0*/) SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); inn_trigger_id = areaTriggerId; - time_inn_enter = time(NULL); + time_inn_enter = time(nullptr); if (sWorld.IsFFAPvPRealm()) SetFFAPvP(false); @@ -20807,7 +20807,7 @@ bool Player::ChangeQuestsForRace(uint8 oldRace, uint8 newRace) return false; } CHANGERACE_LOG("Changement quete %u -> %u (En cours)", pRemoveQuest->GetQuestId(), pNewQuest->GetQuestId()); - AddQuest(pNewQuest, NULL); + AddQuest(pNewQuest, nullptr); } else // Ne pas reset. Juste changer l'ID. { @@ -20895,14 +20895,14 @@ Item* Player::AddItem(uint32 itemId, uint32 count) { // -- TODO: Send to mailbox if no space ChatHandler(this).PSendSysMessage("You don't have any space in your bags."); - return NULL; + return nullptr; } Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); if (item) SendNewItem(item, count, true, false); else - return NULL; + return nullptr; return item; } @@ -20988,7 +20988,7 @@ void Player::LootMoney(int32 money, Loot* loot) { WorldObject const* target = loot->GetLootTarget(); sLog.out(LOG_LOOTS, "%s gets %ug%us%uc [loot from %s]", - GetShortDescription().c_str(), money / 100000, (money / 100) % 100, money % 100, target ? target->GetGuidStr().c_str() : "NULL"); + GetShortDescription().c_str(), money / 100000, (money / 100) % 100, money % 100, target ? target->GetGuidStr().c_str() : "nullptr"); LogModifyMoney(money, "Loot", target ? target->GetObjectGuid() : ObjectGuid()); } @@ -21261,7 +21261,7 @@ PlayerSocial* Player::GetSocial() const PlayerSocial* Player::FindSocial() const { MasterPlayer* masterPlayer = GetSession()->GetMasterPlayer(); - return masterPlayer ? masterPlayer->GetSocial() : NULL; + return masterPlayer ? masterPlayer->GetSocial() : nullptr; } void Player::DeletePacketBroadcaster() diff --git a/src/game/Objects/Totem.cpp b/src/game/Objects/Totem.cpp index d54940443..e06d55c51 100644 --- a/src/game/Objects/Totem.cpp +++ b/src/game/Objects/Totem.cpp @@ -136,7 +136,7 @@ void Totem::UnSummon() // Not only the player can summon the totem (scripted AI) if (Group *pGroup = ((Player*)owner)->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->getSource(); if (Target && pGroup->SameSubGroup((Player*)owner, Target)) @@ -169,7 +169,7 @@ Unit *Totem::GetOwner() if (ObjectGuid ownerGuid = GetOwnerGuid()) return ObjectAccessor::GetUnit(*this, ownerGuid); - return NULL; + return nullptr; } void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto) diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index 03c93a80e..fd759fe28 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -130,7 +130,7 @@ Unit::Unit() m_state = 0; m_deathState = ALIVE; - //m_Aura = NULL; + //m_Aura = nullptr; //m_AurasCheck = 2000; //m_removeAuraTimer = 4; m_spellAuraHoldersUpdateIterator = m_spellAuraHolders.end(); @@ -3780,7 +3780,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, U continue; int32 basePoints = aur->GetBasePoints(); - // construct the new aura for the attacker - will never return NULL, it's just a wrapper for + // construct the new aura for the attacker - will never return nullptr, it's just a wrapper for // some different constructors Aura * new_aur = CreateAura(aur->GetSpellProto(), aur->GetEffIndex(), &basePoints, new_holder, stealer, this); @@ -4974,7 +4974,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const if (guid.IsPlayer()) return ObjectAccessor::FindPlayer(guid); - return GetTypeId() == TYPEID_PLAYER ? (Player*)this : NULL; + return GetTypeId() == TYPEID_PLAYER ? (Player*)this : nullptr; } Player* Unit::GetAffectingPlayer() const @@ -5161,7 +5161,7 @@ Totem* Unit::GetTotem(TotemSlot slot) const return nullptr; Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]); - return totem && totem->IsTotem() ? (Totem*)totem : NULL; + return totem && totem->IsTotem() ? (Totem*)totem : nullptr; } bool Unit::IsAllTotemSlotsUsed() const @@ -7099,7 +7099,7 @@ float Unit::ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask) //====================================================================== -void Unit::AddThreat(Unit* pVictim, float threat /*= 0.0f*/, bool crit /*= false*/, SpellSchoolMask schoolMask /*= SPELL_SCHOOL_MASK_NONE*/, SpellEntry const *threatSpell /*= NULL*/) +void Unit::AddThreat(Unit* pVictim, float threat /*= 0.0f*/, bool crit /*= false*/, SpellSchoolMask schoolMask /*= SPELL_SCHOOL_MASK_NONE*/, SpellEntry const *threatSpell /*= nullptr*/) { // Only mobs can manage threat lists if (CanHaveThreatList() && IsInMap(pVictim)) @@ -8873,7 +8873,7 @@ void Unit::UpdateReactives(uint32 p_time) } } -Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= NULL*/, float radius /*= ATTACK_DISTANCE*/, bool inFront /*= false*/, bool isValidAttackTarget /*= false*/) const +Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= nullptr*/, float radius /*= ATTACK_DISTANCE*/, bool inFront /*= false*/, bool isValidAttackTarget /*= false*/) const { std::list targets; @@ -8911,7 +8911,7 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= NULL*/, float radius / return *tcIter; } -Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*= ATTACK_DISTANCE*/, bool inCombat) const +Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= nullptr*/, float radius /*= ATTACK_DISTANCE*/, bool inCombat) const { std::list targets; @@ -9452,7 +9452,7 @@ void Unit::CleanupDeletedAuras() SpellAuraHolder* Unit::GetSpellAuraHolder(uint32 spellid) const { SpellAuraHolderMap::const_iterator itr = m_spellAuraHolders.find(spellid); - return itr != m_spellAuraHolders.end() ? itr->second : NULL; + return itr != m_spellAuraHolders.end() ? itr->second : nullptr; } SpellAuraHolder* Unit::GetSpellAuraHolder(uint32 spellid, ObjectGuid casterGuid) const @@ -9925,7 +9925,7 @@ bool Unit::HasProhibitedSpell() CreatureAI* Unit::AI() const { - return GetTypeId() == TYPEID_UNIT ? ((Creature*)this)->AI() : NULL; + return GetTypeId() == TYPEID_UNIT ? ((Creature*)this)->AI() : nullptr; } SpellAuraHolder* Unit::AddAura(uint32 spellId, uint32 addAuraFlags, Unit* pCaster) @@ -10270,7 +10270,7 @@ bool Unit::HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) const { uint32 excludeAura = 0; - if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL) + if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr) excludeAura = currentChanneledSpell->m_spellInfo->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction return (HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE, excludeAura) diff --git a/src/game/Objects/UpdateData.cpp b/src/game/Objects/UpdateData.cpp index 403270f83..71f4b8108 100644 --- a/src/game/Objects/UpdateData.cpp +++ b/src/game/Objects/UpdateData.cpp @@ -125,7 +125,7 @@ void PacketCompressor::Compress(void* dst, uint32 *dst_size, void* src, int src_ bool UpdateData::BuildPacket(WorldPacket *packet, bool hasTransport) { if (!m_datas.size()) - return BuildPacket(packet, NULL, hasTransport); + return BuildPacket(packet, nullptr, hasTransport); return BuildPacket(packet, &(m_datas.front()), hasTransport); } @@ -188,7 +188,7 @@ void UpdateData::Send(WorldSession* session, bool hasTransport) WorldPacket data; if (!m_datas.size() && !m_outOfRangeGUIDs.empty()) { - BuildPacket(&data, NULL, hasTransport); + BuildPacket(&data, nullptr, hasTransport); session->SendPacket(&data); m_outOfRangeGUIDs.clear(); return; diff --git a/src/game/Objects/UpdateData.h b/src/game/Objects/UpdateData.h index 30466ced6..da4a2c0e4 100644 --- a/src/game/Objects/UpdateData.h +++ b/src/game/Objects/UpdateData.h @@ -93,7 +93,7 @@ class UpdateData class MovementData { public: - MovementData(WorldObject* owner = NULL) : _buffer(100), _owner(owner) {} + MovementData(WorldObject* owner = nullptr) : _buffer(100), _owner(owner) {} ~MovementData() {} void AddPacket(WorldPacket& data); void SetUnitSpeed(uint32 opcode, ObjectGuid const& unit, float value); diff --git a/src/game/OutdoorPvP/OutdoorPvPEP.cpp b/src/game/OutdoorPvP/OutdoorPvPEP.cpp index 203a4404d..93714cfc2 100644 --- a/src/game/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPEP.cpp @@ -147,7 +147,7 @@ void OPvPCapturePointEP_EWT::SummonSupportUnitAtNorthpassTower(uint32 team) if (m_UnitsSummonedSide != team) { m_UnitsSummonedSide = team; - const creature_type * ct = NULL; + const creature_type * ct = nullptr; if (team == ALLIANCE) ct = EP_EWT_Summons_A; else diff --git a/src/game/PlayerBots/PlayerBotAI.cpp b/src/game/PlayerBots/PlayerBotAI.cpp index 5e9b11862..146adfecb 100644 --- a/src/game/PlayerBots/PlayerBotAI.cpp +++ b/src/game/PlayerBots/PlayerBotAI.cpp @@ -34,8 +34,8 @@ void PlayerBotAI::UpdateAI(const uint32 diff) void PlayerBotAI::Remove() { - me->setAI(NULL); - me = NULL; + me->setAI(nullptr); + me = nullptr; } void PlayerBotFleeingAI::OnPlayerLogin() @@ -98,7 +98,7 @@ bool PlayerBotAI::SpawnNewPlayer(WorldSession* sess, uint8 class_, uint32 race_, newChar->CreatePacketBroadcaster(); MasterPlayer* mPlayer = new MasterPlayer(sess); mPlayer->LoadPlayer(newChar); - mPlayer->SetSocial(sSocialMgr.LoadFromDB(NULL, newChar->GetObjectGuid())); + mPlayer->SetSocial(sSocialMgr.LoadFromDB(nullptr, newChar->GetObjectGuid())); if (!newChar->GetMap()->Add(newChar)) { sLog.outError("PlayerBotAI::SpawnNewPlayer: Unable to add player to map!"); @@ -146,7 +146,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) float range = me->isInCombat() ? 30.0f : frand(15, 30); Unit* target = me->SelectNearestTarget(range); if (target && !me->IsWithinLOSInMap(target)) - target = NULL; + target = nullptr; // OOM ? if (me->GetPower(POWER_MANA) < 40 && target && me->isInCombat()) { @@ -274,7 +274,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) me->UpdateGroundPositionZ(x, y, z); } r = 20; - if (!me->GetMap()->GetWalkRandomPosition(NULL, x, y, z, r)) + if (!me->GetMap()->GetWalkRandomPosition(nullptr, x, y, z, r)) return; } else @@ -287,7 +287,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) float angle = me->GetOrientation() + frand(-M_PI_F / 2, M_PI_F / 2); x += r * cos(angle); y += r * sin(angle); - if (!me->GetMap()->GetWalkHitPosition(NULL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), x, y, z)) + if (!me->GetMap()->GetWalkHitPosition(nullptr, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), x, y, z)) return; } else @@ -306,7 +306,7 @@ void PopulateAreaBotAI::BeforeAddToMap(Player* player) float y = _y; float z = _z; Map* map = sMapMgr.CreateMap(_map, player); - while (!map->GetWalkRandomPosition(NULL, x, y, z, _radius)); + while (!map->GetWalkRandomPosition(nullptr, x, y, z, _radius)); player->Relocate(x, y, z); player->SetLocationMapId(_map); } diff --git a/src/game/PlayerBots/PlayerBotAI.h b/src/game/PlayerBots/PlayerBotAI.h index 2cc1da077..39b292447 100644 --- a/src/game/PlayerBots/PlayerBotAI.h +++ b/src/game/PlayerBots/PlayerBotAI.h @@ -13,7 +13,7 @@ PlayerBotAI* CreatePlayerBotAI(std::string ainame); class PlayerBotAI: public PlayerAI { public: - explicit PlayerBotAI(Player* pPlayer = NULL) : PlayerAI(pPlayer), botEntry(NULL) {} + explicit PlayerBotAI(Player* pPlayer = nullptr) : PlayerAI(pPlayer), botEntry(nullptr) {} virtual ~PlayerBotAI() {} virtual void Remove(); @@ -21,7 +21,7 @@ class PlayerBotAI: public PlayerAI virtual void OnBotEntryLoad(PlayerBotEntry* entry) {} virtual void UpdateAI(const uint32 /*diff*/); // Handle delayed teleports virtual void OnPlayerLogin() {} - virtual void BeforeAddToMap(Player* player) {} // me=NULL at call + virtual void BeforeAddToMap(Player* player) {} // me=nullptr at call // Helpers bool SpawnNewPlayer(WorldSession* sess, uint8 _class, uint32 _race, uint32 mapId, uint32 instanceId, float dx, float dy, float dz, float o); PlayerBotEntry* botEntry; @@ -60,7 +60,7 @@ class PlayerBotFleeingAI : public PlayerBotAI class MageOrgrimmarAttackerAI: public PlayerBotAI { public: - explicit MageOrgrimmarAttackerAI(Player* pPlayer = NULL) : PlayerBotAI(pPlayer) {} + explicit MageOrgrimmarAttackerAI(Player* pPlayer = nullptr) : PlayerBotAI(pPlayer) {} virtual ~MageOrgrimmarAttackerAI() {} virtual bool OnSessionLoaded(PlayerBotEntry* entry, WorldSession* sess); virtual void UpdateAI(const uint32 /*diff*/); @@ -69,9 +69,9 @@ class MageOrgrimmarAttackerAI: public PlayerBotAI class PopulateAreaBotAI: public PlayerBotAI { public: - explicit PopulateAreaBotAI(uint32 map, float x, float y, float z, uint32 team, float radius, Player* pPlayer = NULL) : PlayerBotAI(pPlayer), _map(map), _x(x), _y(y), _z(z), _team(team), _radius(radius) {} + explicit PopulateAreaBotAI(uint32 map, float x, float y, float z, uint32 team, float radius, Player* pPlayer = nullptr) : PlayerBotAI(pPlayer), _map(map), _x(x), _y(y), _z(z), _team(team), _radius(radius) {} virtual ~PopulateAreaBotAI() {} - virtual void BeforeAddToMap(Player* player); // me=NULL at call + virtual void BeforeAddToMap(Player* player); // me=nullptr at call virtual void OnPlayerLogin(); protected: uint32 _map; diff --git a/src/game/PlayerBots/PlayerBotMgr.cpp b/src/game/PlayerBots/PlayerBotMgr.cpp index 0000f7755..e4771cd30 100644 --- a/src/game/PlayerBots/PlayerBotMgr.cpp +++ b/src/game/PlayerBots/PlayerBotMgr.cpp @@ -292,7 +292,7 @@ bool PlayerBotMgr::addBot(PlayerBotAI* ai) bool PlayerBotMgr::addBot(uint32 playerGUID, bool chatBot) { uint32 accountId = 0; - PlayerBotEntry *e = NULL; + PlayerBotEntry *e = nullptr; std::map::iterator iter = m_bots.find(playerGUID); if (iter == m_bots.end()) accountId = sObjectMgr.GetPlayerAccountIdByGUID(playerGUID); @@ -315,12 +315,12 @@ bool PlayerBotMgr::addBot(uint32 playerGUID, bool chatBot) e->chance = 10; e->accountId = accountId; e->isChatBot = chatBot; - e->ai = new PlayerBotAI(NULL); + e->ai = new PlayerBotAI(nullptr); m_bots[playerGUID] = e; } e->state = PB_STATE_LOADING; - WorldSession *session = new WorldSession(accountId, NULL, sAccountMgr.GetSecurity(accountId), 0, LOCALE_enUS); + WorldSession *session = new WorldSession(accountId, nullptr, sAccountMgr.GetSecurity(accountId), 0, LOCALE_enUS); session->SetBot(e); // "It's not because you are a bot that you are allowed cheat!" sAnticheatLib->SessionAdded(session); @@ -482,7 +482,7 @@ bool ChatHandler::HandleBotAddAllCommand(char * args) bool ChatHandler::HandleBotAddCommand(char* args) { uint32 guid = 0; - char *charname = NULL; + char *charname = nullptr; if (*args) { charname = strtok((char*)args, " "); @@ -502,7 +502,7 @@ bool ChatHandler::HandleBotAddCommand(char* args) SendSysMessage("[PlayerBotMgr] Unable to load bot."); return true; } - PSendSysMessage("[PlayerBotMgr] Bot added : '%s', GUID=%u", charname ? charname : "NULL", guid); + PSendSysMessage("[PlayerBotMgr] Bot added : '%s', GUID=%u", charname ? charname : "nullptr", guid); return true; } diff --git a/src/game/PlayerBots/PlayerBotMgr.h b/src/game/PlayerBots/PlayerBotMgr.h index f9dd694fc..2417838a9 100644 --- a/src/game/PlayerBots/PlayerBotMgr.h +++ b/src/game/PlayerBots/PlayerBotMgr.h @@ -30,9 +30,9 @@ struct PlayerBotEntry bool customBot; // Enabled even if PlayerBot system disabled (AutoTesting system for example) PlayerBotAI* ai; - PlayerBotEntry(uint64 guid, uint32 account, uint32 _chance): playerGUID(guid), accountId(account), chance(_chance), state(PB_STATE_OFFLINE), isChatBot(false), ai(NULL), customBot(false) + PlayerBotEntry(uint64 guid, uint32 account, uint32 _chance): playerGUID(guid), accountId(account), chance(_chance), state(PB_STATE_OFFLINE), isChatBot(false), ai(nullptr), customBot(false) {} - PlayerBotEntry(): state(PB_STATE_OFFLINE), isChatBot(false), ai(NULL), accountId(0), playerGUID(0), chance(100.0f), customBot(false) + PlayerBotEntry(): state(PB_STATE_OFFLINE), isChatBot(false), ai(nullptr), accountId(0), playerGUID(0), chance(100.0f), customBot(false) {} }; diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index be1a3f0ad..2ece2d491 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -36,7 +36,7 @@ struct DumpTable // helpers bool isValid() const { - return name != NULL; + return name != nullptr; } }; @@ -64,7 +64,7 @@ static DumpTable dumpTables[] = { "item_instance", DTT_ITEM }, // <- item guids { "item_loot", DTT_ITEM_LOOT }, // <- item guids { "item_text", DTT_ITEM_TEXT }, - { NULL, DTT_CHAR_TABLE }, // end marker + { nullptr, DTT_CHAR_TABLE }, // end marker }; // Low level functions @@ -220,7 +220,7 @@ std::string CreateDumpString(char const* tableName, QueryResult *result) ss << ", "; if (fields[i].IsNULL()) - ss << "NULL"; + ss << "nullptr"; else { std::string s = fields[i].GetCppString(); @@ -282,8 +282,8 @@ void StoreGUID(QueryResult *result, uint32 data, uint32 field, std::set& // Writing - High-level functions void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char const*tableFrom, char const*tableTo, DumpTableType type) { - GUIDs const* guids = NULL; - char const* fieldname = NULL; + GUIDs const* guids = nullptr; + char const* fieldname = nullptr; switch (type) { @@ -451,7 +451,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if (!fin) return DUMP_FILE_OPEN_ERROR; - QueryResult * result = NULL; + QueryResult * result = nullptr; char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20]; // make sure the same guid doesn't already exist and is safe to use diff --git a/src/game/Protocol/Opcodes.h b/src/game/Protocol/Opcodes.h index 1ad740e92..92744fad1 100644 --- a/src/game/Protocol/Opcodes.h +++ b/src/game/Protocol/Opcodes.h @@ -44,10 +44,10 @@ /// Player state enum SessionStatus { - STATUS_AUTHED = 0, ///< Player authenticated (_player==NULL, m_playerRecentlyLogout = false or will be reset before handler call) - STATUS_LOGGEDIN, ///< Player in game (_player!=NULL, inWorld()) - STATUS_TRANSFER, ///< Player transferring to another map (_player!=NULL, !inWorld()) - STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT, ///< _player!= NULL or _player==NULL && m_playerRecentlyLogout) + STATUS_AUTHED = 0, ///< Player authenticated (_player==nullptr, m_playerRecentlyLogout = false or will be reset before handler call) + STATUS_LOGGEDIN, ///< Player in game (_player!=nullptr, inWorld()) + STATUS_TRANSFER, ///< Player transferring to another map (_player!=nullptr, !inWorld()) + STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT, ///< _player!= nullptr or _player==nullptr && m_playerRecentlyLogout) STATUS_NEVER, ///< Opcode not accepted from client (deprecated or server side only) STATUS_UNHANDLED ///< We don' handle this opcode yet }; @@ -86,7 +86,7 @@ class Opcodes OpcodeMap::const_iterator itr = mOpcodeMap.find(id); if (itr != mOpcodeMap.end()) return &itr->second; - return NULL; + return nullptr; } /// compatible with other mangos branches access diff --git a/src/game/Protocol/WorldSocket.cpp b/src/game/Protocol/WorldSocket.cpp index ff8f8d943..11d7eca42 100644 --- a/src/game/Protocol/WorldSocket.cpp +++ b/src/game/Protocol/WorldSocket.cpp @@ -78,7 +78,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) { ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); - if (m_Session != NULL) + if (m_Session != nullptr) { // OK ,give the packet to WorldSession aptr.release(); @@ -270,7 +270,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) sha.UpdateData((uint8 *) & t, 4); sha.UpdateData((uint8 *) & clientSeed, 4); sha.UpdateData((uint8 *) & seed, 4); - sha.UpdateBigNumbers(&K, NULL); + sha.UpdateBigNumbers(&K, nullptr); sha.Finalize(); if (memcmp(sha.GetDigest(), digest, 20)) diff --git a/src/game/ReputationMgr.h b/src/game/ReputationMgr.h index 37ae7c37f..8c2080641 100644 --- a/src/game/ReputationMgr.h +++ b/src/game/ReputationMgr.h @@ -77,13 +77,13 @@ class ReputationMgr FactionState const* GetState(FactionEntry const* factionEntry) const { - return factionEntry->reputationListID >= 0 ? GetState(factionEntry->reputationListID) : NULL; + return factionEntry->reputationListID >= 0 ? GetState(factionEntry->reputationListID) : nullptr; } FactionState const* GetState(RepListID id) const { FactionStateList::const_iterator repItr = m_factions.find (id); - return repItr != m_factions.end() ? &repItr->second : NULL; + return repItr != m_factions.end() ? &repItr->second : nullptr; } int32 GetReputation(uint32 faction_id) const; @@ -96,7 +96,7 @@ class ReputationMgr ReputationRank const* GetForcedRankIfAny(FactionTemplateEntry const* factionTemplateEntry) const { ForcedReactions::const_iterator forceItr = m_forcedReactions.find(factionTemplateEntry->faction); - return forceItr != m_forcedReactions.end() ? &forceItr->second : NULL; + return forceItr != m_forcedReactions.end() ? &forceItr->second : nullptr; } public: // modifiers diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 959af1705..fbff6ea34 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -147,10 +147,10 @@ void SpellCastTargets::setCorpseTarget(Corpse* corpse) void SpellCastTargets::Update(WorldObject* pCaster) { - m_GOTarget = m_GOTargetGUID ? pCaster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL; + m_GOTarget = m_GOTargetGUID ? pCaster->GetMap()->GetGameObject(m_GOTargetGUID) : nullptr; m_unitTarget = m_unitTargetGUID ? (m_unitTargetGUID == pCaster->GetObjectGuid() ? pCaster->ToUnit() : ObjectAccessor::GetUnit(*pCaster, m_unitTargetGUID)) : - NULL; + nullptr; m_itemTarget = nullptr; if (Player* pPlayer = pCaster->ToPlayer()) @@ -2785,7 +2785,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } } - Group* pGroup = pTarget ? pTarget->GetGroup() : NULL; + Group* pGroup = pTarget ? pTarget->GetGroup() : nullptr; if (pGroup) { @@ -2911,9 +2911,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_AREAEFFECT_PARTY_AND_CLASS: { Player* targetPlayer = m_targets.getUnitTarget() && m_targets.getUnitTarget()->IsPlayer() - ? (Player*)m_targets.getUnitTarget() : NULL; + ? (Player*)m_targets.getUnitTarget() : nullptr; - Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL; + Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : nullptr; if (pGroup) { for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) @@ -3778,7 +3778,7 @@ void Spell::cast(bool skipCheck) if (m_delayed) { SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()... - // Remove used for cast item if need (it can be already NULL after TakeReagents call + // Remove used for cast item if need (it can be already nullptr after TakeReagents call // in case delayed spell remove item at cast delay start TakeCastItem(); @@ -3878,7 +3878,7 @@ void Spell::handle_immediate() // Nostalrius: Send spell_go once effects are done (fix visual bug with EFFECT_INSTAKILL for example: 11504) if (!sendGoBefore) SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()... - // Remove used for cast item if need (it can be already NULL after TakeReagents call + // Remove used for cast item if need (it can be already nullptr after TakeReagents call TakeCastItem(); if (m_spellState != SPELL_STATE_CASTING) @@ -7835,7 +7835,7 @@ void Spell::UpdateOriginalCasterPointer() m_originalCaster = m_casterUnit; else if (m_originalCasterGUID.IsGameObject()) { - GameObject* go = m_caster->IsInWorld() ? m_caster->GetMap()->GetGameObject(m_originalCasterGUID) : NULL; + GameObject* go = m_caster->IsInWorld() ? m_caster->GetMap()->GetGameObject(m_originalCasterGUID) : nullptr; m_originalCaster = go ? go->GetOwner() : nullptr; } else @@ -8408,9 +8408,9 @@ template<> inline void SpellNotifierCreatureAndPlayer::Visit(CameraMapType&) {} * @param radius Radius around (x,y) for target search * @param pushType Additional rules for target area selection (in front, angle, etc) * @param spellTargets Additional rules for target selection base at hostile/friendly state to original spell caster - * @param originalCaster If provided set alternative original caster, if =NULL then used Spell::GetAffectiveObject() return + * @param originalCaster If provided set alternative original caster, if =nullptr then used Spell::GetAffectiveObject() return */ -void Spell::FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster /*=NULL*/) +void Spell::FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster /*=nullptr*/) { SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets, originalCaster); Cell::VisitAllObjects(notifier.GetCenterX(), notifier.GetCenterY(), m_caster->GetMap(), notifier, radius); @@ -8419,7 +8419,7 @@ void Spell::FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPu void Spell::FillRaidOrPartyTargets(UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster) const { Player *pTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); - Group *pGroup = pTarget ? pTarget->GetGroup() : NULL; + Group *pGroup = pTarget ? pTarget->GetGroup() : nullptr; if (pGroup) { @@ -8474,7 +8474,7 @@ WorldObject* Spell::GetAffectiveCasterObject() const WorldObject* Spell::GetCastingObject() const { if (m_originalCasterGUID.IsGameObject()) - return m_caster->IsInWorld() ? m_caster->GetMap()->GetGameObject(m_originalCasterGUID) : NULL; + return m_caster->IsInWorld() ? m_caster->GetMap()->GetGameObject(m_originalCasterGUID) : nullptr; return m_caster; } diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index 6995f6331..13c5b602d 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -361,7 +361,7 @@ class Spell SpellCastResult CheckCasterAuras() const; int32 CalculateDamage(SpellEffectIndex i, Unit* target) { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_currentBasePoints[i], this); } - static uint32 CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spell* spell = NULL, Item* castItem = NULL); + static uint32 CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spell* spell = nullptr, Item* castItem = nullptr); bool HaveTargetsForEffect(SpellEffectIndex effect) const; void Delayed(); @@ -378,7 +378,7 @@ class Spell void FillTargetMap(); void SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList &targetUnitMap); - void FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = NULL); + void FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = nullptr); void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ) const; template WorldObject* FindCorpseUsing(); @@ -440,9 +440,9 @@ class Spell // caster types: // formal spell caster, in game source of spell affects cast WorldObject* GetCaster() const { return m_caster; } - // real source of cast affects, explicit caster, or DoT/HoT applier, or GO owner, or wild GO itself. Can be NULL + // real source of cast affects, explicit caster, or DoT/HoT applier, or GO owner, or wild GO itself. Can be nullptr WorldObject* GetAffectiveCasterObject() const; - // limited version returning NULL in cases wild gameobject caster object, need for Aura (auras currently not support non-Unit caster) + // limited version returning nullptr in cases wild gameobject caster object, need for Aura (auras currently not support non-Unit caster) Unit* GetAffectiveCaster() const { return m_originalCasterGUID ? m_originalCaster : m_casterUnit; } // m_originalCasterGUID can store GO guid, and in this case this is visual caster WorldObject* GetCastingObject() const; diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 2c6d78afc..e9c941321 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -289,7 +289,7 @@ Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBas DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura: construct Spellid : %u, Aura : %u Target : %d Damage : %d", spellproto->Id, spellproto->EffectApplyAuraName[eff], spellproto->EffectImplicitTargetA[eff], damage); SetModifier(AuraType(spellproto->EffectApplyAuraName[eff]), damage, spellproto->EffectAmplitude[eff], spellproto->EffectMiscValue[eff]); - CalculatePeriodic(caster ? caster->GetSpellModOwner() : NULL, true); + CalculatePeriodic(caster ? caster->GetSpellModOwner() : nullptr, true); ComputeExclusive(); if (IsLastAuraOnHolder() && !m_positive) { @@ -307,7 +307,7 @@ void Aura::Refresh(Unit* caster, Unit* target, SpellAuraHolder* pRefreshWithHold if (!pHolderAura) return; m_periodicTick = 0; - Player* modOwner = caster ? caster->GetSpellModOwner() : NULL; + Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr; m_applyTime = time(nullptr); // Refresh periodic period, but keep current timer. // If we chain refresh a DoT, it should not prevent first damage tick! @@ -399,7 +399,7 @@ AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *cu { m_isAreaAura = true; - // caster==NULL in constructor args if target==caster in fact + // caster==nullptr in constructor args if target==caster in fact Unit* caster_ptr = caster ? caster : target; m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); @@ -784,7 +784,7 @@ void AreaAura::Update(uint32 diff) { Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); - Group *pGroup = check ? check->GetGroup() : NULL; + Group *pGroup = check ? check->GetGroup() : nullptr; if (pGroup) { Player* checkTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -941,11 +941,11 @@ void Aura::ReapplyAffectedPassiveAuras(Unit* target) if (!affectedSelf.empty()) { - Player* pTarget = target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : NULL; + Player* pTarget = target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : nullptr; for (std::map::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr) { - Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : NULL; + Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : nullptr; target->RemoveAurasDueToSpell(map_itr->first); target->CastSpell(target, map_itr->first, true, item); } @@ -1851,7 +1851,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { casterPlayer->AddAura(15007); // Add Resurrection Sickness if (sObjectMgr.GetClosestGraveYard(casterPlayer->GetPositionX(), casterPlayer->GetPositionY(), casterPlayer->GetPositionZ(), casterPlayer->GetMapId(), casterPlayer->GetTeam())) - casterPlayer->DealDamage(casterPlayer, casterPlayer->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + casterPlayer->DealDamage(casterPlayer, casterPlayer->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); else { // If there is no nearby graveyard, player's ghost would spawn at the same spot. @@ -6285,7 +6285,7 @@ SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, Uni if (m_spellProto->Id == 12292) m_isRemovedOnShapeLost = false; - Unit* unitCaster = caster && caster->isType(TYPEMASK_UNIT) ? (Unit*)caster : NULL; + Unit* unitCaster = caster && caster->isType(TYPEMASK_UNIT) ? (Unit*)caster : nullptr; m_duration = m_maxDuration = spellproto->CalculateDuration(unitCaster); diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 6bbeacaa4..bf6063761 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -3984,7 +3984,7 @@ ObjectGuid Unit::EffectSummonPet(uint32 spellId, uint32 petEntry, uint32 petLeve if (!UnsummonOldPetBeforeNewSummon(petEntry)) return ObjectGuid(); - CreatureInfo const* cInfo = petEntry ? sCreatureStorage.LookupEntry(petEntry) : NULL; + CreatureInfo const* cInfo = petEntry ? sCreatureStorage.LookupEntry(petEntry) : nullptr; // == 0 in case call current pet, check only real summon case if (petEntry && !cInfo) @@ -5870,7 +5870,7 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx) if (ObjectGuid guid = m_casterUnit->m_ObjectSlotGuid[slot]) { - if (GameObject* obj = m_casterUnit ? m_casterUnit->GetMap()->GetGameObject(guid) : NULL) + if (GameObject* obj = m_casterUnit ? m_casterUnit->GetMap()->GetGameObject(guid) : nullptr) obj->SetLootState(GO_JUST_DEACTIVATED); m_casterUnit->m_ObjectSlotGuid[slot].Clear(); } diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index d4941e457..04d9e6866 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -543,7 +543,7 @@ class SpellMgr if (itr != mSpellThreatMap.end()) return &itr->second; - return NULL; + return nullptr; } float GetSpellThreatMultiplier(SpellEntry const *spellInfo) const @@ -563,7 +563,7 @@ class SpellMgr SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId); if( itr != mSpellProcEventMap.end( ) ) return &itr->second; - return NULL; + return nullptr; } // Spell procs from item enchants @@ -586,7 +586,7 @@ class SpellMgr if( itr != mSpellBonusMap.end( ) ) return &itr->second; - return NULL; + return nullptr; } // Spell target coordinates @@ -595,7 +595,7 @@ class SpellMgr SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find( spell_id ); if( itr != mSpellTargetPositions.end( ) ) return &itr->second; - return NULL; + return nullptr; } // Spell ranks chains @@ -603,7 +603,7 @@ class SpellMgr { SpellChainMap::const_iterator itr = mSpellChains.find(spell_id); if(itr == mSpellChains.end()) - return NULL; + return nullptr; return &itr->second; } @@ -691,7 +691,7 @@ class SpellMgr if(itr != mSpellLearnSkills.end()) return &itr->second; else - return NULL; + return nullptr; } bool IsSpellLearnSpell(uint32 spell_id) const @@ -728,7 +728,7 @@ class SpellMgr } // Spell correctness for client using - static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true); + static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = nullptr, bool msg = true); SkillLineAbilityMapBounds GetSkillLineAbilityMapBoundsBySpellId(uint32 spellId) const { diff --git a/src/game/Threat/HostileRefManager.cpp b/src/game/Threat/HostileRefManager.cpp index b086d5d14..531d38ae0 100644 --- a/src/game/Threat/HostileRefManager.cpp +++ b/src/game/Threat/HostileRefManager.cpp @@ -79,7 +79,7 @@ void HostileRefManager::addThreatPercent(int32 pValue) HostileReference* ref; ref = getFirst(); - while (ref != NULL) + while (ref != nullptr) { ref->addThreatPercent(pValue); ref = ref->next(); @@ -94,7 +94,7 @@ void HostileRefManager::setOnlineOfflineState(bool pIsOnline) HostileReference* ref; ref = getFirst(); - while (ref != NULL) + while (ref != nullptr) { ref->setOnlineOfflineState(pIsOnline); ref = ref->next(); diff --git a/src/game/Threat/ThreatManager.cpp b/src/game/Threat/ThreatManager.cpp index c86b15150..bd07502c0 100644 --- a/src/game/Threat/ThreatManager.cpp +++ b/src/game/Threat/ThreatManager.cpp @@ -213,7 +213,7 @@ void ThreatContainer::clearReferences() } //============================================================ -// Return the HostileReference of NULL, if not found +// Return the HostileReference of nullptr, if not found HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) { if (!pVictim) @@ -458,7 +458,7 @@ Unit* ThreatManager::getHostileTarget() iThreatContainer.update(); HostileReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim()); setCurrentVictim(nextVictim); - return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : NULL; + return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr; } //============================================================ diff --git a/src/game/Transports/Transport.cpp b/src/game/Transports/Transport.cpp index 3a01a7045..d6ce551a5 100644 --- a/src/game/Transports/Transport.cpp +++ b/src/game/Transports/Transport.cpp @@ -35,7 +35,7 @@ #include "ObjectAccessor.h" Transport::Transport() : GameObject(), - _transportInfo(NULL), _isMoving(true), _pendingStop(false), + _transportInfo(nullptr), _isMoving(true), _pendingStop(false), _passengerTeleportItr(_passengers.begin()), _pathProgress(0) { // the path progress is the only value that seem to matter @@ -84,7 +84,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa _nextFrame = tInfo->keyFrames.begin(); _currentFrame = _nextFrame++; - _pathProgress = time(NULL) % (tInfo->pathTime / 1000); + _pathProgress = time(nullptr) % (tInfo->pathTime / 1000); _pathProgress *= 1000; SetObjectScale(goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); @@ -221,7 +221,7 @@ void Transport::RemovePassenger(WorldObject* passenger) if (erased) { - passenger->SetTransport(NULL); + passenger->SetTransport(nullptr); passenger->m_movementInfo.ClearTransportData(); DEBUG_LOG("Object %s removed from transport %s.", passenger->GetName(), GetName()); } diff --git a/src/game/Transports/Transport.h b/src/game/Transports/Transport.h index e05ffd5bb..96687408a 100644 --- a/src/game/Transports/Transport.h +++ b/src/game/Transports/Transport.h @@ -47,13 +47,13 @@ class Transport : public GameObject PassengerSet const& GetPassengers() const { return _passengers; } /// This method transforms supplied transport offsets into global coordinates - void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const + void CalculatePassengerPosition(float& x, float& y, float& z, float* o = nullptr) const { CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } /// This method transforms supplied global coordinates into local offsets - void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const + void CalculatePassengerOffset(float& x, float& y, float& z, float* o = nullptr) const { CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } diff --git a/src/game/Transports/TransportMgr.cpp b/src/game/Transports/TransportMgr.cpp index 6d209aa8b..edb0eb106 100644 --- a/src/game/Transports/TransportMgr.cpp +++ b/src/game/Transports/TransportMgr.cpp @@ -62,7 +62,7 @@ void TransportMgr::LoadTransportTemplates() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); GameObjectInfo const* goInfo = ObjectMgr::GetGameObjectInfo(entry); - if (goInfo == NULL) + if (goInfo == nullptr) { sLog.outErrorDb("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); continue; @@ -332,17 +332,17 @@ void TransportMgr::GeneratePath(GameObjectInfo const* goInfo, TransportTemplate* transport->pathTime = keyFrames.back().DepartureTime; } -Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* map /*= NULL*/) +Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* map /*= nullptr*/) { // instance case, execute GetGameObjectEntry hook if (map && !entry) - return NULL; + return nullptr; TransportTemplate const* tInfo = GetTransportTemplate(entry); if (!tInfo) { sLog.outErrorDb("Transport %u will not be loaded, `transport_template` missing", entry); - return NULL; + return nullptr; } // create transport... @@ -362,7 +362,7 @@ Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* if (!trans->Create(guidLow, entry, mapId, x, y, z, o, 255)) { delete trans; - return NULL; + return nullptr; } if (MapEntry const* mapEntry = sMapStorage.LookupEntry(mapId)) @@ -371,7 +371,7 @@ Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* { sLog.outError("Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName(), mapId); delete trans; - return NULL; + return nullptr; } } diff --git a/src/game/Transports/TransportMgr.h b/src/game/Transports/TransportMgr.h index b73e68b4c..b5b3b36d8 100644 --- a/src/game/Transports/TransportMgr.h +++ b/src/game/Transports/TransportMgr.h @@ -39,7 +39,7 @@ struct KeyFrame { explicit KeyFrame(TaxiPathNodeEntry const& _node) : Index(0), Node(&_node), InitialOrientation(0.0f), DistSinceStop(-1.0f), DistUntilStop(-1.0f), DistFromPrev(-1.0f), TimeFrom(0.0f), TimeTo(0.0f), - Teleport(false), Update(false), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0) + Teleport(false), Update(false), ArriveTime(0), DepartureTime(0), Spline(nullptr), NextDistFromPrev(0.0f), NextArriveTime(0) { } @@ -97,7 +97,7 @@ class TransportMgr void LoadTransportTemplates(); // Creates a transport using given GameObject template entry - Transport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = NULL); + Transport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = nullptr); // Spawns all continent transports, used at core startup void SpawnContinentTransports(); @@ -110,7 +110,7 @@ class TransportMgr TransportTemplates::const_iterator itr = _transportTemplates.find(entry); if (itr != _transportTemplates.end()) return &itr->second; - return NULL; + return nullptr; } private: diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index e17a4ed89..e4627a510 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -423,7 +423,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S { if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON) { - Item *item = NULL; + Item *item = nullptr; if (attType == BASE_ATTACK) item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); else if (attType == OFF_ATTACK) @@ -485,7 +485,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura int32 triggerAmount = triggeredByAura->GetModifier()->m_amount; Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER - ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL; + ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : nullptr; uint32 triggered_spell_id = 0; Unit* target = pVictim; @@ -635,9 +635,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura triggerAmount = triggeredByAura->GetModifier()->m_amount; if (triggerAmount == 50) - MonsterTextEmote(-1531044, NULL, true); // Cracks + MonsterTextEmote(-1531044, nullptr, true); // Cracks else if (triggerAmount == 100) - MonsterTextEmote(-1531045, NULL, true); // Shatter + MonsterTextEmote(-1531045, nullptr, true); // Shatter else if (triggerAmount == 150) { RemoveAurasDueToSpell(25937); @@ -905,7 +905,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura // heal amount basepoints[0] = triggerAmount * damage / 100; - pVictim->CastCustomSpell(pVictim, 15290, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura); + pVictim->CastCustomSpell(pVictim, 15290, &basepoints[0], nullptr, nullptr, true, castItem, triggeredByAura); return SPELL_AURA_PROC_OK; // no hidden cooldown } // Oracle Healing Bonus ("Garments of the Oracle" set) @@ -1053,7 +1053,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura damagePoint = pVictim->SpellDamageBonusTaken(this, dummySpell, damagePoint, SPELL_DIRECT_DAMAGE); } - CastCustomSpell(pVictim, spellId, &damagePoint, NULL, NULL, true, NULL, triggeredByAura); + CastCustomSpell(pVictim, spellId, &damagePoint, nullptr, nullptr, true, nullptr, triggeredByAura); // Seal of Righteousness can proc weapon enchants. mechanic removed in 2.1.0 ((Player*)this)->CastItemCombatSpell(pVictim, BASE_ATTACK); return SPELL_AURA_PROC_OK; // no hidden cooldown @@ -1165,15 +1165,15 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) CastCustomSpell(target, triggered_spell_id, - basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : NULL, - basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : NULL, - basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : NULL, + basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : nullptr, + basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : nullptr, + basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : nullptr, true, castItem, triggeredByAura); else CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura); if (cooldown) - AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown); + AddSpellCooldown(triggered_spell_id, 0, time(nullptr) + cooldown); return SPELL_AURA_PROC_OK; } @@ -1188,11 +1188,11 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d // Set trigger spell id, target, custom basepoints uint32 trigger_spell_id = auraSpellInfo->EffectTriggerSpell[triggeredByAura->GetEffIndex()]; - Unit* target = NULL; + Unit* target = nullptr; int32 basepoints[MAX_EFFECT_INDEX] = {0, 0, 0}; Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER - ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL; + ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : nullptr; // Try handle unknown trigger spells // Custom requirements (not listed in procEx) Warning! damage dealing after this @@ -1265,7 +1265,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d // Pyroclasm if (auraSpellInfo->SpellIconID == 1137) { - if (!pVictim || !pVictim->isAlive() || pVictim == this || procSpell == NULL) + if (!pVictim || !pVictim->isAlive() || pVictim == this || procSpell == nullptr) return SPELL_AURA_PROC_FAILED; // Calculate spell tick count for spells uint32 tick = 1; // Default tick = 1 @@ -1622,7 +1622,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d return SPELL_AURA_PROC_FAILED; // try detect target manually if not set - if (target == NULL) + if (target == nullptr) target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL) && Spells::IsPositiveSpell(trigger_spell_id) ? this : pVictim; // default case @@ -1631,15 +1631,15 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) CastCustomSpell(target, trigger_spell_id, - basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : NULL, - basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : NULL, - basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : NULL, + basepoints[EFFECT_INDEX_0] ? &basepoints[EFFECT_INDEX_0] : nullptr, + basepoints[EFFECT_INDEX_1] ? &basepoints[EFFECT_INDEX_1] : nullptr, + basepoints[EFFECT_INDEX_2] ? &basepoints[EFFECT_INDEX_2] : nullptr, true, castItem, triggeredByAura); else CastSpell(target, trigger_spell_id, true, castItem, triggeredByAura, GetObjectGuid(), nullptr, procSpell); if (cooldown) - AddSpellCooldown(trigger_spell_id, 0, time(NULL) + cooldown); + AddSpellCooldown(trigger_spell_id, 0, time(nullptr) + cooldown); return SPELL_AURA_PROC_OK; } @@ -1693,7 +1693,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 return SPELL_AURA_PROC_FAILED; Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER - ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL; + ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : nullptr; // Basepoints of trigger aura int32 triggerAmount = triggeredByAura->GetModifier()->m_amount; @@ -1791,7 +1791,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura); if (cooldown) - AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown); + AddSpellCooldown(triggered_spell_id, 0, time(nullptr) + cooldown); return SPELL_AURA_PROC_OK; } @@ -1799,19 +1799,19 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 SpellAuraProcResult Unit::HandleModCastingSpeedNotStackAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Skip melee hits or instant cast spells - return !(procSpell == NULL || procSpell->GetCastTime() == 0) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; + return !(procSpell == nullptr || procSpell->GetCastTime() == 0) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } SpellAuraProcResult Unit::HandleReflectSpellsSchoolAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Skip Melee hits and spells ws wrong school - return !(procSpell == NULL || (triggeredByAura->GetModifier()->m_miscvalue & GetSchoolMask(procSpell->School)) == 0) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; + return !(procSpell == nullptr || (triggeredByAura->GetModifier()->m_miscvalue & GetSchoolMask(procSpell->School)) == 0) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } SpellAuraProcResult Unit::HandleModPowerCostSchoolAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Skip melee hits and spells ws wrong school or zero cost - return !(procSpell == NULL || + return !(procSpell == nullptr || (procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0) || // Cost check (triggeredByAura->GetModifier()->m_miscvalue & GetSchoolMask(procSpell->School)) == 0) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; // School check } @@ -1819,7 +1819,7 @@ SpellAuraProcResult Unit::HandleModPowerCostSchoolAuraProc(Unit* /*pVictim*/, ui SpellAuraProcResult Unit::HandleMechanicImmuneResistanceAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Compare mechanic - return !(procSpell == NULL || procSpell->Mechanic != triggeredByAura->GetModifier()->m_miscvalue) + return !(procSpell == nullptr || procSpell->Mechanic != triggeredByAura->GetModifier()->m_miscvalue) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } @@ -1879,10 +1879,10 @@ SpellAuraProcResult Unit::HandleAddTargetTriggerAuraProc(Unit *pVictim, uint32 / // Cone de glace if (pVictim->GetGUID() == GetGUID()) return SPELL_AURA_PROC_FAILED; - pVictim->CastSpell(pVictim, trigger_spell_id, true, NULL, triggeredByAura); + pVictim->CastSpell(pVictim, trigger_spell_id, true, nullptr, triggeredByAura); } else - CastSpell(this, trigger_spell_id, true, NULL, triggeredByAura); + CastSpell(this, trigger_spell_id, true, nullptr, triggeredByAura); } return SPELL_AURA_PROC_OK; } @@ -1905,6 +1905,6 @@ SpellAuraProcResult Unit::HandleModResistanceAuraProc(Unit* /*pVictim*/, uint32 SpellAuraProcResult Unit::HandleModDamageAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // the aura school mask must match the spell school - return (procSpell == NULL || (GetSchoolMask(procSpell->School) & triggeredByAura->GetModifier()->m_miscvalue)) + return (procSpell == nullptr || (GetSchoolMask(procSpell->School) & triggeredByAura->GetModifier()->m_miscvalue)) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } diff --git a/src/game/UnitEvents.h b/src/game/UnitEvents.h index 199650f12..096a362f2 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -51,7 +51,7 @@ enum UnitThreatEventType // New target should be fetched, could tbe the current target as well UEV_THREAT_SET_NEXT_TARGET = 1<<5, - // A new victim (target) was set. Could be NULL + // A new victim (target) was set. Could be nullptr UEV_THREAT_VICTIM_CHANGED = 1<<6, }; @@ -91,13 +91,13 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent }; ThreatManager* iThreatManager; public: - ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = NULL; } + ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = nullptr; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iFValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iFValue = pValue; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iBValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; } int32 getIValue() const { return iIValue; } @@ -121,8 +121,8 @@ class MANGOS_DLL_SPEC ThreatManagerEvent : public ThreatRefStatusChangeEvent private: ThreatContainer* iThreatContainer; public: - ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(NULL) {} - ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(NULL) {} + ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(nullptr) {} + ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(nullptr) {} void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; } diff --git a/src/game/Weather.h b/src/game/Weather.h index 2181dc14d..8376372af 100644 --- a/src/game/Weather.h +++ b/src/game/Weather.h @@ -153,7 +153,7 @@ class WeatherMgr if (itr != mWeatherZoneMap.end()) return &itr->second; else - return NULL; + return nullptr; } private: diff --git a/src/game/World.cpp b/src/game/World.cpp index f8ef7d4b2..d66c5d294 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -185,7 +185,7 @@ WorldSession* World::FindSession(uint32 id) const SessionMap::const_iterator itr = m_sessions.find(id); if (itr != m_sessions.end()) - return itr->second; // also can return NULL for kicked session + return itr->second; // also can return nullptr for kicked session else return nullptr; } diff --git a/src/game/World.h b/src/game/World.h index 04ea975de..1ba24c263 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -790,13 +790,13 @@ class World void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); void SendZoneText(uint32 zone, const char *text, WorldSession *self = 0, uint32 team = 0); - void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL); + void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = nullptr); /// Are we in the middle of a shutdown? bool IsShutdowning() const { return m_ShutdownTimer > 0; } void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); void ShutdownCancel(); - void ShutdownMsg(bool show = false, Player* player = NULL); + void ShutdownMsg(bool show = false, Player* player = nullptr); static uint8 GetExitCode() { return m_ExitCode; } static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } static bool IsStopped() { return m_stopEvent; } @@ -885,7 +885,7 @@ class World void LogMoneyTrade(ObjectGuid sender, ObjectGuid receiver, uint32 amount, const char* type, uint32 dataInt); void LogCharacter(Player* character, const char* action); void LogCharacter(WorldSession* sess, uint32 lowGuid, std::string const& charName, const char* action); - void LogChat(WorldSession* sess, const char* type, std::string const& msg, PlayerPointer target = NULL, uint32 chanId = 0, const char* chanStr = NULL); + void LogChat(WorldSession* sess, const char* type, std::string const& msg, PlayerPointer target = nullptr, uint32 chanId = 0, const char* chanStr = nullptr); void LogTransaction(PlayerTransactionData const& data); void Shutdown(); void AddSessionToSessionsMap(WorldSession* sess); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index e0c6a5f35..341c1fb4c 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -177,7 +177,7 @@ void WorldSession::SendPacket(WorldPacket const* packet) packet2 >> guid2; packet2 >> textLen >> message >> chatTag; if (guid1.IsEmpty() || sObjectMgr.GetPlayerNameByGUID(guid1, name1)) - _chatBotHistory << uint32(msgtype) << " " << name1 << " NULL " << message << std::endl; + _chatBotHistory << uint32(msgtype) << " " << name1 << " nullptr " << message << std::endl; } return; } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 1311bf8e7..94c5f6100 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -334,7 +334,7 @@ class MANGOS_DLL_SPEC WorldSession // Session can be safely deleted if returns false bool ForcePlayerLogoutDelay(); - void QueuePacket(WorldPacket* new_packet, NodeSession* from_node = NULL); + void QueuePacket(WorldPacket* new_packet, NodeSession* from_node = nullptr); bool Update(PacketFilter& updater); /** @@ -513,7 +513,7 @@ class MANGOS_DLL_SPEC WorldSession { SessionScriptsMap::iterator it = scripts.find(name); if (it == scripts.end()) - return NULL; + return nullptr; return it->second; } SessionScriptsMap scripts; diff --git a/src/game/vmap/BIHWrap.h b/src/game/vmap/BIHWrap.h index f272c2121..53a0e507c 100644 --- a/src/game/vmap/BIHWrap.h +++ b/src/game/vmap/BIHWrap.h @@ -77,7 +77,7 @@ class BIHWrap uint32 Idx = 0; const T* temp; if (m_obj2Idx.getRemove(&obj, temp, Idx)) - m_objects[Idx] = NULL; + m_objects[Idx] = nullptr; else m_objects_to_push.remove(&obj); } diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index b7ee9b281..b409f656c 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -131,19 +131,19 @@ GameObjectModel* GameObjectModel::construct(const GameObject* const object) { // TODO: What kind of gobj should block LoS or not ? if (gobjInfo->type == GAMEOBJECT_TYPE_BUTTON && gobjInfo->button.losOK) - return NULL; + return nullptr; if (gobjInfo->type == GAMEOBJECT_TYPE_GOOBER && gobjInfo->goober.losOK) - return NULL; + return nullptr; } const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(object->GetDisplayId()); if (!info) - return NULL; + return nullptr; GameObjectModel* mdl = new GameObjectModel(); if (!mdl->initialize(object, info)) { delete mdl; - return NULL; + return nullptr; } return mdl; diff --git a/src/game/vmap/GameObjectModel.h b/src/game/vmap/GameObjectModel.h index 1ef77f41f..0eaa3001f 100644 --- a/src/game/vmap/GameObjectModel.h +++ b/src/game/vmap/GameObjectModel.h @@ -45,7 +45,7 @@ class GameObjectModel float iScale; VMAP::WorldModel* iModel; - GameObjectModel() : collision_enabled(false), iModel(NULL), iInvScale(0), iScale(0) {} + GameObjectModel() : collision_enabled(false), iModel(nullptr), iInvScale(0), iScale(0) {} bool initialize(const GameObject* const pGo, const GameObjectDisplayInfoEntry* info); public: diff --git a/src/game/vmap/IVMapManager.h b/src/game/vmap/IVMapManager.h index 1e10c4758..5d1ea967c 100644 --- a/src/game/vmap/IVMapManager.h +++ b/src/game/vmap/IVMapManager.h @@ -102,7 +102,7 @@ namespace VMAP \param z gets adjusted to the ground height for which this are info is valid */ virtual bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const = 0; - virtual bool isUnderModel(unsigned int pMapId, float x, float y, float z, float* outDist = NULL, float* inDist = NULL) const = 0; + virtual bool isUnderModel(unsigned int pMapId, float x, float y, float z, float* outDist = nullptr, float* inDist = nullptr) const = 0; virtual bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const = 0; }; } diff --git a/src/game/vmap/MapTree.cpp b/src/game/vmap/MapTree.cpp index 834e98958..2c6f548d2 100644 --- a/src/game/vmap/MapTree.cpp +++ b/src/game/vmap/MapTree.cpp @@ -58,7 +58,7 @@ protected: class MapIntersectionFinderCallback { public: - MapIntersectionFinderCallback(ModelInstance* val): prims(val), result(NULL) {} + MapIntersectionFinderCallback(ModelInstance* val): prims(val), result(nullptr) {} bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit = true) { bool hit = prims[entry].intersectRay(ray, distance, pStopAtFirstHit); @@ -178,7 +178,7 @@ bool StaticMapTree::GetLocationInfo(const Vector3& pos, LocationInfo& info) cons } StaticMapTree::StaticMapTree(uint32 mapID, const std::string& basePath): - iMapID(mapID), iIsTiled(false), iTreeValues(NULL), iNTreeValues(0), iBasePath(basePath) + iMapID(mapID), iIsTiled(false), iTreeValues(nullptr), iNTreeValues(0), iBasePath(basePath) { if (iBasePath.length() > 0 && (iBasePath[iBasePath.length() - 1] != '/' && iBasePath[iBasePath.length() - 1] != '\\')) iBasePath.append("/"); @@ -270,14 +270,14 @@ ModelInstance* StaticMapTree::FindCollisionModel(const G3D::Vector3& pos1, const { float maxDist = (pos2 - pos1).magnitude(); if (maxDist < 1e-10f) - return NULL; + return nullptr; G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1) / maxDist); MapIntersectionFinderCallback intersectionCallBack(iTreeValues); iTree.intersectRay(ray, intersectionCallBack, maxDist, true); if (intersectionCallBack.result) return intersectionCallBack.result; - return NULL; + return nullptr; } //========================================================= diff --git a/src/game/vmap/MapTree.h b/src/game/vmap/MapTree.h index a88d17d08..26b6521c8 100644 --- a/src/game/vmap/MapTree.h +++ b/src/game/vmap/MapTree.h @@ -73,7 +73,7 @@ namespace VMAP bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const; float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const; bool getAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const; - bool isUnderModel(G3D::Vector3& pos, float* outDist = NULL, float* inDist = NULL) const; + bool isUnderModel(G3D::Vector3& pos, float* outDist = nullptr, float* inDist = nullptr) const; bool GetLocationInfo(const Vector3& pos, LocationInfo& info) const; bool InitMap(const std::string& fname, VMapManager2* vm); diff --git a/src/game/vmap/ModelInstance.h b/src/game/vmap/ModelInstance.h index 2fc8be851..f42c700b2 100644 --- a/src/game/vmap/ModelInstance.h +++ b/src/game/vmap/ModelInstance.h @@ -70,7 +70,7 @@ namespace VMAP void setUnloaded() { iModel = 0; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; void intersectPoint(const G3D::Vector3& p, AreaInfo& info) const; - bool isUnderModel(const G3D::Vector3& p, float* outDist = NULL, float* inDist = NULL) const; + bool isUnderModel(const G3D::Vector3& p, float* outDist = nullptr, float* inDist = nullptr) const; bool GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const; bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo& info, float& liqHeight) const; protected: diff --git a/src/game/vmap/TileAssembler.cpp b/src/game/vmap/TileAssembler.cpp index 436a7dcca..7bd6bed29 100644 --- a/src/game/vmap/TileAssembler.cpp +++ b/src/game/vmap/TileAssembler.cpp @@ -59,7 +59,7 @@ Vector3 ModelPosition::transform(const Vector3& pIn) const TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName) : iSrcDir(pSrcDirName), iDestDir(pDestDirName) { iCurrentUniqueNameId = 0; - iFilterMethod = NULL; + iFilterMethod = nullptr; } TileAssembler::~TileAssembler() diff --git a/src/game/vmap/VMapFactory.cpp b/src/game/vmap/VMapFactory.cpp index cdc8c5f29..73cce40ab 100644 --- a/src/game/vmap/VMapFactory.cpp +++ b/src/game/vmap/VMapFactory.cpp @@ -79,7 +79,7 @@ void VMapFactory::preventSpellsFromBeingTestedForLoS(const char* pSpellIdString) { if (!iIgnoreSpellIds) iIgnoreSpellIds = new Table(); - if (pSpellIdString != NULL) + if (pSpellIdString != nullptr) { unsigned int pos = 0; unsigned int id; @@ -113,7 +113,7 @@ void VMapFactory::clear() delete iIgnoreSpellIds; delete gVMapManager; - iIgnoreSpellIds = NULL; - gVMapManager = NULL; + iIgnoreSpellIds = nullptr; + gVMapManager = nullptr; } } diff --git a/src/game/vmap/VMapManager2.cpp b/src/game/vmap/VMapManager2.cpp index 30f8e5591..0df9c80eb 100644 --- a/src/game/vmap/VMapManager2.cpp +++ b/src/game/vmap/VMapManager2.cpp @@ -151,8 +151,8 @@ bool VMapManager2::isInLineOfSight(unsigned int pMapId, float x1, float y1, floa } ModelInstance* VMapManager2::FindCollisionModel(unsigned int mapId, float x0, float y0, float z0, float x1, float y1, float z1) { - if (!isLineOfSightCalcEnabled()) return NULL; - ModelInstance* result = NULL; + if (!isLineOfSightCalcEnabled()) return nullptr; + ModelInstance* result = nullptr; InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) { @@ -288,7 +288,7 @@ WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, cons ERROR_LOG("VMapManager2: could not load '%s%s.vmo'!", basepath.c_str(), filename.c_str()); delete worldmodel; m_modelsLock.release(); - return NULL; + return nullptr; } //DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "VMapManager2: loading file '%s%s'.", basepath.c_str(), filename.c_str()); model = iLoadedModelFiles.insert(std::pair(filename, ManagedModel())).first; diff --git a/src/game/vmap/VMapManager2.h b/src/game/vmap/VMapManager2.h index 5defb2ff4..ab73f517a 100644 --- a/src/game/vmap/VMapManager2.h +++ b/src/game/vmap/VMapManager2.h @@ -100,7 +100,7 @@ namespace VMAP bool processCommand(char* /*pCommand*/) override { return false; } // for debug and extensions bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const override; - bool isUnderModel(unsigned int pMapId, float x, float y, float z, float* outDist = NULL, float* inDist = NULL) const override; + bool isUnderModel(unsigned int pMapId, float x, float y, float z, float* outDist = nullptr, float* inDist = nullptr) const override; bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const override; WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename); diff --git a/src/game/vmap/WorldModel.cpp b/src/game/vmap/WorldModel.cpp index 74cf17590..a7304dace 100644 --- a/src/game/vmap/WorldModel.cpp +++ b/src/game/vmap/WorldModel.cpp @@ -113,7 +113,7 @@ WmoLiquid::WmoLiquid(uint32 width, uint32 height, const Vector3& corner, uint32 iFlags = new uint8[width * height]; } -WmoLiquid::WmoLiquid(const WmoLiquid& other): iHeight(NULL), iFlags(NULL) +WmoLiquid::WmoLiquid(const WmoLiquid& other): iHeight(nullptr), iFlags(nullptr) { *this = other; // use assignment operator defined below } @@ -142,14 +142,14 @@ WmoLiquid& WmoLiquid::operator=(const WmoLiquid& other) memcpy(iHeight, other.iHeight, (iTilesX + 1) * (iTilesY + 1) * sizeof(float)); } else - iHeight = NULL; + iHeight = nullptr; if (other.iFlags) { iFlags = new uint8[iTilesX * iTilesY]; memcpy(iFlags, other.iFlags, iTilesX * iTilesY * sizeof(uint8)); } else - iFlags = NULL; + iFlags = nullptr; return *this; } diff --git a/src/game/vmap/WorldModel.h b/src/game/vmap/WorldModel.h index ba69dc054..119ceb8f4 100644 --- a/src/game/vmap/WorldModel.h +++ b/src/game/vmap/WorldModel.h @@ -84,10 +84,10 @@ namespace VMAP //! 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; } uint32 IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const; bool IsInsideObject(const Vector3& pos, const Vector3& up, float& z_dist) const; - bool IsUnderObject(const Vector3& pos, const Vector3& up, bool isM2, float* outDist = NULL, float* inDist = NULL) const; // Use client triangles orientation. You can see bot->top through the floor. + bool IsUnderObject(const Vector3& pos, const Vector3& up, bool isM2, float* outDist = nullptr, float* inDist = nullptr) const; // Use client triangles orientation. You can see bot->top through the floor. bool GetLiquidLevel(const Vector3& pos, float& liqHeight) const; uint32 GetLiquidType() const; bool writeToFile(FILE* wf); @@ -120,7 +120,7 @@ namespace VMAP void setRootWmoID(uint32 id) { RootWMOID = id; } bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const; bool IntersectPoint(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, AreaInfo& info) const; - bool IsUnderObject(const G3D::Vector3& p, const G3D::Vector3& up, bool m2, float* outDist = NULL, float* inDist = NULL) const; + bool IsUnderObject(const G3D::Vector3& p, const G3D::Vector3& up, bool m2, float* outDist = nullptr, float* inDist = nullptr) const; bool GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, LocationInfo& info) const; bool writeFile(const std::string& filename); bool readFile(const std::string& filename); diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 88539eacf..71954dca9 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -75,7 +75,7 @@ int kb_hit_return() tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); - select(STDIN_FILENO+1, &fds, NULL, NULL, &tv); + select(STDIN_FILENO+1, &fds, nullptr, nullptr, &tv); return FD_ISSET(STDIN_FILENO, &fds); } #endif @@ -110,7 +110,7 @@ void CliRunnable::run() break; #endif char *command_str = fgets(commandbuf,sizeof(commandbuf),stdin); - if (command_str != NULL) + if (command_str != nullptr) { for(int x=0;command_str[x];x++) if(command_str[x]=='\r'||command_str[x]=='\n') @@ -133,7 +133,7 @@ void CliRunnable::run() continue; } - sWorld.QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, NULL, command.c_str(), &utf8print, &commandFinished)); + sWorld.QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command.c_str(), &utf8print, &commandFinished)); } else if (feof(stdin)) { diff --git a/src/mangosd/MaNGOSsoap.cpp b/src/mangosd/MaNGOSsoap.cpp index dd30f2b61..0c1799f02 100644 --- a/src/mangosd/MaNGOSsoap.cpp +++ b/src/mangosd/MaNGOSsoap.cpp @@ -172,5 +172,5 @@ struct Namespace namespaces[] = { "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance" }, { "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema" }, { "ns1", "urn:MaNGOS" }, // "ns1" namespace prefix - { NULL, NULL } + { nullptr, nullptr } }; diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index c7c9b9f17..be90e9e26 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -103,7 +103,7 @@ public: sLog.outError("World Thread hangs, kicking out server!"); signal(SIGSEGV, 0); Master::m_handleSigvSignals = false; // disable anticrash - *((uint32 volatile*)NULL) = 0; // bang crash + *((uint32 volatile*)nullptr) = 0; // bang crash } #endif } @@ -309,7 +309,7 @@ int Master::Run() LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID); } - ACE_Based::Thread* cliThread = NULL; + ACE_Based::Thread* cliThread = nullptr; #ifdef WIN32 if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) @@ -321,10 +321,10 @@ int Master::Run() cliThread = new ACE_Based::Thread(new CliRunnable); } - ACE_Based::Thread* rar_thread = NULL; + ACE_Based::Thread* rar_thread = nullptr; if (sConfig.GetBoolDefault ("Ra.Enable", false)) rar_thread = new ACE_Based::Thread(new RARunnable); - ACE_Based::Thread* offlinechat_thread = NULL; + ACE_Based::Thread* offlinechat_thread = nullptr; if (sConfig.GetBoolDefault ("OfflineChat.Enable", false)) offlinechat_thread = new ACE_Based::Thread(new OfflineChatRunnable); @@ -372,7 +372,7 @@ int Master::Run() #endif ///- Start soap serving thread - ACE_Based::Thread* soap_thread = NULL; + ACE_Based::Thread* soap_thread = nullptr; if(sConfig.GetBoolDefault("SOAP.Enabled", false)) { @@ -383,7 +383,7 @@ int Master::Run() } ///- Start up freeze catcher thread - ACE_Based::Thread* freeze_thread = NULL; + ACE_Based::Thread* freeze_thread = nullptr; if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable(); @@ -693,7 +693,7 @@ void Master::_OnSignal(int s) sObjectAccessor.SaveAllPlayers(); ACE_Based::Thread::Sleep(25000); // Wait enough time to execute the SQL queries. } - *((int*)NULL) = 42; // Crash for real now. + *((int*)nullptr) = 42; // Crash for real now. return; } diff --git a/src/mangosd/soapC.cpp b/src/mangosd/soapC.cpp index 22815a911..b83bf3bf5 100644 --- a/src/mangosd/soapC.cpp +++ b/src/mangosd/soapC.cpp @@ -22,7 +22,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) { if (soap->header) { soap->part = SOAP_IN_HEADER; - if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL)) + if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, nullptr)) return soap->error; soap->part = SOAP_END_HEADER; } @@ -32,9 +32,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) { soap->part = SOAP_IN_HEADER; - soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL); + soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", nullptr, nullptr); soap->part = SOAP_END_HEADER; - return soap->header == NULL; + return soap->header == nullptr; } SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) @@ -71,13 +71,13 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap) SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap) { if (soap->fault) - return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", NULL); + return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", nullptr); return SOAP_OK; } SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) { - return (soap->fault = soap_get_SOAP_ENV__Fault(soap, NULL, "SOAP-ENV:Fault", NULL)) == NULL; + return (soap->fault = soap_get_SOAP_ENV__Fault(soap, nullptr, "SOAP-ENV:Fault", nullptr)) == nullptr; } SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) @@ -150,25 +150,25 @@ extern "C" { SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) { if (soap_peek_element(soap)) - return NULL; + return nullptr; if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) *type = soap_lookup_type(soap, soap->href); switch (*type) { case SOAP_TYPE_byte: - return soap_in_byte(soap, NULL, NULL, "xsd:byte"); + return soap_in_byte(soap, nullptr, nullptr, "xsd:byte"); case SOAP_TYPE_int: - return soap_in_int(soap, NULL, NULL, "xsd:int"); + return soap_in_int(soap, nullptr, nullptr, "xsd:int"); case SOAP_TYPE_ns1__executeCommand: - return soap_in_ns1__executeCommand(soap, NULL, NULL, "ns1:executeCommand"); + return soap_in_ns1__executeCommand(soap, nullptr, nullptr, "ns1:executeCommand"); case SOAP_TYPE_ns1__executeCommandResponse: - return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, "ns1:executeCommandResponse"); + return soap_in_ns1__executeCommandResponse(soap, nullptr, nullptr, "ns1:executeCommandResponse"); case SOAP_TYPE_PointerTostring: - return soap_in_PointerTostring(soap, NULL, NULL, "xsd:string"); + return soap_in_PointerTostring(soap, nullptr, nullptr, "xsd:string"); case SOAP_TYPE_string: { char **s; - s = soap_in_string(soap, NULL, NULL, "xsd:string"); - return s ? *s : NULL; + s = soap_in_string(soap, nullptr, nullptr, "xsd:string"); + return s ? *s : nullptr; } default: { const char *t = soap->type; @@ -176,37 +176,37 @@ SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) t = soap->tag; if (!soap_match_tag(soap, t, "xsd:byte")) { *type = SOAP_TYPE_byte; - return soap_in_byte(soap, NULL, NULL, NULL); + return soap_in_byte(soap, nullptr, nullptr, nullptr); } if (!soap_match_tag(soap, t, "xsd:int")) { *type = SOAP_TYPE_int; - return soap_in_int(soap, NULL, NULL, NULL); + return soap_in_int(soap, nullptr, nullptr, nullptr); } if (!soap_match_tag(soap, t, "ns1:executeCommand")) { *type = SOAP_TYPE_ns1__executeCommand; - return soap_in_ns1__executeCommand(soap, NULL, NULL, NULL); + return soap_in_ns1__executeCommand(soap, nullptr, nullptr, nullptr); } if (!soap_match_tag(soap, t, "ns1:executeCommandResponse")) { *type = SOAP_TYPE_ns1__executeCommandResponse; - return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, NULL); + return soap_in_ns1__executeCommandResponse(soap, nullptr, nullptr, nullptr); } if (!soap_match_tag(soap, t, "xsd:string")) { char **s; *type = SOAP_TYPE_string; - s = soap_in_string(soap, NULL, NULL, NULL); - return s ? *s : NULL; + s = soap_in_string(soap, nullptr, nullptr, nullptr); + return s ? *s : nullptr; } t = soap->tag; if (!soap_match_tag(soap, t, "xsd:QName")) { char **s; *type = SOAP_TYPE__QName; - s = soap_in__QName(soap, NULL, NULL, NULL); - return s ? *s : NULL; + s = soap_in__QName(soap, nullptr, nullptr, nullptr); + return s ? *s : nullptr; } } } soap->error = SOAP_TAG_MISMATCH; - return NULL; + return nullptr; } #ifdef __cplusplus @@ -237,7 +237,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) while (!soap_ignore_element(soap)) ; if (soap->error == SOAP_NO_TAG) - soap->error = soap_element_end_in(soap, NULL); + soap->error = soap_element_end_in(soap, nullptr); } } } @@ -279,7 +279,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, co case SOAP_TYPE_PointerTostring: return soap_out_PointerTostring(soap, tag, id, (char **const*)ptr, "xsd:string"); case SOAP_TYPE__QName: - return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, NULL); + return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, nullptr); case SOAP_TYPE_string: return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:string"); } @@ -353,7 +353,7 @@ SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap *soap, int t, const ch return (void*)soap_instantiate_SOAP_ENV__Fault(soap, -1, type, arrayType, n); #endif } - return NULL; + return nullptr; } SOAP_FMAC3 int SOAP_FMAC4 soap_fdelete(struct soap_clist *p) @@ -421,7 +421,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_byte); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_byte); if (soap_out_byte(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -436,7 +436,7 @@ SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap *soap, char *p, const cha { if ((p = soap_in_byte(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -456,7 +456,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_int); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_int); if (soap_out_int(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -471,7 +471,7 @@ SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap *soap, int *p, const char * { if ((p = soap_in_int(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -488,12 +488,12 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struc soap_default__QName(soap, &a->faultcode); soap_default_string(soap, &a->faultstring); soap_default_string(soap, &a->faultactor); - a->detail = NULL; - a->SOAP_ENV__Code = NULL; - a->SOAP_ENV__Reason = NULL; + a->detail = nullptr; + a->SOAP_ENV__Code = nullptr; + a->SOAP_ENV__Reason = nullptr; soap_default_string(soap, &a->SOAP_ENV__Node); soap_default_string(soap, &a->SOAP_ENV__Role); - a->SOAP_ENV__Detail = NULL; + a->SOAP_ENV__Detail = nullptr; } SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a) @@ -512,7 +512,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, con SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Fault); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Fault); if (soap_out_SOAP_ENV__Fault(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -548,7 +548,7 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct s { if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -556,10 +556,10 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct so { short soap_flag_faultcode = 1, soap_flag_faultstring = 1, soap_flag_faultactor = 1, soap_flag_detail = 1, soap_flag_SOAP_ENV__Code = 1, soap_flag_SOAP_ENV__Reason = 1, soap_flag_SOAP_ENV__Node = 1, soap_flag_SOAP_ENV__Role = 1, soap_flag_SOAP_ENV__Detail = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); + return nullptr; + a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_SOAP_ENV__Fault(soap, a); if (soap->body && !*soap->href) { @@ -615,21 +615,21 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct so if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); + { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct SOAP_ENV__Fault * SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Fault(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_SOAP_ENV__Fault(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p) @@ -639,9 +639,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap *soap, struct SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Fault(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Fault, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Fault, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct SOAP_ENV__Fault; if (size) @@ -651,7 +651,7 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault( { cp->ptr = (void*)new struct SOAP_ENV__Fault[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct SOAP_ENV__Fault); @@ -683,7 +683,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); if (soap_out_SOAP_ENV__Reason(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -702,7 +702,7 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct { if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -710,10 +710,10 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct { short soap_flag_SOAP_ENV__Text = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); + return nullptr; + a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_SOAP_ENV__Reason(soap, a); if (soap->body && !*soap->href) { @@ -729,21 +729,21 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); + { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct SOAP_ENV__Reason * SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Reason(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_SOAP_ENV__Reason(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p) @@ -753,9 +753,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap *soap, struc SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Reason(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Reason, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Reason, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct SOAP_ENV__Reason; if (size) @@ -765,7 +765,7 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reaso { cp->ptr = (void*)new struct SOAP_ENV__Reason[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct SOAP_ENV__Reason); @@ -787,8 +787,8 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, stru { (void)soap; (void)a; /* appease -Wall -Werror */ a->__type = 0; - a->fault = NULL; - a->__any = NULL; + a->fault = nullptr; + a->__any = nullptr; } SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) @@ -799,7 +799,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -811,7 +811,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const cha return soap->error; if (soap_putelement(soap, a->fault, "fault", -1, a->__type)) return soap->error; - soap_outliteral(soap, "-any", &a->__any, NULL); + soap_outliteral(soap, "-any", &a->__any, nullptr); return soap_element_end_out(soap, tag); } @@ -819,7 +819,7 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct { if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -827,10 +827,10 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct { short soap_flag_fault = 1, soap_flag___any = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); + return nullptr; + a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_SOAP_ENV__Detail(soap, a); if (soap->body && !*soap->href) { @@ -851,21 +851,21 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); + { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct SOAP_ENV__Detail * SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Detail(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_SOAP_ENV__Detail(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p) @@ -875,9 +875,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap *soap, struc SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Detail(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Detail, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Detail, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct SOAP_ENV__Detail; if (size) @@ -887,7 +887,7 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detai { cp->ptr = (void*)new struct SOAP_ENV__Detail[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct SOAP_ENV__Detail); @@ -909,7 +909,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct { (void)soap; (void)a; /* appease -Wall -Werror */ soap_default__QName(soap, &a->SOAP_ENV__Value); - a->SOAP_ENV__Subcode = NULL; + a->SOAP_ENV__Subcode = nullptr; } SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) @@ -921,7 +921,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, cons SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Code); if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -943,7 +943,7 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soa { if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -951,10 +951,10 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap { short soap_flag_SOAP_ENV__Value = 1, soap_flag_SOAP_ENV__Subcode = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); + return nullptr; + a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_SOAP_ENV__Code(soap, a); if (soap->body && !*soap->href) { @@ -975,21 +975,21 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); + { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct SOAP_ENV__Code * SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Code(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_SOAP_ENV__Code(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p) @@ -999,9 +999,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap *soap, struct SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Code(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Code, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Code, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct SOAP_ENV__Code; if (size) @@ -1011,7 +1011,7 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(st { cp->ptr = (void*)new struct SOAP_ENV__Code[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct SOAP_ENV__Code); @@ -1041,7 +1041,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_SOAP_ENV__Header); if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1058,17 +1058,17 @@ SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct { if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) { if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); + return nullptr; + a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_SOAP_ENV__Header(soap, a); if (soap->body && !*soap->href) { @@ -1079,21 +1079,21 @@ SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); + { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct SOAP_ENV__Header * SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Header(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_SOAP_ENV__Header(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p) @@ -1103,9 +1103,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap *soap, struc SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Header(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Header, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_SOAP_ENV__Header, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct SOAP_ENV__Header; if (size) @@ -1115,7 +1115,7 @@ SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Heade { cp->ptr = (void*)new struct SOAP_ENV__Header[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct SOAP_ENV__Header); @@ -1145,7 +1145,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap *soap, SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap *soap, const struct ns1__executeCommand *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__executeCommand); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_ns1__executeCommand); if (soap_out_ns1__executeCommand(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1164,7 +1164,7 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_get_ns1__executeCommand( { if ((p = soap_in_ns1__executeCommand(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -1172,10 +1172,10 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(s { short soap_flag_command = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct ns1__executeCommand *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommand, sizeof(struct ns1__executeCommand), 0, NULL, NULL, NULL); + return nullptr; + a = (struct ns1__executeCommand *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommand, sizeof(struct ns1__executeCommand), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_ns1__executeCommand(soap, a); if (soap->body && !*soap->href) { @@ -1191,21 +1191,21 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(s if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct ns1__executeCommand *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommand, 0, sizeof(struct ns1__executeCommand), 0, NULL); + { a = (struct ns1__executeCommand *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommand, 0, sizeof(struct ns1__executeCommand), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct ns1__executeCommand * SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap *soap, int n) -{ return soap_instantiate_ns1__executeCommand(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_ns1__executeCommand(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap *soap, struct ns1__executeCommand *p) @@ -1215,9 +1215,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap *soap, st SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_ns1__executeCommand(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommand, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_ns1__executeCommand, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct ns1__executeCommand; if (size) @@ -1227,7 +1227,7 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_instantiate_ns1__execute { cp->ptr = (void*)new struct ns1__executeCommand[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct ns1__executeCommand); @@ -1244,7 +1244,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap *soap, int SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap *soap, struct ns1__executeCommandResponse *a) { (void)soap; (void)a; /* appease -Wall -Werror */ - a->result = NULL; + a->result = nullptr; } SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap *soap, const struct ns1__executeCommandResponse *a) @@ -1255,7 +1255,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soa SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap *soap, const struct ns1__executeCommandResponse *a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__executeCommandResponse); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_ns1__executeCommandResponse); if (soap_out_ns1__executeCommandResponse(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1274,7 +1274,7 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_get_ns1__execute { if ((p = soap_in_ns1__executeCommandResponse(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -1282,10 +1282,10 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeC { short soap_flag_result = 1; if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct ns1__executeCommandResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommandResponse, sizeof(struct ns1__executeCommandResponse), 0, NULL, NULL, NULL); + return nullptr; + a = (struct ns1__executeCommandResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommandResponse, sizeof(struct ns1__executeCommandResponse), 0, nullptr, nullptr, nullptr); if (!a) - return NULL; + return nullptr; soap_default_ns1__executeCommandResponse(soap, a); if (soap->body && !*soap->href) { @@ -1301,21 +1301,21 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeC if (soap->error == SOAP_NO_TAG) break; if (soap->error) - return NULL; + return nullptr; } if (soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } else - { a = (struct ns1__executeCommandResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommandResponse, 0, sizeof(struct ns1__executeCommandResponse), 0, NULL); + { a = (struct ns1__executeCommandResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommandResponse, 0, sizeof(struct ns1__executeCommandResponse), 0, nullptr); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } SOAP_FMAC5 struct ns1__executeCommandResponse * SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap *soap, int n) -{ return soap_instantiate_ns1__executeCommandResponse(soap, n, NULL, NULL, NULL); +{ return soap_instantiate_ns1__executeCommandResponse(soap, n, nullptr, nullptr, nullptr); } SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap *soap, struct ns1__executeCommandResponse *p) @@ -1325,9 +1325,9 @@ SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap * SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_ns1__executeCommandResponse(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommandResponse, n, soap_fdelete); + struct soap_clist *cp = soap_link(soap, nullptr, SOAP_TYPE_ns1__executeCommandResponse, n, soap_fdelete); if (!cp) - return NULL; + return nullptr; if (n < 0) { cp->ptr = (void*)new struct ns1__executeCommandResponse; if (size) @@ -1337,7 +1337,7 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_instantiate_ns1_ { cp->ptr = (void*)new struct ns1__executeCommandResponse[n]; if (!cp->ptr) { soap->error = SOAP_EOM; - return NULL; + return nullptr; } if (size) *size = n * sizeof(struct ns1__executeCommandResponse); @@ -1361,7 +1361,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); if (soap_out_PointerToSOAP_ENV__Reason(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1369,7 +1369,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Reason *const*a, const char *type) { - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Reason); + id = soap_element_id(soap, tag, id, *a, nullptr, 0, type, SOAP_TYPE_SOAP_ENV__Reason); if (id < 0) return soap->error; return soap_out_SOAP_ENV__Reason(soap, tag, id, *a, type); @@ -1379,27 +1379,27 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Rea { if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason **a, const char *type) { - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; + if (soap_element_begin_in(soap, tag, 1, nullptr)) + return nullptr; if (!a) if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason *)))) - return NULL; - *a = NULL; + return nullptr; + *a = nullptr; if (!soap->null && *soap->href != '#') { soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) - return NULL; + return nullptr; } else { a = (struct SOAP_ENV__Reason **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } @@ -1416,7 +1416,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Detail); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Detail); if (soap_out_PointerToSOAP_ENV__Detail(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1424,7 +1424,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Detail *const*a, const char *type) { - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Detail); + id = soap_element_id(soap, tag, id, *a, nullptr, 0, type, SOAP_TYPE_SOAP_ENV__Detail); if (id < 0) return soap->error; return soap_out_SOAP_ENV__Detail(soap, tag, id, *a, type); @@ -1434,27 +1434,27 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Det { if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail **a, const char *type) { - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; + if (soap_element_begin_in(soap, tag, 1, nullptr)) + return nullptr; if (!a) if (!(a = (struct SOAP_ENV__Detail **)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail *)))) - return NULL; - *a = NULL; + return nullptr; + *a = nullptr; if (!soap->null && *soap->href != '#') { soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type))) - return NULL; + return nullptr; } else { a = (struct SOAP_ENV__Detail **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } @@ -1471,7 +1471,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap *s SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Code); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Code); if (soap_out_PointerToSOAP_ENV__Code(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1479,7 +1479,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, st SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Code *const*a, const char *type) { - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Code); + id = soap_element_id(soap, tag, id, *a, nullptr, 0, type, SOAP_TYPE_SOAP_ENV__Code); if (id < 0) return soap->error; return soap_out_SOAP_ENV__Code(soap, tag, id, *a, type); @@ -1489,27 +1489,27 @@ SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code( { if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code **a, const char *type) { - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; + if (soap_element_begin_in(soap, tag, 1, nullptr)) + return nullptr; if (!a) if (!(a = (struct SOAP_ENV__Code **)soap_malloc(soap, sizeof(struct SOAP_ENV__Code *)))) - return NULL; - *a = NULL; + return nullptr; + *a = nullptr; if (!soap->null && *soap->href != '#') { soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type))) - return NULL; + return nullptr; } else { a = (struct SOAP_ENV__Code **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } @@ -1524,7 +1524,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap *soap, cha SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap *soap, char **const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTostring); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_PointerTostring); if (soap_out_PointerTostring(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1532,7 +1532,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap *soap, char **con SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap *soap, const char *tag, int id, char **const*a, const char *type) { - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_string); + id = soap_element_id(soap, tag, id, *a, nullptr, 0, type, SOAP_TYPE_string); if (id < 0) return soap->error; return soap_out_string(soap, tag, id, *a, type); @@ -1542,27 +1542,27 @@ SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap *soap, char { if ((p = soap_in_PointerTostring(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap *soap, const char *tag, char ***a, const char *type) { - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; + if (soap_element_begin_in(soap, tag, 1, nullptr)) + return nullptr; if (!a) if (!(a = (char ***)soap_malloc(soap, sizeof(char **)))) - return NULL; - *a = NULL; + return nullptr; + *a = nullptr; if (!soap->null && *soap->href != '#') { soap_revert(soap); if (!(*a = soap_in_string(soap, tag, *a, type))) - return NULL; + return nullptr; } else { a = (char ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_string, sizeof(char *), 1); if (soap->body && soap_element_end_in(soap, tag)) - return NULL; + return nullptr; } return a; } @@ -1577,7 +1577,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap *soap, char *const* SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__QName); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE__QName); if (soap_out__QName(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1592,7 +1592,7 @@ SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p, const { if ((p = soap_in__QName(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } @@ -1617,7 +1617,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap *soap, char *const* SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const*a, const char *tag, const char *type) { - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_string); + register int id = soap_embed(soap, (void*)a, nullptr, 0, tag, SOAP_TYPE_string); if (soap_out_string(soap, tag, id, a, type)) return soap->error; return soap_putindependent(soap); @@ -1632,7 +1632,7 @@ SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap *soap, char **p, const { if ((p = soap_in_string(soap, tag, p, type))) if (soap_getindependent(soap)) - return NULL; + return nullptr; return p; } diff --git a/src/mangosd/soapServer.cpp b/src/mangosd/soapServer.cpp index 8be139353..99c224a6c 100644 --- a/src/mangosd/soapServer.cpp +++ b/src/mangosd/soapServer.cpp @@ -84,11 +84,11 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap) struct ns1__executeCommandResponse soap_tmp_ns1__executeCommandResponse; char * soap_tmp_string; soap_default_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse); - soap_tmp_string = NULL; + soap_tmp_string = nullptr; soap_tmp_ns1__executeCommandResponse.result = &soap_tmp_string; soap_default_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand); - soap->encodingStyle = NULL; - if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", NULL)) + soap->encodingStyle = nullptr; + if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", nullptr)) return soap->error; if (soap_body_end_in(soap) || soap_envelope_end_in(soap) diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 4872da7a1..69b293bbe 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -623,7 +623,7 @@ bool AuthSocket::_HandleLogonProof() } ///- Check if the client has one of the expected version numbers - bool valid_version = FindBuildInfo(_build) != NULL; + bool valid_version = FindBuildInfo(_build) != nullptr; ///- Session is closed unless overriden _status = STATUS_CLOSED; @@ -641,7 +641,7 @@ bool AuthSocket::_HandleLogonProof() snprintf(tmp, 24, "./patches/%d%s.mpq", _build, _localizationName.c_str()); char filename[PATH_MAX]; - if (ACE_OS::realpath(tmp, filename) != NULL) + if (ACE_OS::realpath(tmp, filename) != nullptr) { patch_ = ACE_OS::open(filename, GENERIC_READ | FILE_FLAG_SEQUENTIAL_SCAN); } @@ -701,7 +701,7 @@ bool AuthSocket::_HandleLogonProof() return false; Sha1Hash sha; - sha.UpdateBigNumbers(&A, &B, NULL); + sha.UpdateBigNumbers(&A, &B, nullptr); sha.Finalize(); BigNumber u; u.SetBinary(sha.GetDigest(), 20); @@ -738,11 +738,11 @@ bool AuthSocket::_HandleLogonProof() uint8 hash[20]; sha.Initialize(); - sha.UpdateBigNumbers(&N, NULL); + sha.UpdateBigNumbers(&N, nullptr); sha.Finalize(); memcpy(hash, sha.GetDigest(), 20); sha.Initialize(); - sha.UpdateBigNumbers(&g, NULL); + sha.UpdateBigNumbers(&g, nullptr); sha.Finalize(); for (int i = 0; i < 20; ++i) { @@ -758,9 +758,9 @@ bool AuthSocket::_HandleLogonProof() memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); sha.Initialize(); - sha.UpdateBigNumbers(&t3, NULL); + sha.UpdateBigNumbers(&t3, nullptr); sha.UpdateData(t4, SHA_DIGEST_LENGTH); - sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); + sha.UpdateBigNumbers(&s, &A, &B, &K, nullptr); sha.Finalize(); BigNumber M; M.SetBinary(sha.GetDigest(), 20); @@ -883,7 +883,7 @@ bool AuthSocket::_HandleLogonProof() ///- Finish SRP6 and send the final result to the client sha.Initialize(); - sha.UpdateBigNumbers(&A, &M, &K, NULL); + sha.UpdateBigNumbers(&A, &M, &K, nullptr); sha.Finalize(); SendProof(sha); @@ -1039,7 +1039,7 @@ bool AuthSocket::_HandleReconnectProof() Sha1Hash sha; sha.Initialize(); sha.UpdateData(_login); - sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); + sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, nullptr); sha.Finalize(); if (!memcmp(sha.GetDigest(), lp.R2, SHA_DIGEST_LENGTH)) @@ -1148,7 +1148,7 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt) bool ok_build = std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end(); - RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : NULL; + RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : nullptr; if (!buildInfo) buildInfo = &i->second.realmBuildInfo; @@ -1209,7 +1209,7 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt) bool ok_build = std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end(); - RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : NULL; + RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : nullptr; if (!buildInfo) buildInfo = &i->second.realmBuildInfo; @@ -1393,7 +1393,7 @@ uint32 AuthSocket::GenerateTotpPin(const std::string& secret, int interval) { } // not guaranteed by the standard to be the UNIX epoch but it is on all supported platforms - auto time = std::time(NULL); + auto time = std::time(nullptr); uint64 now = static_cast(time); uint64 step = static_cast((floor(now / 30))) + interval; EndianConvertReverse(step); diff --git a/src/realmd/BufferedSocket.cpp b/src/realmd/BufferedSocket.cpp index 42d5bb4e0..af7066505 100644 --- a/src/realmd/BufferedSocket.cpp +++ b/src/realmd/BufferedSocket.cpp @@ -130,7 +130,7 @@ ssize_t BufferedSocket::noblk_send(ACE_Message_Block &message_block) bool BufferedSocket::send(const char *buf, size_t len) { - if(buf == NULL || len == 0) + if(buf == nullptr || len == 0) return true; ACE_Data_Block db( diff --git a/src/realmd/PatchHandler.cpp b/src/realmd/PatchHandler.cpp index 3d480fac2..953866643 100644 --- a/src/realmd/PatchHandler.cpp +++ b/src/realmd/PatchHandler.cpp @@ -60,7 +60,7 @@ struct Chunk PatchHandler::PatchHandler(ACE_HANDLE socket, ACE_HANDLE patch) { - reactor(NULL); + reactor(nullptr); set_handle(socket); patch_fd_ = patch; } @@ -203,7 +203,7 @@ void PatchCache::LoadPatchesInfo() ACE_DIRENT* dp; - while((dp = ACE_OS::readdir(dirp)) != NULL) + while((dp = ACE_OS::readdir(dirp)) != nullptr) { int l = strlen(dp->d_name); if (l < 8) diff --git a/src/realmd/RealmList.cpp b/src/realmd/RealmList.cpp index 7bc6a5ff2..d3e3b1578 100644 --- a/src/realmd/RealmList.cpp +++ b/src/realmd/RealmList.cpp @@ -75,10 +75,10 @@ RealmBuildInfo const* FindBuildInfo(uint16 _build) return &ExpectedRealmdClientBuilds[i]; // none appropriate build - return NULL; + return nullptr; } -RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) +RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(nullptr)) { } @@ -140,10 +140,10 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri void RealmList::UpdateIfNeed() { // maybe disabled or updated recently - if(!m_UpdateInterval || m_NextUpdateTime > time(NULL)) + if(!m_UpdateInterval || m_NextUpdateTime > time(nullptr)) return; - m_NextUpdateTime = time(NULL) + m_UpdateInterval; + m_NextUpdateTime = time(nullptr) + m_UpdateInterval; // Clears Realm list m_realms.clear(); diff --git a/src/scripts/battlegrounds/battleground_alterac.cpp b/src/scripts/battlegrounds/battleground_alterac.cpp index 2af2ceb15..1eef4db22 100644 --- a/src/scripts/battlegrounds/battleground_alterac.cpp +++ b/src/scripts/battlegrounds/battleground_alterac.cpp @@ -1270,7 +1270,7 @@ struct npc_AlteracBowmanAI : public ScriptedAI void GetAIInformation(ChatHandler& reader) { reader.PSendSysMessage("npc_AlteracBowmanAI::GetAIInformation"); - reader.PSendSysMessage("victim: %s", m_creature->getVictim() ? m_creature->getVictim()->GetName() : "NULL"); + reader.PSendSysMessage("victim: %s", m_creature->getVictim() ? m_creature->getVictim()->GetName() : "nullptr"); reader.PSendSysMessage("evade_mode: %u", m_creature->IsInEvadeMode()); ScriptedAI::GetAIInformation(reader); } @@ -1706,7 +1706,7 @@ struct AV_NpcEventTroopsAI : public npc_escortAI { if (!pEscortAI->HasEscortState(STATE_ESCORT_ESCORTING)) { - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pEscortAI->setCurrentWP(getCurrentWP()); isOnHisOwn = true; } @@ -2553,7 +2553,7 @@ struct AV_NpcEventAI : public npc_escortAI { pEscortAI->Reset(); (*it)->SetRespawnDelay(432000); - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pEscortAI->setCurrentWP(getCurrentWP()); } } @@ -2908,7 +2908,7 @@ bool QuestComplete_npc_AVBlood_collector(Player* pPlayer, Creature* pQuestGiver, /** Start NPC movement for World Boss event */ if (AV_NpcEventAI* pEscortAI = dynamic_cast(pQuestGiver->AI())) { - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pQuestGiver->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pQuestGiver->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pQuestGiver->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); @@ -3122,7 +3122,7 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) if (AV_NpcEventAI* pEscortAI = dynamic_cast(pCreature->AI())) { pCreature->setFaction(1194); - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); @@ -3149,7 +3149,7 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) pCreature->CastSpell(pCreature, 5759, false); pCreature->setFaction(1194); - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); @@ -3579,7 +3579,7 @@ struct AV_npc_troops_chief_EventAI : public npc_escortAI { /** Start escort for troops since leader is dead */ if (AV_npc_troops_chief_EventAI* pEscortAI = dynamic_cast((*it)->AI())) - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); } m_RamRiderList.clear(); } @@ -3691,7 +3691,7 @@ bool QuestComplete_AV_npc_troops_chief(Player* pPlayer, Creature* pQuestGiver, Q if (AV_npc_troops_chief_EventAI* pEscortAI = dynamic_cast(pQuestGiver->AI())) { - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); pQuestGiver->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pQuestGiver->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pQuestGiver->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); @@ -3916,7 +3916,7 @@ bool GossipSelect_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature, ui if (AV_NpcEventAI* pEscortAI = dynamic_cast(pCreature->AI())) { - pEscortAI->Start(true, NULL, NULL, false); + pEscortAI->Start(true, 0, nullptr, false); //pCreature->setFaction(pPlayer->getFaction()); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); @@ -4322,7 +4322,7 @@ class av_world_boss_baseai: public npc_escortAI } m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); // Back on escart_ai path. ReturnToCombatStartPosition(); @@ -4478,7 +4478,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiEngageTimer < uiDiff && isEngageModeStarted == false) { /** Start waypoint path system */ - Start(false, NULL, NULL, false); + Start(false, 0, nullptr, false); isEngageModeStarted = true; } else @@ -4659,7 +4659,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai if (m_uiEngageTimer < uiDiff && isEngageModeStarted == false) { /** Start waypoint path system */ - Start(false, NULL, NULL, false); + Start(false, 0, nullptr, false); isEngageModeStarted = true; } else @@ -5258,14 +5258,14 @@ class npc_av_battle_npc_summoner: public ScriptedAI { float x, y, z; m_creature->GetPosition(x, y, z); - m_creature->GetMap()->GetWalkRandomPosition(NULL, x, y, z, 5.0f); + m_creature->GetMap()->GetWalkRandomPosition(nullptr, x, y, z, 5.0f); if (Creature* c = m_creature->SummonCreature(SelectCreatureEntry(), x, y, z, 0.0f, TEMPSUMMON_CORPSE_DESPAWN)) { m_summoned[i] = c->GetObjectGuid(); x = m_destX; y = m_destY; z = m_destZ; - m_creature->GetMap()->GetWalkRandomPosition(NULL, x, y, z, 20.0f); + m_creature->GetMap()->GetWalkRandomPosition(nullptr, x, y, z, 20.0f); c->SetHomePosition(x, y, z, frand(0, 2 * M_PI_F)); c->SetRespawnRadius(10.0f); c->SetDefaultMovementType(RANDOM_MOTION_TYPE); diff --git a/src/scripts/custom/boss_arena_hardog.cpp b/src/scripts/custom/boss_arena_hardog.cpp index fab6ad2dd..d4e4a0eb2 100644 --- a/src/scripts/custom/boss_arena_hardog.cpp +++ b/src/scripts/custom/boss_arena_hardog.cpp @@ -394,7 +394,7 @@ struct npc_karlekAI : public ScriptedAI { if (pSummoned->GetObjectGuid() == m_uiSzerelmesGUID) { - m_creature->MonsterTextEmote("Vous me faites perdre mon temps !", NULL); + m_creature->MonsterTextEmote("Vous me faites perdre mon temps !", nullptr); ResetEvent(); } } diff --git a/src/scripts/custom/event_attack_city.cpp b/src/scripts/custom/event_attack_city.cpp index 3ab221c46..3c9660197 100644 --- a/src/scripts/custom/event_attack_city.cpp +++ b/src/scripts/custom/event_attack_city.cpp @@ -728,7 +728,7 @@ struct npc_event_wave_mobAI : public ScriptedAI MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(ME, ME, 120.0f); MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(ME, searcher, 120.0f); - Unit* nearest = NULL; + Unit* nearest = nullptr; uint32 quality = 0; for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) { @@ -763,7 +763,7 @@ struct npc_event_wave_mobAI : public ScriptedAI } // Il faut quand meme s'arreter a un moment, sinon toute la foret d'Elwynn va y passer. if (quality <= 7) - return NULL; + return nullptr; return nearest; } void UpdateAI(const uint32 uiDiff) diff --git a/src/scripts/custom/gmisland.cpp b/src/scripts/custom/gmisland.cpp index f927b10cb..8a53f7ba7 100644 --- a/src/scripts/custom/gmisland.cpp +++ b/src/scripts/custom/gmisland.cpp @@ -140,7 +140,7 @@ struct boss_gmislandAI : public ScriptedAI if (mort->isAlive()) { // "Presque" mort :p - mort->DealDamage(mort, mort->GetHealth() - 50, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + mort->DealDamage(mort, mort->GetHealth() - 50, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); m_creature->MonsterSay("Tiens, toi t'es mort !", LANG_UNIVERSAL, 0); } } diff --git a/src/scripts/custom/npc_escort.cpp b/src/scripts/custom/npc_escort.cpp index 5a3373d19..e3a9c80a1 100644 --- a/src/scripts/custom/npc_escort.cpp +++ b/src/scripts/custom/npc_escort.cpp @@ -15,7 +15,7 @@ struct npc_escort_genericAI : public npc_escortAI sLog.outError("npc_escort : La creature %u n'a pas de donnees dans la table `script_escort_data` ! Le PNJ sera inactif."); } - // ATTENTION : Peut etre NULL + // ATTENTION : Peut etre nullptr CreatureEscortData const* m_pEscortData; void Reset() @@ -42,7 +42,7 @@ struct npc_escort_genericAI : public npc_escortAI //m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); if (HasEscortState(STATE_ESCORT_ESCORTING)) { @@ -106,7 +106,7 @@ struct npc_escort_genericAI : public npc_escortAI if (pQuest->GetQuestId() == m_pEscortData->uiQuestEntry) { Start(false, pPlayer->GetGUID(), pQuest); - m_creature->MonsterTextEmote("quest accepted", NULL); + m_creature->MonsterTextEmote("quest accepted", nullptr); } } @@ -131,7 +131,7 @@ struct npc_escort_genericAI : public npc_escortAI CreatureAI* GetAI_npc_escort_genericAI(Creature* pCreature) { CreatureEscortData const* data = sScriptMgr.GetEscortData(pCreature->GetEntry()); - npc_escort_genericAI* pTempAI = NULL; + npc_escort_genericAI* pTempAI = nullptr; pTempAI = new npc_escort_genericAI(pCreature, data); return (CreatureAI*)pTempAI; } diff --git a/src/scripts/custom/npc_j_eevee.cpp b/src/scripts/custom/npc_j_eevee.cpp index 24c37335b..3fec8b2b9 100644 --- a/src/scripts/custom/npc_j_eevee.cpp +++ b/src/scripts/custom/npc_j_eevee.cpp @@ -270,7 +270,7 @@ CreatureAI* GetAI_npc_j_eevee(Creature* pCreature) else if (pCreature->GetMapId() == 289) // Map 289, Zone 2057. Scholomance return new npc_j_eevee_scholomanceAI(pCreature); - return NULL; + return nullptr; } void AddSC_npc_j_eevee() diff --git a/src/scripts/custom/zero_creatures.cpp b/src/scripts/custom/zero_creatures.cpp index fe546bd0b..a306a32e5 100644 --- a/src/scripts/custom/zero_creatures.cpp +++ b/src/scripts/custom/zero_creatures.cpp @@ -128,7 +128,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI { m_creature->SetInCombatWithZone(); - //m_creature->MonsterYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); + //m_creature->MonsterYell(SAY_AGGRO, LANG_UNIVERSAL, nullptr); DoPlaySoundToSet(m_creature, 8272); } @@ -160,7 +160,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI if (Razor_Remove_Auras < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); m_creature->AI()->AttackStart(target); @@ -214,7 +214,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI // Aura Check. If the gamer is affected by confliguration we attack a random gamer. if (m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION, EFFECT_INDEX_0)) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (target) m_creature->TauntApply(target); @@ -314,8 +314,8 @@ struct Zero_boss_razorgoreAI : public ScriptedAI break; } - Creature* Spawned = NULL; - Unit* target = NULL; + Creature* Spawned = nullptr; + Unit* target = nullptr; ++SpawnedAdds; @@ -333,8 +333,8 @@ struct Zero_boss_razorgoreAI : public ScriptedAI ++SpawnedAdds; //Spawn creature and force it to start attacking a random target - target = NULL; - Spawned = NULL; + target = nullptr; + Spawned = nullptr; Spawned = m_creature->SummonCreature(SpawnType2, SPAWN_X2, SPAWN_Y2, SPAWN_Z2, 5.000, TEMPSUMMON_TIMED_DESPAWN, Despawn_Timer); target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); @@ -348,8 +348,8 @@ struct Zero_boss_razorgoreAI : public ScriptedAI ++SpawnedAdds; //Spawn creature and force it to start attacking a random target - target = NULL; - Spawned = NULL; + target = nullptr; + Spawned = nullptr; Spawned = m_creature->SummonCreature(SpawnType3, SPAWN_X3, SPAWN_Y3, SPAWN_Z3, 5.000, TEMPSUMMON_TIMED_DESPAWN, Despawn_Timer); target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); @@ -363,8 +363,8 @@ struct Zero_boss_razorgoreAI : public ScriptedAI ++SpawnedAdds; //Spawn creature and force it to start attacking a random target - target = NULL; - Spawned = NULL; + target = nullptr; + Spawned = nullptr; Spawned = m_creature->SummonCreature(SpawnType4, SPAWN_X4, SPAWN_Y4, SPAWN_Z4, 5.000, TEMPSUMMON_TIMED_DESPAWN, Despawn_Timer); target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp index 9060e3955..06c374fd9 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp @@ -523,7 +523,7 @@ struct npc_grimstoneAI : public npc_escortAI CreatureAI* GetAI_npc_grimstone(Creature* pCreature) { if (!pCreature->GetInstanceData()) - return NULL; + return nullptr; return new npc_grimstoneAI(pCreature); } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp index ba1e1685f..c20ce40aa 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp @@ -68,7 +68,7 @@ struct boss_anubshiahAI : public ScriptedAI //CurseOfTongues_Timer if (CurseOfTongues_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_CURSEOFTONGUES); CurseOfTongues_Timer = 18000; @@ -94,7 +94,7 @@ struct boss_anubshiahAI : public ScriptedAI //EnvelopingWeb_Timer if (EnvelopingWeb_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_ENVELOPINGWEB); EnvelopingWeb_Timer = 12000; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp index 08a305cce..17be7d948 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp @@ -172,7 +172,7 @@ struct boss_doomrelAI : public ScriptedAI case 6: return m_creature; } - return NULL; + return nullptr; } void CallToFight(bool bStartFight) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp index c9b6f9bde..29c9f5d74 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp @@ -125,7 +125,7 @@ struct go_urok_challengeAI: public GameObjectAI { Unit* massacrer = me->FindNearestCreature(NPC_UROK_MASSACRER, 20.0f); Unit* mage = me->FindNearestCreature(NPC_UROK_MAGE, 20.0f); - Unit* target = NULL; + Unit* target = nullptr; if (!mage) target = massacrer; else if (massacrer) @@ -137,7 +137,7 @@ struct go_urok_challengeAI: public GameObjectAI } else target = mage; - // Sinon, massacre=mage=NULL, aucune cible. + // Sinon, massacre=mage=nullptr, aucune cible. return target; } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp index 8c99a2c30..a6726cd65 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp @@ -136,7 +136,7 @@ struct boss_chromaggusAI : public ScriptedAI { pTarget->RemoveAurasDueToSpell(23175); pTarget->RemoveAurasDueToSpell(23177); - pTarget->DealDamage(pTarget, pTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pTarget->DealDamage(pTarget, pTarget->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } } m_lChromaticPlayerGUID.clear(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp index dad420193..08e80df08 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp @@ -79,7 +79,7 @@ enum #define SPAWN_Z4_BIS 407.206f #define DEBUG_RAZOR(...) //sLog.outString("[MC/Razor] "__VA_ARGS__) -#define DEBUG_EMOTE(s) //m_creature->MonsterTextEmote(s, NULL); +#define DEBUG_EMOTE(s) //m_creature->MonsterTextEmote(s, nullptr); struct boss_razorgoreAI : public ScriptedAI { diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp index f3dc359c2..6cdeba1c4 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp @@ -1234,7 +1234,7 @@ enum struct npc_blackwing_technicianAI : public ScriptedAI { - npc_blackwing_technicianAI(Creature* pCreature) : ScriptedAI(pCreature), m_pTechnicianHelper(NULL) + npc_blackwing_technicianAI(Creature* pCreature) : ScriptedAI(pCreature), m_pTechnicianHelper(nullptr) { m_bAdded = false; m_bVaelGob = (pCreature->GetPositionZ() < 420.0f); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp b/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp index dd9f75b47..b3146bb9c 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp @@ -374,7 +374,7 @@ struct npc_grark_lorkrubAI : public npc_escortAI/*, private DialogueHelper*/ if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ID_PRECARIOUS_PREDICAMENT, m_creature); // Kill self - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, nullptr, false); break; } } @@ -450,7 +450,7 @@ struct npc_grark_lorkrubAI : public npc_escortAI/*, private DialogueHelper*/ return m_creature->GetMap()->GetCreature(m_lexlortGuid); default: - return NULL; + return nullptr; } } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp index bd9d77539..c6b345dad 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp @@ -186,7 +186,7 @@ struct boss_baron_geddonAI : public ScriptedAI m_creature->clearUnitState(UNIT_STAT_ROOT); break; } - m_creature->CastCustomSpell(m_creature, 19698, &Damage, NULL, NULL, true); + m_creature->CastCustomSpell(m_creature, 19698, &Damage, nullptr, nullptr, true); InfCount++; Tick = 0; } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp index df0421a8f..06cfb029e 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp @@ -75,7 +75,7 @@ struct boss_golemaggAI : public ScriptedAI for (std::list::iterator itr = ChiensListe.begin(); itr != ChiensListe.end(); ++itr) { if ((*itr)->getDeathState() == ALIVE) - (*itr)->DealDamage((*itr), (*itr)->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + (*itr)->DealDamage((*itr), (*itr)->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); (*itr)->Respawn(); } } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp index 5061fd430..707bc2206 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp @@ -325,7 +325,7 @@ struct boss_majordomoAI : public ScriptedAI { Creature* DomoAdd[8]; for (int i = 0; i < 8; i++) - DomoAdd[i] = NULL; + DomoAdd[i] = nullptr; for (int i = 0; i < 8; i++) DomoAdd[i] = m_creature->SummonCreature(m_aBosspawnLocs[i].m_uiEntry, m_aBosspawnLocs[i].m_fX, m_aBosspawnLocs[i].m_fY, m_aBosspawnLocs[i].m_fZ, m_aBosspawnLocs[i].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp index 85ee17bdf..cbdea8def 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp @@ -90,7 +90,7 @@ struct boss_sulfuronAI : public ScriptedAI //Inspire_Timer if (Inspire_Timer < diff) { - Creature* target = NULL; + Creature* target = nullptr; std::list pList = DoFindFriendlyMissingBuff(45.0f, SPELL_INSPIRE); if (!pList.empty()) { diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp index 642d0a43a..f5622338d 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp @@ -84,7 +84,7 @@ struct instance_molten_core : ScriptedInstance for (int i = 0; i < 7; i++) { RuneActive[i] = NOT_STARTED; - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } DomoSpawn = NOT_STARTED; @@ -464,7 +464,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176952: //Geddon @@ -472,7 +472,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176953: //Shazzrah @@ -480,7 +480,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176954: //Golemagg @@ -488,7 +488,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176955: //Garr @@ -496,7 +496,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176956: //Magmadar @@ -504,7 +504,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; case 176957: //Gehennas @@ -512,7 +512,7 @@ struct instance_molten_core : ScriptedInstance { Feu->Delete(); Rune->Use(liste.getFirst()->getSource()); - GOUseGuidList[i] = NULL; + GOUseGuidList[i] = 0; } break; } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp index d099e332e..fba65e3cc 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp @@ -309,7 +309,7 @@ struct mob_core_houndAI : public ScriptedAI void Kill_Self() { - m_creature->DealDamage(m_creature, 1, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, 1, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); m_creature->ForcedDespawn(); } diff --git a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp index fb382f005..75b522245 100644 --- a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp +++ b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp @@ -67,7 +67,7 @@ struct boss_thermapluggAI : public ScriptedAI m_uiKnockAwayTimer = urand(17000, 20000); m_uiActivateBombTimer = urand(10000, 15000); m_bIsPhaseTwo = false; - m_asBombFaces = NULL; + m_asBombFaces = nullptr; memset(&m_afSpawnPos, 0.0f, sizeof(m_afSpawnPos)); m_lLandedBombGUIDs.clear(); diff --git a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp index 7a16b8946..41b611c96 100644 --- a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp +++ b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp @@ -366,7 +366,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI m_uiPhaseTimer = 3500; // 6s delay, but 2500ms for escortstarting break; case 3: - Start(false, m_playerGuid, NULL, false, false); + Start(false, m_playerGuid, nullptr, false, false); m_uiPhaseTimer = 0; break; @@ -795,8 +795,8 @@ struct npc_kernobeeAI : public FollowerAI if (Creature* crea = m_creature->GetMap()->GetCreature(bombGuid)) { crea->CastSpell(crea, SPELL_EXPLOSION, true); - crea->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - crea->DealDamage(crea, crea->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + crea->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); + crea->DealDamage(crea, crea->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); nextStep = 4; m_nextStepTimer = 200; } @@ -810,9 +810,9 @@ struct npc_kernobeeAI : public FollowerAI { if (Creature* crea = m_creature->GetMap()->GetCreature(bombGuid)) { - crea->DealDamage(crea, crea->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + crea->DealDamage(crea, crea->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); nextStep = 0; - crea->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + crea->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp index 5519545e5..32e7c61e5 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp @@ -701,7 +701,7 @@ struct npc_eris_havenfireAI : public ScriptedAI Unit* Target = m_creature->GetMap()->GetCreature(GUIDs[urand(0, var - 1)]); if (Target) - Crea->CastCustomSpell(Target, SPELL_TIR_FLECHE, &Damage, NULL, NULL, true); + Crea->CastCustomSpell(Target, SPELL_TIR_FLECHE, &Damage, nullptr, nullptr, true); TimerArcher[i] = urand(3000, 4400); } } @@ -1621,7 +1621,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI { PhaseStep = 5; PhaseTimer = 0; - marduk->DealDamage(redpath, redpath->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + marduk->DealDamage(redpath, redpath->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); if (Creature* redpathCorrupted = m_creature->SummonCreature(NPC_REDPATH_THE_CORRUPTED, redpath->GetPositionX(), redpath->GetPositionY(), redpath->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000)) { DoScriptText(SAY_REDPATH_CORRUPTED, redpathCorrupted); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp index 5d2edf953..28c88fe71 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp @@ -305,13 +305,13 @@ struct boss_gothikAI : public ScriptedAI switch (pSummoned->GetEntry()) { case NPC_UNREL_TRAINEE: - pTempTrigger->CastSpell(pAnchor, SPELL_A_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetGUID()); + pTempTrigger->CastSpell(pAnchor, SPELL_A_TO_ANCHOR_1, true, nullptr, nullptr, pSummoned->GetGUID()); break; case NPC_UNREL_DEATH_KNIGHT: - pTempTrigger->CastSpell(pAnchor, SPELL_B_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetGUID()); + pTempTrigger->CastSpell(pAnchor, SPELL_B_TO_ANCHOR_1, true, nullptr, nullptr, pSummoned->GetGUID()); break; case NPC_UNREL_RIDER: - pTempTrigger->CastSpell(pAnchor, SPELL_C_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetGUID()); + pTempTrigger->CastSpell(pAnchor, SPELL_C_TO_ANCHOR_1, true, nullptr, nullptr, pSummoned->GetGUID()); break; } } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp index d57d2b6a2..390d1cfd1 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp @@ -1163,7 +1163,7 @@ Creature* instance_naxxramas::GetClosestAnchorForGoth(Creature* pSource, bool bR return lList.front(); } - return NULL; + return nullptr; } void instance_naxxramas::GetGothSummonPointCreatures(std::list &lList, bool bRightSide) @@ -1720,7 +1720,7 @@ struct mob_dark_touched_warriorAI : public ScriptedAI if (!m_creature->getVictim() || m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; - Creature* pNearest = NULL; + Creature* pNearest = nullptr; MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, 16067, true, 100.0f); MaNGOS::CreatureLastSearcher searcher(pNearest, u_check); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp index 82546ce11..6b65fafd0 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp @@ -327,7 +327,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI { if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1)) //ATTACKING_TARGET_RANDOM=>ATTACKING_TARGET_TOPAGGRO ,0 => 1 Alita { - if (pTarget != NULL && !pTarget->HasAura(SPELL_SLEEP)) + if (pTarget != nullptr && !pTarget->HasAura(SPELL_SLEEP)) { MCPlayerGuid = pTarget->GetGUID(); MCPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp index 11b40defb..0879657fa 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp @@ -5,11 +5,11 @@ UPDATE `creature_template` SET `script_name`='mobs_rat_pestifere' WHERE (`entry`='10441'); UPDATE `gameobject_template` SET `script_name`='go_entree_de_service' WHERE (`entry`='175368'); INSERT INTO `creature_ai_texts` (`entry` ,`content_default` ,`content_loc1` ,`content_loc2` ,`content_loc3` ,`content_loc4` ,`content_loc5` ,`content_loc6` ,`content_loc7` ,`content_loc8` ,`sound` ,`type` ,`language` ,`emote` ,`comment`) VALUES -('-20000', 'Des intrus ! Encore des marionnettes de l''Aube d''argent, sans doute. J''en ai d�j� une parmi mes prisonniers. H�tez-vous de quitter nom domaine, sans quoi elle sera ex�cut�e !', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', '0', '0', '0', NULL), -('-20001', 'Je vais prendre beaucoup de plaisir � tuer cette pauvre femme ! Il n''est pas trop tard, Il n''est pas n�cessaire qu''elle souffre pour rien. Allez-vous-en et sa mort sera mis�ricordieuse !', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', '0', '0', '0', NULL), -('-20002', 'Ne vous inqui�tez pas de moi ! Tuez cette b�te odieuse ! Lib�rez le monde de sa vile corruption !', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', '0', '0', '0', NULL), -('-20003', 'Un Cristal d''Ash''ari vient d''�tre renvers� ! Restaurez la ziggourat avant que la n�cropole ne soit vuln�rable.', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', '0', '0', '0', NULL), -('-20004', 'Les cristaux d''Ash''ari ont �t� d�truits ! L''abattoir est vuln�rable !', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '0', '0', '0', '0', NULL); +('-20000', 'Des intrus ! Encore des marionnettes de l''Aube d''argent, sans doute. J''en ai d�j� une parmi mes prisonniers. H�tez-vous de quitter nom domaine, sans quoi elle sera ex�cut�e !', nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , '0', '0', '0', '0', nullptr), +('-20001', 'Je vais prendre beaucoup de plaisir � tuer cette pauvre femme ! Il n''est pas trop tard, Il n''est pas n�cessaire qu''elle souffre pour rien. Allez-vous-en et sa mort sera mis�ricordieuse !', nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , '0', '0', '0', '0', nullptr), +('-20002', 'Ne vous inqui�tez pas de moi ! Tuez cette b�te odieuse ! Lib�rez le monde de sa vile corruption !', nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , '0', '0', '0', '0', nullptr), +('-20003', 'Un Cristal d''Ash''ari vient d''�tre renvers� ! Restaurez la ziggourat avant que la n�cropole ne soit vuln�rable.', nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , '0', '0', '0', '0', nullptr), +('-20004', 'Les cristaux d''Ash''ari ont �t� d�truits ! L''abattoir est vuln�rable !', nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , '0', '0', '0', '0', nullptr); DELETE FROM gameobject WHERE guid = '82644'; INSERT INTO gameobject VALUES ( 82644, 181072, 329, 4044.34, -3334.23, 115.06, 2.61058, 0, 0, 0.877461, -0.479649, 180, 100, 1); DELETE FROM gameobject WHERE guid = '82643'; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp index 89c00a0b0..217f8f187 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp @@ -195,7 +195,7 @@ struct mob_restless_soulAI : public ScriptedAI { if (Player* temp = m_creature->GetMap()->GetPlayer(Tagger)) temp->KilledMonsterCredit(m_creature->GetEntry(), m_creature->GetGUID()); - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } else Die_Timer -= diff; } @@ -265,7 +265,7 @@ struct mobs_spectral_ghostly_citizenAI : public ScriptedAI if (Tagged) { if (Die_Timer < diff) - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); else Die_Timer -= diff; } @@ -380,7 +380,7 @@ struct mobs_cristal_zugguratAI : public ScriptedAI if (pCreature && pCreature->isAlive()) return; - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } }; diff --git a/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp b/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp index d3d555da0..5387715e3 100644 --- a/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp +++ b/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp @@ -71,7 +71,7 @@ struct go_dusty_rugAI: public GameObjectAI { if (timer < uiDiff) { - Creature* curr = NULL; + Creature* curr = nullptr; switch (step) { case 1: @@ -108,13 +108,13 @@ struct go_dusty_rugAI: public GameObjectAI } if (curr = me->GetMap()->GetCreature(Farmers.front())) curr->SetStandState(UNIT_STAND_STATE_STAND); - curr = NULL; + curr = nullptr; while (!Farmers.empty()) { if (curr = me->GetMap()->GetCreature(Farmers.front())) - curr->DealDamage(curr, curr->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + curr->DealDamage(curr, curr->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); Farmers.pop_front(); - curr = NULL; + curr = nullptr; } timer = 20000; diff --git a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp index 5bad3bc19..13495d906 100644 --- a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp +++ b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp @@ -350,7 +350,7 @@ bool QuestAccept_npc_dying_archaeologist(Player* pPlayer, Creature* pCreature, c pObsidionAI->m_playerList.push_back(pPlayer->GetObjectGuid()); if (Group* pGroup = pPlayer->GetGroup()) - for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != nullptr; pRef = pRef->next()) if (Player* pMember = pRef->getSource()) pObsidionAI->m_playerList.push_back(pMember->GetObjectGuid()); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp index dc4819e37..09fe397a1 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp @@ -289,7 +289,7 @@ bool QuestComplete_npc_molthor(Player *pPlayer, Creature *pCreature, const Quest if (pQuest->GetQuestId() == QUEST_THE_HEART_OF_HAKKAR && molthorAI) { - molthorAI->Start(false, pPlayer->GetObjectGuid(), NULL, true); + molthorAI->Start(false, pPlayer->GetObjectGuid(), nullptr, true); pCreature->MonsterSay(SAY_MOLTHOR_1); } diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp index 4e69c08f7..5ff005163 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp @@ -392,7 +392,7 @@ struct mob_prowlerAI : public ScriptedAI if (Creature* pArlokk = m_creature->GetMap()->GetCreature(m_uiArlokkGuid)) if (pArlokk->isAlive()) return CAST_AI(boss_arlokkAI, pArlokk->AI()); - return NULL; + return nullptr; } void Reset() { @@ -411,7 +411,7 @@ struct mob_prowlerAI : public ScriptedAI { if (m_uiUpdateTarget_Timer <= uiDiff) { - Unit *pMarkedTarget = NULL; + Unit *pMarkedTarget = nullptr; if (boss_arlokkAI* pArlokkAI = GetArlokkAI()) pMarkedTarget = m_creature->GetMap()->GetUnit(pArlokkAI->m_uiMarkedGUID); else diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp index 29e977435..5715631ea 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp @@ -54,7 +54,7 @@ struct boss_grilekAI : public ScriptedAI { DoCastSpellIfCan(m_creature, SPELL_AVARTAR); - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp index c30f37ebb..e0cfef854 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp @@ -518,9 +518,9 @@ struct npc_guru_bat_riderAI : public ScriptedAI { GoingToExplose = true; if (urand(0, 1)) - m_creature->MonsterTextEmote("Gurubashi Bat Rider becomes fully engulfed in flames.", NULL, false); + m_creature->MonsterTextEmote("Gurubashi Bat Rider becomes fully engulfed in flames.", nullptr, false); else - m_creature->MonsterTextEmote("Gurubashi Bat Rider gets a crazed look in his eye.", NULL, false); + m_creature->MonsterTextEmote("Gurubashi Bat Rider gets a crazed look in his eye.", nullptr, false); m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true); // fear immunity m_creature->CastSpell(m_creature, SPELL_EXPLOSION, false); } diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp index 09a4fe719..7aa0c244a 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp @@ -380,7 +380,7 @@ struct mob_brain_wash_totemAI : public ScriptedAI // Il faut au moins 2 personnes dans le threatlist de Jin'do, sinon il va reset ! if (pJindo->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1)) { - Unit* pTarget = pJindo ? pJindo->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0) : NULL; + Unit* pTarget = pJindo ? pJindo->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0) : nullptr; if (pTarget && pTarget->isAlive() && pTarget->IsPlayer() && !pTarget->HasAura(SPELL_HEX) && !pTarget->HasAura(SPELL_BRAINWASH)) { if (boss_jindoAI* pJindoAI = dynamic_cast(pJindo->AI())) diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp index dfecf8a24..ed7f62327 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp @@ -420,7 +420,7 @@ struct boss_mandokirAI : public ScriptedAI if (killedPlayer->getDeathState() == CORPSE && !killedPlayer->IsRessurectRequested()) { // Find nearest spirit ready to resurrect - Creature* spirit = NULL; + Creature* spirit = nullptr; float spiritDist = 0.0f; for (std::vector::iterator it = m_lSpirits.begin(); it != m_lSpirits.end(); ++it) { @@ -441,7 +441,7 @@ struct boss_mandokirAI : public ScriptedAI if (spirit) { spirit->MonsterWhisper("I am released through you! Avenge me!", killedPlayer); - spirit->AI()->SpellHitTarget(killedPlayer, NULL); + spirit->AI()->SpellHitTarget(killedPlayer, nullptr); } } } diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp index e7b6a24eb..c2fad2b34 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp @@ -156,7 +156,7 @@ struct boss_marliAI : public ScriptedAI return (*iter); } } - return NULL; + return nullptr; } void JustSummoned(Creature* pSummoned) @@ -266,7 +266,7 @@ struct boss_marliAI : public ScriptedAI m_bHasWebbed = false; /* DoResetThreat(); - Unit* pTarget = NULL; + Unit* pTarget = nullptr; uint8 i = 0 ; while (i < 5) // max 3 tries to get a random target with power_mana { diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp index f89c7e7eb..93340d85e 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp @@ -121,7 +121,7 @@ struct boss_renatakiAI : public ScriptedAI //Resetting some aggro so he attacks other gamers if (Aggro_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp index ee00aaa8e..6ea1d856e 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp @@ -68,7 +68,7 @@ INSERT INTO creature_template SET entry=15109, modelid_1=15214, modelid_2=15214, class ChargeUnitSelector : public ThreatListProcesser { public: - ChargeUnitSelector(Unit* thekal) : _victim(NULL), _charger(thekal) + ChargeUnitSelector(Unit* thekal) : _victim(nullptr), _charger(thekal) { ASSERT(_charger); } @@ -131,7 +131,7 @@ struct zg_rez_add : public ScriptedAI void JustDied(Unit* Killer) { DoScriptText(EMOTE_DIES, m_creature); - Unit* pRezzer = NULL; + Unit* pRezzer = nullptr; // Mort et non selectionnable (= pas de loots) m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (m_pInstance) @@ -353,7 +353,7 @@ struct boss_thekalAI : public zg_rez_add { // Apres les 10 sec sans rez : // Rez - DoRessurectUnit(m_creature, NULL); + DoRessurectUnit(m_creature, nullptr); m_creature->SetEntry(14509); // Phase 2 DoSetInPhaseTwo(); @@ -434,7 +434,7 @@ struct boss_thekalAI : public zg_rez_add // On tente tout de même de trouver une cible. Map::PlayerList const& players = m_creature->GetMap()->GetPlayers(); float nearestDist = 200.0f; - Player* target = NULL; + Player* target = nullptr; for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (m_creature->canAttack(itr->getSource())) if (itr->getSource()->GetDistance(m_creature) < nearestDist) diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp index 7b99300f2..cb2b957fc 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp @@ -59,7 +59,7 @@ struct boss_wushoolayAI : public ScriptedAI //LightningWave_Timer if (LightningWave_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_LIGHTNINGWAVE); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp index 0b7ba1fe6..1eb884c6e 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp @@ -352,7 +352,7 @@ Unit* instance_zulgurub::Thekal_GetUnitThatCanRez() if (Unit *pThekal = instance->GetUnit(GetData64(DATA_THEKAL))) if (pThekal->isAlive()) return pThekal; - return NULL; + return nullptr; } InstanceData* GetInstanceData_instance_zulgurub(Map* pMap) diff --git a/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp b/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp index daabfdb87..8684c1f8b 100644 --- a/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp +++ b/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp @@ -74,7 +74,7 @@ struct npc_galen_goodwardAI : public npc_escortAI { case 0: { - GameObject* pCage = NULL; + GameObject* pCage = nullptr; if (m_uiGalensCageGUID) pCage = m_creature->GetMap()->GetGameObject(m_uiGalensCageGUID); else diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp index e8b09268a..3fb20b5bf 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp @@ -368,7 +368,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI if (Creature* pMograine = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_MOGRAINE))) { if (pMograine->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pKiller->DealDamage(pMograine, 1, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pKiller->DealDamage(pMograine, 1, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } } } @@ -433,7 +433,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI //If we are <75% hp cast healing spells at self or Mograine if (m_uiHeal_Timer < uiDiff) { - Creature* pTarget = NULL; + Creature* pTarget = nullptr; if (m_creature->GetHealthPercent() <= 75.0f) pTarget = m_creature; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp index 8b5aaa747..f1f26f005 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp @@ -71,7 +71,7 @@ struct boss_illuciabarovAI : public ScriptedAI //ShadowShock_Timer if (ShadowShock_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_SHADOWSHOCK); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp index 9abd77aca..0425398f7 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp @@ -78,7 +78,7 @@ struct boss_instructormaliciaAI : public ScriptedAI //Corruption_Timer if (Corruption_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_CORRUPTION); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp index b032d7d35..0a0525ffa 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp @@ -162,7 +162,7 @@ struct boss_jandicebarovAI : public ScriptedAI Illusion_Timer = 25000; //Summon 10 Illusions attacking random gamers - Unit* target = NULL; + Unit* target = nullptr; for (int i = 0; i < 10; ++i) { target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp index 02b72a7fb..9958fe9a2 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp @@ -59,7 +59,7 @@ struct boss_lordalexeibarovAI : public ScriptedAI //Immolate_Timer if (Immolate_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_IMMOLATE); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp index 7286c75e7..b0fe262ee 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp @@ -72,7 +72,7 @@ struct boss_rasfrostAI : public ScriptedAI //Frostbolt_Timer if (Frostbolt_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_FROSTBOLT); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp index cb5986fae..7e8abac3b 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp @@ -51,7 +51,7 @@ struct boss_vectusAI : public ScriptedAI eventGambitStart = false; findGambit = false; m_uiGambitEvent_Timer = 0; - pGambit = NULL; + pGambit = nullptr; Reset(); } @@ -132,7 +132,7 @@ struct boss_vectusAI : public ScriptedAI if (CreatureGroup* myGroup = (*it)->GetCreatureGroup()) { myGroup->RemoveMember((*it)->GetGUID()); - (*it)->SetCreatureGroup(NULL); + (*it)->SetCreatureGroup(nullptr); } (*it)->setFaction(14); @@ -271,8 +271,8 @@ struct npc_scholomance_studentAI : public ScriptedAI { myGroup->RemoveMember(Vectus->GetGUID()); myGroup->RemoveMember(Marduke->GetGUID()); - Vectus->SetCreatureGroup(NULL); - Marduke->SetCreatureGroup(NULL); + Vectus->SetCreatureGroup(nullptr); + Marduke->SetCreatureGroup(nullptr); } } } @@ -304,7 +304,7 @@ struct npc_scholomance_studentAI : public ScriptedAI if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); Reset(); } diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp index 67e282ebb..27578fc01 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp @@ -126,7 +126,7 @@ struct npc_the_scourge_cauldronAI : public ScriptedAI void DoDie() { //summoner dies here - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); //override any database `spawntimesecs` to prevent duplicated summons uint32 rTime = m_creature->GetRespawnDelay(); if (rTime < 600) diff --git a/src/scripts/kalimdor/ashenvale/ashenvale.cpp b/src/scripts/kalimdor/ashenvale/ashenvale.cpp index 7f33ba878..35402fb39 100644 --- a/src/scripts/kalimdor/ashenvale/ashenvale.cpp +++ b/src/scripts/kalimdor/ashenvale/ashenvale.cpp @@ -735,7 +735,7 @@ struct go_foulweald_totem_moundAI: public GameObjectAI if (eventPhase != 0) return false; eventPhase = 1; - Creature* foulweald = NULL; + Creature* foulweald = nullptr; for (int i = 0; i < 2; i++) { if (foulweald = me->SummonCreature(NPC_ENRAGED_FOULWEALD, foulwealdSpawnCoords[i][0], foulwealdSpawnCoords[i][1], foulwealdSpawnCoords[i][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 420000)) @@ -748,7 +748,7 @@ struct go_foulweald_totem_moundAI: public GameObjectAI foulweald->SetRespawnDelay(425000); DefineFoulwealdMound(foulweald, me->GetGUID()); } - foulweald = NULL; + foulweald = nullptr; } return true; } diff --git a/src/scripts/kalimdor/azshara/azshara.cpp b/src/scripts/kalimdor/azshara/azshara.cpp index afe0907bf..dd31d6a60 100644 --- a/src/scripts/kalimdor/azshara/azshara.cpp +++ b/src/scripts/kalimdor/azshara/azshara.cpp @@ -306,7 +306,7 @@ struct mob_mawsAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); LeaveCombatTimer = 30000; SaccagerTimer = urand(20, 120) * 1000; SaccagerTimerMax = 120000; diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp index d3648af29..cbcd61d83 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp @@ -83,7 +83,7 @@ struct celebras_the_cursedAI : public ScriptedAI //Wrath if (Wrath_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) DoCastSpellIfCan(target, SPELL_WRATH); diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp index 6a92c758a..5528dd21b 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp @@ -87,7 +87,7 @@ struct boss_ptheradrasAI : public ScriptedAI //Boulder_Timer if (Boulder_Timer < diff) { - Unit* target = NULL; + Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) if (DoCastSpellIfCan(target, SPELL_BOULDER) == CAST_OK) diff --git a/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp b/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp index ab00909df..ee217aa87 100644 --- a/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp +++ b/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp @@ -354,7 +354,7 @@ struct boss_onyxiaAI : public ScriptedAI return &aMoveData[i]; } - return NULL; + return nullptr; } void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) diff --git a/src/scripts/kalimdor/felwood/felwood.cpp b/src/scripts/kalimdor/felwood/felwood.cpp index f91d033f4..41d704589 100644 --- a/src/scripts/kalimdor/felwood/felwood.cpp +++ b/src/scripts/kalimdor/felwood/felwood.cpp @@ -763,7 +763,7 @@ struct npc_areiAI : public npc_escortAI if (uiEntry == NPC_AREI) return m_creature; - return NULL; + return nullptr; } void UpdateAI(const uint32 uiDiff) override diff --git a/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp b/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp index a4db74f86..de0181b3b 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp @@ -261,7 +261,7 @@ void boss_chorushAI::UpdateAIMage(const uint32 uiDiff) // Bloodlust if (m_uiSpellTimers[3] < uiDiff) { - Unit* pTarget = NULL; + Unit* pTarget = nullptr; if (!m_creature->HasAura(SPELL_BLOODLUST)) pTarget = m_creature; @@ -365,7 +365,7 @@ void boss_chorushAI::UpdateAIShaman(const uint32 uiDiff) // Healing Wave if (m_uiSpellTimers[3] < uiDiff) { - Unit* pTarget = NULL; + Unit* pTarget = nullptr; if (pTarget = m_creature->FindLowestHpFriendlyUnit(40.0f, 15000)); else if (m_creature->GetHealthPercent() < 50.0f) pTarget = m_creature; @@ -425,7 +425,7 @@ void boss_chorushAI::UpdateAIPrist(const uint32 uiDiff) // Heal if (m_uiSpellTimers[3] < uiDiff) { - Unit* pTarget = NULL; + Unit* pTarget = nullptr; if (pTarget = m_creature->FindLowestHpFriendlyUnit(40.0f, 15000)); else if (m_creature->GetHealthPercent() < 50.0f) pTarget = m_creature; diff --git a/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp b/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp index e776dc910..1c4b39c98 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp @@ -610,7 +610,7 @@ struct go_pedestal_of_immol_tharAI: public GameObjectAI } } } - GameObject* gobj = NULL; + GameObject* gobj = nullptr; switch (nodeNb) { case 0: diff --git a/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp b/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp index cbac7b8a5..83cbce6ef 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp @@ -1168,7 +1168,7 @@ struct GordokBruteAI : public ScriptedAI char eMessage[100]; sprintf(eMessage, "Gordok Brute puts his club away and begins swinging wildly!"); m_creature->LoadEquipment(0, true); - m_creature->MonsterTextEmote(eMessage, NULL, false); + m_creature->MonsterTextEmote(eMessage, nullptr, false); m_creature->CastSpell(m_creature, SPELL_ENRAGE, false); m_bEnrage = true; @@ -1264,7 +1264,7 @@ struct boss_guardsAI : public ScriptedAI if (pInstance->GetData(TYPE_GORDOK_TRIBUTE) == DONE) { m_creature->MonsterSay("Why... Boss.. betray.. us...?", 0, 0); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); } } @@ -1444,7 +1444,7 @@ struct go_fixed_trap : public GameObjectAI pSlipkik->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); pSlipkik->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pSlipkik->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); - pSlipkik->CastSpell(pSlipkik, SPELL_ICE_LOCK, true, NULL); + pSlipkik->CastSpell(pSlipkik, SPELL_ICE_LOCK, true, nullptr); me->SendGameObjectCustomAnim(); me->Delete(); } @@ -1546,7 +1546,7 @@ struct boss_kromcrushAI : public ScriptedAI if (pInstance->GetData(TYPE_GORDOK_TRIBUTE) == DONE) { m_creature->MonsterSay("Why... Boss.. betray.. us...?", 0, 0); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); } } diff --git a/src/scripts/kalimdor/moonglade/moonglade.cpp b/src/scripts/kalimdor/moonglade/moonglade.cpp index a54266a18..610b63db4 100644 --- a/src/scripts/kalimdor/moonglade/moonglade.cpp +++ b/src/scripts/kalimdor/moonglade/moonglade.cpp @@ -621,7 +621,7 @@ struct npc_keeper_remulosAI : public npc_escortAI float z = 0.0f; float o = 0.0f; m_creature->GetHomePosition(x, y, z, o); - //m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + //m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(),nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); m_creature->NearTeleportTo(x, y, z, o); m_creature->ForcedDespawn(); m_uiOutroTimer = 0; @@ -1194,7 +1194,7 @@ struct boss_eranikusAI : public ScriptedAI m_creature->CombatStop(true); m_creature->LoadCreatureAddon(true); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); // Get Remulos guid and make him stop summoning shades if (Creature* pRemulos = GetClosestCreatureWithEntry(m_creature, NPC_REMULOS, 50.0f)) diff --git a/src/scripts/kalimdor/mulgore/mulgore.cpp b/src/scripts/kalimdor/mulgore/mulgore.cpp index e8445aaf5..29cf1a37e 100644 --- a/src/scripts/kalimdor/mulgore/mulgore.cpp +++ b/src/scripts/kalimdor/mulgore/mulgore.cpp @@ -75,7 +75,7 @@ struct plainVisionAI : public npc_escortAI if (!isEngaged) { isEngaged = true; - Start(false, NULL, NULL, false); + Start(false, 0, nullptr, false); } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp index 6401fa0be..ca300834d 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp @@ -340,7 +340,7 @@ struct mob_zara_larvaAI : public ScriptedAI void Reset() { - m_victim = NULL; + m_victim = nullptr; m_waypoint = 0; Active = 2000; SetCombatMovement(false); diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp index 43cf84db0..53b38ab0b 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp @@ -104,7 +104,7 @@ struct boss_buruAI : public ScriptedAI for (int i = 0; i < 6; i++) { egg = m_pInstance->GetCreature(m_eggsGUID[i]); - if (egg != NULL) + if (egg != nullptr) egg->AddObjectToRemoveList(); if (Creature* egg = m_creature->SummonCreature(NPC_BURU_EGG, Eggs[i].x, Eggs[i].y, Eggs[i].z, 0)) m_eggsGUID[i] = egg->GetGUID(); @@ -141,7 +141,7 @@ struct boss_buruAI : public ScriptedAI for (int i = 0; i < 6 && !m_bIsEnraged; i++) { egg = m_pInstance->GetCreature(m_eggsGUID[i]); - if (egg == NULL) + if (egg == nullptr) { if (Creature* egg = m_creature->SummonCreature(NPC_BURU_EGG, Eggs[i].x, Eggs[i].y, Eggs[i].z, 0)) m_eggsGUID[i] = egg->GetGUID(); diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp index 2eba289db..ed5e8424c 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp @@ -153,7 +153,7 @@ struct boss_moamAI : public ScriptedAI { //Check if a victim was memorize, in case of error, take a random one. Unit * victim = m_creature->GetMap()->GetUnit(m_OGvictim); - if (victim != NULL) + if (victim != nullptr) m_creature->AI()->AttackStart(victim); else m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp index 8960db429..aba71340b 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp @@ -298,7 +298,7 @@ struct boss_rajaxxAI : public ScriptedAI if (Player* pLootRecepient = m_creature->GetLootRecipient()) { if (Group* pGroup = pLootRecepient->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy || !pGroupGuy->IsInWorld()) diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp index e3a9c5796..c292daa19 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp @@ -129,7 +129,7 @@ uint64 instance_ruins_of_ahnqiraj::GetData64(uint32 uiData) return m_uiGUIDvalue; default: - return NULL; + return 0; } } diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp index 575e91740..50647ac60 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp @@ -879,7 +879,7 @@ struct QirajiWarriorAI : public ScriptedAI if (Creature* pTuubid = m_creature->GetMap()->GetCreature(m_uiTuubidGuid)) if (pTuubid->isAlive()) return CAST_AI(TuubidAI, pTuubid->AI()); - return NULL; + return nullptr; } void Reset() @@ -987,7 +987,7 @@ struct SwarmguardNeedlerAI : public ScriptedAI if (Creature* pTuubid = m_creature->GetMap()->GetCreature(m_uiTuubidGuid)) if (pTuubid->isAlive()) return CAST_AI(TuubidAI, pTuubid->AI()); - return NULL; + return nullptr; } void Reset() diff --git a/src/scripts/kalimdor/silithus/silithus.cpp b/src/scripts/kalimdor/silithus/silithus.cpp index 9c54e7c98..a95bfb06c 100644 --- a/src/scripts/kalimdor/silithus/silithus.cpp +++ b/src/scripts/kalimdor/silithus/silithus.cpp @@ -244,7 +244,7 @@ struct go_pierre_ventsAI: public GameObjectAI if (user->isAlive()) { user->CastSpell(user, SPELL_RED_LIGHTNING, true); - user->DealDamage(user, user->GetHealth() > 1000 ? 1000 : user->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + user->DealDamage(user, user->GetHealth() > 1000 ? 1000 : user->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } } bool CanUse(Player* user) @@ -885,7 +885,7 @@ struct npc_colossusAI : public ScriptedAI { if (DoCastSpellIfCan(m_creature, SPELL_COLOSSAL_SMASH) == CAST_OK) // Maxi KB { - m_creature->MonsterTextEmote("Colossus begins to cast Colossus Smash", NULL); + m_creature->MonsterTextEmote("Colossus begins to cast Colossus Smash", nullptr); m_uiColossalSmashTimer = firstSmash ? 10000 : 60000; m_uiColossalSmashEmoteTimer = 5000; @@ -900,7 +900,7 @@ struct npc_colossusAI : public ScriptedAI if (m_uiColossalSmashEmoteTimer && m_uiColossalSmashEmoteTimer < uiDiff) { - m_creature->MonsterTextEmote("Colossus lets loose a massive attack", NULL); + m_creature->MonsterTextEmote("Colossus lets loose a massive attack", nullptr); m_uiColossalSmashEmoteTimer = 0; } else @@ -1065,7 +1065,7 @@ struct npc_Geologist_LarksbaneAI : public ScriptedAI } case 9: { - m_creature->MonsterTextEmote(10837, NULL, false); + m_creature->MonsterTextEmote(10837, nullptr, false); uiNextActionTimer = 3000; break; } @@ -1177,7 +1177,7 @@ struct npc_Geologist_LarksbaneAI : public ScriptedAI case 25: { if (Creature* Crea = m_creature->FindNearestCreature(15180, 50.0f)) // Baristolth of the Shifting Sands - Crea->MonsterTextEmote(10853, NULL, false); + Crea->MonsterTextEmote(10853, nullptr, false); uiNextActionTimer = 4000; break; } @@ -2729,7 +2729,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI m_uiChargeTimer = urand(15000, 20000); m_uiCleaveTimer = urand(4000, 8000); m_uiFearTimer = urand(5000, 10000); - // m_creature->MonsterTextEmote("Reset", NULL); // pour debug + // m_creature->MonsterTextEmote("Reset", nullptr); // pour debug } Unit* GetVictimInRangePlayerOnly(float min, float max) @@ -2746,7 +2746,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI } } } - return NULL; + return nullptr; } void UpdateAI(const uint32 uiDiff) override diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp index a7a55fadd..4b76c77e8 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp @@ -92,7 +92,7 @@ struct boss_bug_trioAI : public ScriptedAI m_pInstance->SetData(TYPE_BUG_TRIO, SPECIAL); if (m_pInstance->GetData(TYPE_BUG_TRIO) != DONE) { - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(nullptr); m_creature->ForcedDespawn(4000); if (Creature* pKri = m_pInstance->GetSingleCreatureFromStorage(NPC_KRI)) diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp index 5d76f4a19..e2a2782cc 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp @@ -243,7 +243,7 @@ static Player* SelectRandomAliveNotStomach(instance_temple_of_ahnqiraj* instance } if (temp.empty()) - return NULL; + return nullptr; j = temp.begin(); @@ -1718,7 +1718,7 @@ struct cthunAI : public ScriptedAI if (nextStomachEnterGrabTimer < diff) { if (Player* target = SelectRandomAliveNotStomach(m_pInstance)) { target->InterruptNonMeleeSpells(false); - target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, m_creature->GetObjectGuid()); + target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, nullptr, nullptr, m_creature->GetObjectGuid()); stomachEnterPortTimer = STOMACH_GRAB_DURATION; StomachEnterTargetGUID = target->GetObjectGuid(); } diff --git a/src/scripts/kalimdor/tanaris/tanaris.cpp b/src/scripts/kalimdor/tanaris/tanaris.cpp index 2049c9ced..9a5e97700 100644 --- a/src/scripts/kalimdor/tanaris/tanaris.cpp +++ b/src/scripts/kalimdor/tanaris/tanaris.cpp @@ -73,7 +73,7 @@ struct mob_aquementasAI : public ScriptedAI !((Player*)receiver)->HasItemCount(11522, 1, true)) { ItemPosCountVec dest; - uint8 msg = ((Player*)receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL); + uint8 msg = ((Player*)receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, nullptr); if (msg == EQUIP_ERR_OK) ((Player*)receiver)->StoreNewItem(dest, 11522, 1, true); } @@ -312,7 +312,7 @@ CreatureAI* GetAI_npc_stone_watcher_of_norgannon(Creature* creature) creature->GetCreatureListWithEntryInGrid(creatures, creature->GetEntry(), 20.0f); if (creatures.size()) creature->DeleteLater(); - return NULL; + return nullptr; } /*#### @@ -549,12 +549,12 @@ bool GOHello_go_inconspicuous_landmark(Player* pPlayer, GameObject* pGo) { if (pPlayer->GetQuestStatus(2882) == QUEST_STATUS_INCOMPLETE) { - Creature* pirate1 = NULL; - Creature* pirate2 = NULL; - Creature* pirate3 = NULL; - Creature* pirate4 = NULL; - Creature* pirate5 = NULL; - GameObject* pTreasure = NULL; + Creature* pirate1 = nullptr; + Creature* pirate2 = nullptr; + Creature* pirate3 = nullptr; + Creature* pirate4 = nullptr; + Creature* pirate5 = nullptr; + GameObject* pTreasure = nullptr; int extraPirateType[2]; extraPirateType[0] = NPC_PIRATES_1; extraPirateType[1] = NPC_PIRATES_2; @@ -606,7 +606,7 @@ bool GOHello_go_inconspicuous_landmark(Player* pPlayer, GameObject* pGo) { if(pTreasure = pGo->SummonGameObject(GO_PIRATES_TREASURE, -10115.037109, -4050.484863, 5.521664, 0, 0, 0, 0, 0, 13)); } - if(pTreasure != NULL) + if(pTreasure != nullptr) { //pTreasure->SetGoState(GO_STATE_READY); //pTreasure->SetLootState(GO_READY); @@ -706,7 +706,7 @@ bool QuestRewarded_npc_yehkinya(Player* pPlayer, Creature* pCreature, Quest cons if (npc_yehkinyaAI* pEscortAI = dynamic_cast(pCreature->AI())) { - pEscortAI->Start(true, NULL, NULL, true); + pEscortAI->Start(true, 0, nullptr, true); pCreature->SetWalk(false); } } diff --git a/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp b/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp index b4d224e43..b7a61f9dc 100644 --- a/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp +++ b/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp @@ -221,7 +221,7 @@ struct npc_belnistraszAI : public npc_escortAI void SpawnerSummon(Creature* pSummoner) { - Creature * crea = NULL; + Creature * crea = nullptr; if (m_uiRitualPhase > 7) { if(crea = pSummoner->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, pSummoner->GetPositionX(), pSummoner->GetPositionY(), pSummoner->GetPositionZ(), pSummoner->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) diff --git a/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp b/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp index 21c838453..f27a3aecf 100644 --- a/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp +++ b/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp @@ -234,7 +234,7 @@ struct npc_snufflenose_gopherAI : public FollowerAI return; lTubersInRange.sort(ObjectDistanceOrder(m_creature)); - GameObject* pNearestTuber = NULL; + GameObject* pNearestTuber = nullptr; // Always need to find new ones for (std::list::const_iterator itr = lTubersInRange.begin(); itr != lTubersInRange.end(); ++itr) diff --git a/src/scripts/kalimdor/the_barrens/the_barrens.cpp b/src/scripts/kalimdor/the_barrens/the_barrens.cpp index 2d917e9cf..f2442b7e9 100644 --- a/src/scripts/kalimdor/the_barrens/the_barrens.cpp +++ b/src/scripts/kalimdor/the_barrens/the_barrens.cpp @@ -932,19 +932,19 @@ struct npc_regthar_deathgateAI : public ScriptedAI Creature* pDefender; for (int i = 0; i < 9; i++) { - pDefender = NULL; + pDefender = nullptr; if (pDefender = m_creature->GetMap()->GetCreature(GuidPhaseOneGuards[i])) static_cast(pDefender)->UnSummon(); } for (int i = 0; i < 8; i++) { - pDefender = NULL; + pDefender = nullptr; if (pDefender = m_creature->GetMap()->GetCreature(GuidPhaseTwoGuards[i])) static_cast(pDefender)->UnSummon(); } while (!AllKolkars.empty()) { - pDefender = NULL; + pDefender = nullptr; if (pDefender = m_creature->GetMap()->GetCreature(AllKolkars.front())) static_cast(pDefender)->UnSummon(); AllKolkars.pop_front(); diff --git a/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp b/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp index b68bb05ad..740db349f 100644 --- a/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp +++ b/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp @@ -621,7 +621,7 @@ bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, { if (npc_disciple_of_naralexAI* pEscortAI = dynamic_cast(pCreature->AI())) { - pEscortAI->Start(false, /*pPlayer->GetGUID()*/NULL);//we don't want the out of range check. + pEscortAI->Start(false, /*pPlayer->GetGUID()*/ 0);//we don't want the out of range check. pEscortAI->m_playerGuid = pPlayer->GetObjectGuid(); pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); } diff --git a/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp b/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp index 067b6a44b..434001dda 100644 --- a/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp +++ b/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp @@ -171,7 +171,7 @@ struct npc_ringoAI : public FollowerAI m_uiFaintTimer = urand(30000, 60000); m_uiEndEventProgress = 0; m_uiEndEventTimer = 1000; - pSpraggle = NULL; + pSpraggle = nullptr; } void MoveInLineOfSight(Unit *pWho) @@ -384,7 +384,7 @@ struct ungoro_eggs_triggerAI : public ScriptedAI if (currPlayer->isAlive()) return currPlayer; } - return NULL; + return nullptr; } void UpdateAI(const uint32 diff) { @@ -864,7 +864,7 @@ struct npc_simone_the_inconspicuousAI : public ScriptedAI { if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) { - Creature* pPreciousDevourer = NULL; + Creature* pPreciousDevourer = nullptr; Creature* pDemon = m_creature->SummonCreature(NPC_SIMONE_THE_SEDUCTRESS, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSUMMON_DEAD_DESPAWN, 0); Creature* pPrecious = GetClosestCreatureWithEntry(m_creature, NPC_PRECIOUS, 100.0f); diff --git a/src/scripts/world/event_scourge_invasion.cpp b/src/scripts/world/event_scourge_invasion.cpp index 863dbb398..a1d661305 100644 --- a/src/scripts/world/event_scourge_invasion.cpp +++ b/src/scripts/world/event_scourge_invasion.cpp @@ -226,7 +226,7 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI Creature* SelectWaypoint() { - Creature* creatureFound = NULL; + Creature* creatureFound = nullptr; CellPair pair(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(pair); diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index cd6cc7ba1..01fd4a06e 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -3233,7 +3233,7 @@ struct npc_event_fireworksAI : public ScriptedAI uint32 GetTimeUntilNextShow() { - time_t theTime = time(NULL); + time_t theTime = time(nullptr); struct tm *aTime = localtime(&theTime); int min = aTime->tm_min; int hour = aTime->tm_hour; diff --git a/src/scripts/world/world_event_naxxramas.cpp b/src/scripts/world/world_event_naxxramas.cpp index 9d7598ef3..620a3bbb4 100644 --- a/src/scripts/world/world_event_naxxramas.cpp +++ b/src/scripts/world/world_event_naxxramas.cpp @@ -1006,9 +1006,9 @@ bool GossipHello_naxx_event_rewards_giver(Player* player, Creature* creature) uint32 attacked1 = 0; uint32 attacked2 = 0; - if (sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_TIME1) < time(NULL)) + if (sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_TIME1) < time(nullptr)) attacked1 = sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_ZONE1); - if (sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_TIME2) < time(NULL)) + if (sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_TIME2) < time(nullptr)) attacked2 = sObjectMgr.GetSavedVariable(VARIABLE_NAXX_ATTACK_ZONE2); // No invasion happening @@ -1235,11 +1235,11 @@ void AddSC_world_event_naxxramas() newscript->RegisterSelf(); // At start up - sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(NULL)); - sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(NULL)); + sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME1, time(nullptr)); + sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(nullptr)); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_ZONE1, ZONEID_TANARIS); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_ZONE2, ZONEID_BLASTED_LANDS); - sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(NULL)); + sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_TIME2, time(nullptr)); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ATTACK_COUNT, 0); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ELITE_ID, 0); sObjectMgr.InitSavedVariable(VARIABLE_NAXX_ELITE_PYLON, 0); diff --git a/src/shared/Auth/ARC4.cpp b/src/shared/Auth/ARC4.cpp index a2b1aa77d..f02256364 100644 --- a/src/shared/Auth/ARC4.cpp +++ b/src/shared/Auth/ARC4.cpp @@ -19,16 +19,16 @@ ARC4::ARC4(uint8 len) : m_ctx() { m_ctx = EVP_CIPHER_CTX_new(); - EVP_EncryptInit_ex(m_ctx, EVP_rc4(), NULL, NULL, NULL); + EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); EVP_CIPHER_CTX_set_key_length(m_ctx, len); } ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx() { m_ctx = EVP_CIPHER_CTX_new(); - EVP_EncryptInit_ex(m_ctx, EVP_rc4(), NULL, NULL, NULL); + EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); EVP_CIPHER_CTX_set_key_length(m_ctx, len); - EVP_EncryptInit_ex(m_ctx, NULL, NULL, seed, NULL); + EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr); } ARC4::~ARC4() @@ -38,7 +38,7 @@ ARC4::~ARC4() void ARC4::Init(uint8 *seed) { - EVP_EncryptInit_ex(m_ctx, NULL, NULL, seed, NULL); + EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr); } void ARC4::UpdateData(int len, uint8 *data) diff --git a/src/shared/Auth/BigNumber.cpp b/src/shared/Auth/BigNumber.cpp index 0c456487a..f4fed2b59 100644 --- a/src/shared/Auth/BigNumber.cpp +++ b/src/shared/Auth/BigNumber.cpp @@ -105,7 +105,7 @@ BigNumber BigNumber::operator/=(const BigNumber &bn) BN_CTX *bnctx; bnctx = BN_CTX_new(); - BN_div(_bn, NULL, _bn, bn._bn, bnctx); + BN_div(_bn, nullptr, _bn, bn._bn, bnctx); BN_CTX_free(bnctx); return *this; diff --git a/src/shared/Auth/HMACSHA1.cpp b/src/shared/Auth/HMACSHA1.cpp index f6861300d..6626b051c 100644 --- a/src/shared/Auth/HMACSHA1.cpp +++ b/src/shared/Auth/HMACSHA1.cpp @@ -26,7 +26,7 @@ HMACSHA1::HMACSHA1(uint32 len, uint8 *seed) HMAC_Init_ex(m_ctx, seed, len, EVP_sha1(), nullptr); #else HMAC_CTX_init(&m_ctx); - HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), NULL); + HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), nullptr); #endif } diff --git a/src/shared/Auth/Hmac.cpp b/src/shared/Auth/Hmac.cpp index fc4ea9679..35bd3b7b7 100644 --- a/src/shared/Auth/Hmac.cpp +++ b/src/shared/Auth/Hmac.cpp @@ -26,7 +26,7 @@ HmacHash::HmacHash(const uint8* data, int length) HMAC_Init_ex(m_ctx, data, length, EVP_sha1(), nullptr); #else HMAC_CTX_init(&m_ctx); - HMAC_Init_ex(&m_ctx, data, length, EVP_sha1(), NULL); + HMAC_Init_ex(&m_ctx, data, length, EVP_sha1(), nullptr); #endif } diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index 837076307..701005c55 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -46,7 +46,7 @@ LocaleNameStr const fullLocaleNameList[] = { "esES", LOCALE_esES }, { "esMX", LOCALE_esMX }, { "ruRU", LOCALE_ruRU }, - { NULL, LOCALE_enUS } + { nullptr, LOCALE_enUS } }; LocaleConstant GetLocaleByName(const std::string& name) diff --git a/src/shared/Common.h b/src/shared/Common.h index 7b3611707..1c4a2ad81 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -152,7 +152,7 @@ typedef off_t ACE_OFF_T; inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } -#define atol(a) strtoul( a, NULL, 10) +#define atol(a) strtoul( a, nullptr, 10) #define STRINGIZE(a) #a diff --git a/src/shared/Database/DBCFileLoader.cpp b/src/shared/Database/DBCFileLoader.cpp index 1998b03ad..a4c2d6a4a 100644 --- a/src/shared/Database/DBCFileLoader.cpp +++ b/src/shared/Database/DBCFileLoader.cpp @@ -27,8 +27,8 @@ DBCFileLoader::DBCFileLoader() { - data = NULL; - fieldsOffset = NULL; + data = nullptr; + fieldsOffset = nullptr; } bool DBCFileLoader::Load(const char *filename, const char *fmt) @@ -38,7 +38,7 @@ bool DBCFileLoader::Load(const char *filename, const char *fmt) if(data) { delete [] data; - data=NULL; + data=nullptr; } FILE * f=fopen(filename,"rb"); @@ -187,7 +187,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** typedef char * ptr; if(strlen(format)!=fieldCount) - return NULL; + return nullptr; //get struct size and index pos int32 i; @@ -245,7 +245,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** offset += sizeof(uint8); break; case FT_STRING: - *((char**)(&dataTable[offset]))=NULL; // will be replaces non-empty or "" strings in AutoProduceStrings + *((char**)(&dataTable[offset]))=nullptr; // will be replaces non-empty or "" strings in AutoProduceStrings offset += sizeof(char*); break; case FT_LOGIC: @@ -268,7 +268,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable) { if(strlen(format)!=fieldCount) - return NULL; + return nullptr; char* stringPool= new char[stringSize]; memcpy(stringPool,stringTable,stringSize); diff --git a/src/shared/Database/DBCFileLoader.h b/src/shared/Database/DBCFileLoader.h index dc9e9848e..d577636f4 100644 --- a/src/shared/Database/DBCFileLoader.h +++ b/src/shared/Database/DBCFileLoader.h @@ -95,11 +95,11 @@ class DBCFileLoader uint32 GetNumRows() const { return recordCount;} uint32 GetCols() const { return fieldCount; } - uint32 GetOffset(size_t id) const { return (fieldsOffset != NULL && id < fieldCount) ? fieldsOffset[id] : 0; } - bool IsLoaded() {return (data!=NULL);} + uint32 GetOffset(size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; } + bool IsLoaded() {return (data!=nullptr);} char* AutoProduceData(const char* fmt, uint32& count, char**& indexTable); char* AutoProduceStrings(const char* fmt, char* dataTable); - static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = NULL); + static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = nullptr); private: uint32 recordSize; diff --git a/src/shared/Database/DBCStore.h b/src/shared/Database/DBCStore.h index 3dff898db..eb013ab6f 100644 --- a/src/shared/Database/DBCStore.h +++ b/src/shared/Database/DBCStore.h @@ -29,10 +29,10 @@ class DBCStorage { typedef std::list StringPoolList; public: - explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { } + explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(nullptr), m_dataTable(nullptr) { } ~DBCStorage() { Clear(); } - T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; } + T const* LookupEntry(uint32 id) const { return (id>=nCount)?nullptr:indexTable[id]; } bool InsertEntry(uint32 id, T* data) { if (id >= nCount) return false; indexTable[id] = data; return true; } uint32 GetNumRows() const { return nCount; } @@ -54,8 +54,8 @@ class DBCStorage // load strings from dbc data m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable)); - // error in dbc file at loading if NULL - return indexTable!=NULL; + // error in dbc file at loading if nullptr + return indexTable!=nullptr; } bool LoadStringsFrom(char const* fn) @@ -81,9 +81,9 @@ class DBCStorage return; delete[] ((char*)indexTable); - indexTable = NULL; + indexTable = nullptr; delete[] ((char*)m_dataTable); - m_dataTable = NULL; + m_dataTable = nullptr; while(!m_stringPoolList.empty()) { @@ -93,7 +93,7 @@ class DBCStorage nCount = 0; } - void EraseEntry(uint32 id) { indexTable[id] = NULL; } + void EraseEntry(uint32 id) { indexTable[id] = nullptr; } private: uint32 nCount; diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 9333f90e0..6d3fe1ad9 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -52,16 +52,16 @@ void SqlConnection::FreePreparedStatements() SqlPreparedStatement * SqlConnection::GetStmt( int nIndex ) { if(nIndex < 0) - return NULL; + return nullptr; //resize stmt container if(m_holder.size() <= nIndex) - m_holder.resize(nIndex + 1, NULL); + m_holder.resize(nIndex + 1, nullptr); - SqlPreparedStatement * pStmt = NULL; + SqlPreparedStatement * pStmt = nullptr; //create stmt if needed - if(m_holder[nIndex] == NULL) + if(m_holder[nIndex] == nullptr) { //obtain SQL request string std::string fmt = m_db.GetStmtString(nIndex); @@ -73,7 +73,7 @@ SqlPreparedStatement * SqlConnection::GetStmt( int nIndex ) { //MANGOS_ASSERT(false && "Unable to prepare SQL statement"); sLog.outError("Can't prepare %s, statement not executed!", fmt.c_str()); - return NULL; + return nullptr; } //save statement in internal registry @@ -204,13 +204,13 @@ void Database::StopServer() // Delete queued queries m_pResultQueue->CancelAll(); delete m_pResultQueue; - m_pResultQueue = NULL; + m_pResultQueue = nullptr; } if (m_pAsyncConn) { delete m_pAsyncConn; - m_pAsyncConn = NULL; + m_pAsyncConn = nullptr; } for (size_t i = 0; i < m_pQueryConnections.size(); ++i) @@ -252,9 +252,9 @@ void Database::HaltDelayThread() delete[] m_delayThreads; if (m_serialDelayQueue) delete[] m_serialDelayQueue; - m_delayThreads = NULL; - m_threadsBodies = NULL; - m_serialDelayQueue = NULL; + m_delayThreads = nullptr; + m_threadsBodies = nullptr; + m_serialDelayQueue = nullptr; m_numAsyncWorkers = 0; } @@ -360,7 +360,7 @@ bool Database::PExecuteLog(const char * format,...) QueryResult* Database::PQuery(const char *format,...) { - if(!format) return NULL; + if(!format) return nullptr; va_list ap; char szQuery [MAX_QUERY_LEN]; @@ -371,7 +371,7 @@ QueryResult* Database::PQuery(const char *format,...) if(res==-1) { sLog.outError("SQL Query truncated (and not execute) for format: %s",format); - return NULL; + return nullptr; } return Query(szQuery); @@ -379,7 +379,7 @@ QueryResult* Database::PQuery(const char *format,...) QueryNamedResult* Database::PQueryNamed(const char *format,...) { - if(!format) return NULL; + if(!format) return nullptr; va_list ap; char szQuery [MAX_QUERY_LEN]; @@ -390,7 +390,7 @@ QueryNamedResult* Database::PQueryNamed(const char *format,...) if(res==-1) { sLog.outError("SQL Query truncated (and not execute) for format: %s",format); - return NULL; + return nullptr; } return QueryNamed(szQuery); @@ -475,7 +475,7 @@ bool Database::BeginTransaction(uint32 serialId) bool Database::InTransaction() { - return m_TransStorage->get() != NULL; + return m_TransStorage->get() != nullptr; } uint32 Database::GetTransactionSerialId() @@ -726,7 +726,7 @@ SqlTransaction * Database::TransHelper::init(uint32 serialId) SqlTransaction * Database::TransHelper::detach() { SqlTransaction * pRes = m_pTrans; - m_pTrans = NULL; + m_pTrans = nullptr; return pRes; } @@ -735,6 +735,6 @@ void Database::TransHelper::reset() if(m_pTrans) { delete m_pTrans; - m_pTrans = NULL; + m_pTrans = nullptr; } } diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index e2fd444ef..9071c6963 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -274,8 +274,8 @@ class MANGOS_DLL_SPEC Database // Frees data, cancels scheduled queries, closes connection void StopServer(); protected: - Database() : m_pAsyncConn(NULL), m_pResultQueue(NULL), m_threadsBodies(NULL), m_delayThreads(NULL), m_numAsyncWorkers(0), - m_serialDelayQueue(NULL), m_delayQueue(new SqlQueue()), m_logSQL(false), m_pingIntervallms(0), m_nQueryConnPoolSize(1), + Database() : m_pAsyncConn(nullptr), m_pResultQueue(nullptr), m_threadsBodies(nullptr), m_delayThreads(nullptr), m_numAsyncWorkers(0), + m_serialDelayQueue(nullptr), m_delayQueue(new SqlQueue()), m_logSQL(false), m_pingIntervallms(0), m_nQueryConnPoolSize(1), m_bAllowAsyncTransactions(false), m_iStmtIndex(-1) { m_nQueryCounter = -1; @@ -287,15 +287,15 @@ class MANGOS_DLL_SPEC Database class MANGOS_DLL_SPEC TransHelper { public: - TransHelper() : m_pTrans(NULL) {} + TransHelper() : m_pTrans(nullptr) {} ~TransHelper(); //initializes new SqlTransaction object SqlTransaction * init(uint32 serialId); - //gets pointer on current transaction object. Returns NULL if transaction was not initiated + //gets pointer on current transaction object. Returns nullptr if transaction was not initiated SqlTransaction * get() const { return m_pTrans; } //detaches SqlTransaction object allocated by init() function - //next call to get() function will return NULL! + //next call to get() function will return nullptr! //do not forget to destroy obtained SqlTransaction object! SqlTransaction * detach(); //destroyes SqlTransaction allocated by init() function diff --git a/src/shared/Database/DatabaseImpl.h b/src/shared/Database/DatabaseImpl.h index fdb81b3d6..9aafeb792 100644 --- a/src/shared/Database/DatabaseImpl.h +++ b/src/shared/Database/DatabaseImpl.h @@ -53,7 +53,7 @@ bool Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*), const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr), m_pResultQueue)); return true; } @@ -62,7 +62,7 @@ bool Database::AsyncQueryUnsafe(Class *object, void (Class::*method)(QueryResult*), const char *sql) { ASYNC_QUERY_BODY(sql) - MaNGOS::QueryCallback* cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL); + MaNGOS::QueryCallback* cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr); cb->threadSafe = false; AddToDelayQueue(new SqlQuery(sql, cb, m_pResultQueue)); return true; @@ -73,7 +73,7 @@ bool Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*, ParamType1), ParamType1 param1, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, param1), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, param1), m_pResultQueue)); return true; } template @@ -81,7 +81,7 @@ bool Database::AsyncQueryUnsafe(Class *object, void (Class::*method)(QueryResult*, ParamType1), ParamType1 param1, const char *sql) { ASYNC_QUERY_BODY(sql) - MaNGOS::QueryCallback* cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, param1); + MaNGOS::QueryCallback* cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, param1); cb->threadSafe = false; AddToDelayQueue(new SqlQuery(sql, cb, m_pResultQueue)); return true; @@ -92,7 +92,7 @@ bool Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*, ParamType1, ParamType2), ParamType1 param1, ParamType2 param2, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, param1, param2), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, param1, param2), m_pResultQueue)); return true; } @@ -101,7 +101,7 @@ bool Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*, ParamType1, ParamType2, ParamType3), ParamType1 param1, ParamType2 param2, ParamType3 param3, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, param1, param2, param3), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, param1, param2, param3), m_pResultQueue)); return true; } @@ -112,7 +112,7 @@ bool Database::AsyncQuery(void (*method)(QueryResult*, ParamType1), ParamType1 param1, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, param1), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, param1), m_pResultQueue)); return true; } @@ -121,7 +121,7 @@ bool Database::AsyncQuery(void (*method)(QueryResult*, ParamType1, ParamType2), ParamType1 param1, ParamType2 param2, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, param1, param2), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, param1, param2), m_pResultQueue)); return true; } @@ -130,7 +130,7 @@ bool Database::AsyncQuery(void (*method)(QueryResult*, ParamType1, ParamType2, ParamType3), ParamType1 param1, ParamType2 param2, ParamType3 param3, const char *sql) { ASYNC_QUERY_BODY(sql) - AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, param1, param2, param3), m_pResultQueue)); + AddToDelayQueue(new SqlQuery(sql, new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, param1, param2, param3), m_pResultQueue)); return true; } @@ -139,7 +139,7 @@ bool Database::AsyncQueryUnsafe(void (*method)(QueryResult*, ParamType1), ParamType1 param1, const char *sql) { ASYNC_QUERY_BODY(sql) - MaNGOS::SQueryCallback* cb = new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, param1); + MaNGOS::SQueryCallback* cb = new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, param1); cb->threadSafe = false; AddToDelayQueue(new SqlQuery(sql, cb, m_pResultQueue)); return true; @@ -150,7 +150,7 @@ bool Database::AsyncQueryUnsafe(void(*method)(QueryResult*, ParamType1, ParamType2), ParamType1 param1, ParamType2 param2, const char *sql) { ASYNC_QUERY_BODY(sql) - MaNGOS::SQueryCallback* cb = new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, param1, param2); + MaNGOS::SQueryCallback* cb = new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, param1, param2); cb->threadSafe = false; AddToDelayQueue(new SqlQuery(sql, cb, m_pResultQueue)); return true; @@ -253,14 +253,14 @@ bool Database::DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, SqlQueryHolder*), SqlQueryHolder *holder) { ASYNC_DELAYHOLDER_BODY(holder) - return holder->Execute(new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, holder), this, m_pResultQueue); + return holder->Execute(new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, holder), this, m_pResultQueue); } template bool Database::DelayQueryHolderUnsafe(Class *object, void (Class::*method)(QueryResult*, SqlQueryHolder*), SqlQueryHolder *holder) { ASYNC_DELAYHOLDER_BODY(holder) - MaNGOS::QueryCallback *cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, holder); + MaNGOS::QueryCallback *cb = new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, holder); cb->threadSafe = false; return holder->Execute(cb, this, m_pResultQueue); } @@ -269,7 +269,7 @@ bool Database::DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, SqlQueryHolder*, ParamType1), SqlQueryHolder *holder, ParamType1 param1) { ASYNC_DELAYHOLDER_BODY(holder) - return holder->Execute(new MaNGOS::QueryCallback(object, method, (QueryResult*)NULL, holder, param1), this, m_pResultQueue); + return holder->Execute(new MaNGOS::QueryCallback(object, method, (QueryResult*)nullptr, holder, param1), this, m_pResultQueue); } // -- QueryHolder static -- @@ -278,7 +278,7 @@ bool Database::DelayQueryHolder(void (*method)(QueryResult*, SqlQueryHolder*, ParamType1), SqlQueryHolder *holder, ParamType1 param1) { ASYNC_DELAYHOLDER_BODY(holder) - return holder->Execute(new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, holder, param1), this, m_pResultQueue); + return holder->Execute(new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, holder, param1), this, m_pResultQueue); } template @@ -286,7 +286,7 @@ bool Database::DelayQueryHolderUnsafe(void (*method)(QueryResult*, SqlQueryHolder*, ParamType1), SqlQueryHolder *holder, ParamType1 param1) { ASYNC_DELAYHOLDER_BODY(holder) - MaNGOS::SQueryCallback *cb = new MaNGOS::SQueryCallback(method, (QueryResult*)NULL, holder, param1); + MaNGOS::SQueryCallback *cb = new MaNGOS::SQueryCallback(method, (QueryResult*)nullptr, holder, param1); cb->threadSafe = false; return holder->Execute(cb, this, m_pResultQueue); } diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp index eddac77b2..edf6735b9 100644 --- a/src/shared/Database/DatabaseMysql.cpp +++ b/src/shared/Database/DatabaseMysql.cpp @@ -48,7 +48,7 @@ DatabaseMysql::DatabaseMysql() if (db_count++ == 0 ) { // Mysql Library Init - mysql_library_init(-1, NULL, NULL); + mysql_library_init(-1, nullptr, nullptr); if (!mysql_thread_safe()) { @@ -81,7 +81,7 @@ MySQLConnection::~MySQLConnection() bool MySQLConnection::OpenConnection(bool reconnect) { - MYSQL * mysqlInit = mysql_init(NULL); + MYSQL * mysqlInit = mysql_init(nullptr); if (!mysqlInit) { sLog.outError( "Could not initialize Mysql connection" ); @@ -97,7 +97,7 @@ bool MySQLConnection::OpenConnection(bool reconnect) } mMysql = mysql_real_connect(mysqlInit, m_host.c_str(), m_user.c_str(), - m_password.c_str(), m_database.c_str(), m_port, NULL, 0); + m_password.c_str(), m_database.c_str(), m_port, nullptr, 0); if (mMysql) { @@ -239,13 +239,13 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * QueryResult* MySQLConnection::Query(const char *sql) { - MYSQL_RES *result = NULL; - MYSQL_FIELD *fields = NULL; + MYSQL_RES *result = nullptr; + MYSQL_FIELD *fields = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if(!_Query(sql,&result,&fields,&rowCount,&fieldCount)) - return NULL; + return nullptr; QueryResultMysql *queryResult = new QueryResultMysql(result, fields, rowCount, fieldCount); @@ -255,13 +255,13 @@ QueryResult* MySQLConnection::Query(const char *sql) QueryNamedResult* MySQLConnection::QueryNamed(const char *sql) { - MYSQL_RES *result = NULL; - MYSQL_FIELD *fields = NULL; + MYSQL_RES *result = nullptr; + MYSQL_FIELD *fields = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if(!_Query(sql,&result,&fields,&rowCount,&fieldCount)) - return NULL; + return nullptr; QueryFieldNames names(fieldCount); for (uint32 i = 0; i < fieldCount; i++) @@ -346,7 +346,7 @@ SqlPreparedStatement * MySQLConnection::CreateStatement( const std::string& fmt ////////////////////////////////////////////////////////////////////////// MySqlPreparedStatement::MySqlPreparedStatement( const std::string& fmt, SqlConnection& conn, MYSQL * mysql ) : SqlPreparedStatement(fmt, conn), - m_pMySQLConn(mysql), m_stmt(NULL), m_pInputArgs(NULL), m_pResult(NULL), m_pResultMetadata(NULL) + m_pMySQLConn(mysql), m_stmt(nullptr), m_pInputArgs(nullptr), m_pResult(nullptr), m_pResultMetadata(nullptr) { } @@ -480,10 +480,10 @@ void MySqlPreparedStatement::RemoveBinds() mysql_free_result(m_pResultMetadata); mysql_stmt_close(m_stmt); - m_stmt = NULL; - m_pResultMetadata = NULL; - m_pResult = NULL; - m_pInputArgs = NULL; + m_stmt = nullptr; + m_pResultMetadata = nullptr; + m_pResult = nullptr; + m_pInputArgs = nullptr; m_bPrepared = false; } diff --git a/src/shared/Database/DatabaseMysql.h b/src/shared/Database/DatabaseMysql.h index bb9873a89..7d39a8525 100644 --- a/src/shared/Database/DatabaseMysql.h +++ b/src/shared/Database/DatabaseMysql.h @@ -72,7 +72,7 @@ private: class MANGOS_DLL_SPEC MySQLConnection : public SqlConnection { public: - MySQLConnection(Database& db) : SqlConnection(db), mMysql(NULL) {} + MySQLConnection(Database& db) : SqlConnection(db), mMysql(nullptr) {} ~MySQLConnection(); bool OpenConnection(bool reconnect); diff --git a/src/shared/Database/DatabasePostgre.cpp b/src/shared/Database/DatabasePostgre.cpp index 475dfa22d..48d6638b0 100644 --- a/src/shared/Database/DatabasePostgre.cpp +++ b/src/shared/Database/DatabasePostgre.cpp @@ -62,9 +62,9 @@ PostgreSQLConnection::~PostgreSQLConnection() bool PostgreSQLConnection::OpenConnection(bool reconnect) { if (m_socket) - mPGconn = PQsetdbLogin(NULL, m_port_or_socket == "localhost" ? NULL : m_port_or_socket.c_str(), NULL, NULL, m_database.c_str(), m_user.c_str(), m_password.c_str()); + mPGconn = PQsetdbLogin(nullptr, m_port_or_socket == "localhost" ? nullptr : m_port_or_socket.c_str(), nullptr, nullptr, m_database.c_str(), m_user.c_str(), m_password.c_str()); else - mPGconn = PQsetdbLogin(m_host.c_str(), m_port_or_socket.c_str(), NULL, NULL, m_database.c_str(), m_user.c_str(), m_password.c_str()); + mPGconn = PQsetdbLogin(m_host.c_str(), m_port_or_socket.c_str(), nullptr, nullptr, m_database.c_str(), m_user.c_str(), m_password.c_str()); /* check to see that the backend connection was successfully made */ if (PQstatus(mPGconn) != CONNECTION_OK) @@ -72,7 +72,7 @@ bool PostgreSQLConnection::OpenConnection(bool reconnect) sLog.outError( "Could not connect to Postgre database at %s: %s", m_host.c_str(), PQerrorMessage(mPGconn)); PQfinish(mPGconn); - mPGconn = NULL; + mPGconn = nullptr; return false; } @@ -120,14 +120,14 @@ bool PostgreSQLConnection::_Query(const char *sql, PGresult** pResult, uint64* p QueryResult* PostgreSQLConnection::Query(const char *sql) { if (!mPGconn) - return NULL; + return nullptr; - PGresult* result = NULL; + PGresult* result = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if(!_Query(sql,&result,&rowCount,&fieldCount)) - return NULL; + return nullptr; QueryResultPostgre * queryResult = new QueryResultPostgre(result, rowCount, fieldCount); @@ -138,14 +138,14 @@ QueryResult* PostgreSQLConnection::Query(const char *sql) QueryNamedResult* PostgreSQLConnection::QueryNamed(const char *sql) { if (!mPGconn) - return NULL; + return nullptr; - PGresult* result = NULL; + PGresult* result = nullptr; uint64 rowCount = 0; uint32 fieldCount = 0; if(!_Query(sql,&result,&rowCount,&fieldCount)) - return NULL; + return nullptr; QueryFieldNames names(fieldCount); for (uint32 i = 0; i < fieldCount; i++) diff --git a/src/shared/Database/DatabasePostgre.h b/src/shared/Database/DatabasePostgre.h index d096c900c..df5184178 100644 --- a/src/shared/Database/DatabasePostgre.h +++ b/src/shared/Database/DatabasePostgre.h @@ -40,7 +40,7 @@ class MANGOS_DLL_SPEC PostgreSQLConnection : public SqlConnection { public: - PostgreSQLConnection() : mPGconn(NULL) {} + PostgreSQLConnection() : mPGconn(nullptr) {} ~PostgreSQLConnection(); bool OpenConnection(bool reconnect); diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index fc93e4a82..380dc7bcd 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -37,13 +37,13 @@ class Field DB_TYPE_BOOL = 0x04 }; - Field() : mValue(NULL), mType(DB_TYPE_UNKNOWN) {} + Field() : mValue(nullptr), mType(DB_TYPE_UNKNOWN) {} Field(const char* value, enum DataTypes type) : mValue(value), mType(type) {} ~Field() {} enum DataTypes GetType() const { return mType; } - bool IsNULL() const { return mValue == NULL; } + bool IsNULL() const { return mValue == nullptr; } const char *GetString() const { return mValue; } std::string GetCppString() const diff --git a/src/shared/Database/QueryResultPostgre.cpp b/src/shared/Database/QueryResultPostgre.cpp index f1537fe7b..dae524340 100644 --- a/src/shared/Database/QueryResultPostgre.cpp +++ b/src/shared/Database/QueryResultPostgre.cpp @@ -55,7 +55,7 @@ bool QueryResultPostgre::NextRow() { pPQgetvalue = PQgetvalue(mResult, mTableIndex, j); if(pPQgetvalue && !(*pPQgetvalue)) - pPQgetvalue = NULL; + pPQgetvalue = nullptr; mCurrentRow[j].SetValue(pPQgetvalue); } diff --git a/src/shared/Database/SqlDelayThread.cpp b/src/shared/Database/SqlDelayThread.cpp index 3b1ef3a5b..22b20a992 100644 --- a/src/shared/Database/SqlDelayThread.cpp +++ b/src/shared/Database/SqlDelayThread.cpp @@ -75,7 +75,7 @@ void SqlDelayThread::Stop() void SqlDelayThread::ProcessRequests() { - SqlOperation* s = NULL; + SqlOperation* s = nullptr; while (m_dbEngine->NextDelayedOperation(s)) { s->Execute(m_dbConnection); diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index 6dcc01646..f18721a71 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -110,7 +110,7 @@ class SqlResultCallbackCaller : public ACE_Based::Runnable #ifndef DO_POSTGRESQL mysql_thread_init(); #endif - MaNGOS::IQueryCallback* s = NULL; + MaNGOS::IQueryCallback* s = nullptr; while (queue.next(s)) { s->Execute(); @@ -130,7 +130,7 @@ void SqlResultQueue::Update(uint32 timeout) SqlResultCallbackCaller* caller = new SqlResultCallbackCaller(); caller->incReference(); ACE_Based::Thread** threads = new ACE_Based::Thread*[threadsCount]; - MaNGOS::IQueryCallback* callback = NULL; + MaNGOS::IQueryCallback* callback = nullptr; int n = 0; while (next(callback)) { @@ -150,7 +150,7 @@ void SqlResultQueue::Update(uint32 timeout) for (int i = 0; i < threadsCount; ++i) threads[i] = new ACE_Based::Thread(caller); // Now execute thread unsafe callbacks - MaNGOS::IQueryCallback* s = NULL; + MaNGOS::IQueryCallback* s = nullptr; while (_threadUnsafeWaitingQueries.next(s)) { s->Execute(); @@ -178,7 +178,7 @@ void SqlResultQueue::CancelAll() MaNGOS::IQueryCallback* cb; while (next(cb)) { - cb->SetResult(NULL); + cb->SetResult(nullptr); cb->Execute(); delete cb; } @@ -205,7 +205,7 @@ bool SqlQueryHolder::SetQuery(size_t index, const char *sql) return false; } - if(m_queries[index].first != NULL) + if(m_queries[index].first != nullptr) { sLog.outError("Attempt assign query to holder index (" SIZEFMTD ") where other query stored (Old: [%s] New: [%s])", index,m_queries[index].first,sql); @@ -213,7 +213,7 @@ bool SqlQueryHolder::SetQuery(size_t index, const char *sql) } /// not executed yet, just stored (it's not called a holder for nothing) - m_queries[index] = SqlResultPair(mangos_strdup(sql), (QueryResult*)NULL); + m_queries[index] = SqlResultPair(mangos_strdup(sql), (QueryResult*)nullptr); return true; } @@ -245,16 +245,16 @@ QueryResult* SqlQueryHolder::GetResult(size_t index) if(index < m_queries.size()) { /// the query strings are freed on the first GetResult or in the destructor - if(m_queries[index].first != NULL) + if(m_queries[index].first != nullptr) { delete [] (const_cast(m_queries[index].first)); - m_queries[index].first = NULL; + m_queries[index].first = nullptr; } /// when you get a result aways remember to delete it! return m_queries[index].second; } else - return NULL; + return nullptr; } void SqlQueryHolder::SetResult(size_t index, QueryResult *result) @@ -270,13 +270,13 @@ SqlQueryHolder::~SqlQueryHolder() { /// if the result was never used, free the resources /// results used already (getresult called) are expected to be deleted - if(m_queries[i].first != NULL) + if(m_queries[i].first != nullptr) { delete [] (const_cast(m_queries[i].first)); if(m_queries[i].second) { delete m_queries[i].second; - m_queries[i].second = NULL; + m_queries[i].second = nullptr; } } } @@ -288,10 +288,10 @@ void SqlQueryHolder::DeleteAllResults() { /// if the result was never used, free the resources /// results used already (getresult called) are expected to be deleted - if (m_queries[i].second != NULL) + if (m_queries[i].second != nullptr) { delete m_queries[i].second; - m_queries[i].second = NULL; + m_queries[i].second = nullptr; } } } diff --git a/src/shared/Database/SqlPreparedStatement.cpp b/src/shared/Database/SqlPreparedStatement.cpp index bc726c7fc..4b6c7adf5 100644 --- a/src/shared/Database/SqlPreparedStatement.cpp +++ b/src/shared/Database/SqlPreparedStatement.cpp @@ -44,7 +44,7 @@ SqlStatement& SqlStatement::operator=( const SqlStatement& index ) if(m_pParams) { delete m_pParams; - m_pParams = NULL; + m_pParams = nullptr; } if(index.m_pParams) diff --git a/src/shared/Database/SqlPreparedStatement.h b/src/shared/Database/SqlPreparedStatement.h index fd7466e26..fb77b6e3c 100644 --- a/src/shared/Database/SqlPreparedStatement.h +++ b/src/shared/Database/SqlPreparedStatement.h @@ -193,7 +193,7 @@ class MANGOS_DLL_SPEC SqlStatement public: ~SqlStatement() { delete m_pParams; } - SqlStatement(const SqlStatement& index) : m_index(index.m_index), m_pDB(index.m_pDB), m_pParams(NULL) + SqlStatement(const SqlStatement& index) : m_index(index.m_index), m_pDB(index.m_pDB), m_pParams(nullptr) { if(index.m_pParams) m_pParams = new SqlStmtParameters(*(index.m_pParams)); @@ -272,7 +272,7 @@ class MANGOS_DLL_SPEC SqlStatement protected: //don't allow anyone except Database class to create static SqlStatement objects friend class Database; - SqlStatement(const SqlStatementID& index, Database& db) : m_index(index), m_pDB(&db), m_pParams(NULL) {} + SqlStatement(const SqlStatementID& index, Database& db) : m_index(index), m_pDB(&db), m_pParams(nullptr) {} private: @@ -287,7 +287,7 @@ class MANGOS_DLL_SPEC SqlStatement SqlStmtParameters * detach() { SqlStmtParameters * p = m_pParams ? m_pParams : new SqlStmtParameters(0); - m_pParams = NULL; + m_pParams = nullptr; return p; } diff --git a/src/shared/DelayExecutor.cpp b/src/shared/DelayExecutor.cpp index dc1f109d4..8b9c1bdb3 100644 --- a/src/shared/DelayExecutor.cpp +++ b/src/shared/DelayExecutor.cpp @@ -106,7 +106,7 @@ int DelayExecutor::activate(int num_threads, ACE_Method_Request* pre_svc_hook, A int DelayExecutor::execute(ACE_Method_Request* new_req) { - if (new_req == NULL) + if (new_req == nullptr) return -1; if (queue_.enqueue(new_req, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) diff --git a/src/shared/DelayExecutor.h b/src/shared/DelayExecutor.h index e08b57721..e7d7e9cb7 100644 --- a/src/shared/DelayExecutor.h +++ b/src/shared/DelayExecutor.h @@ -34,7 +34,7 @@ class DelayExecutor : protected ACE_Task_Base int execute(ACE_Method_Request* new_req); - int activate(int num_threads = 1, ACE_Method_Request* pre_svc_hook = NULL, ACE_Method_Request* post_svc_hook = NULL); + int activate(int num_threads = 1, ACE_Method_Request* pre_svc_hook = nullptr, ACE_Method_Request* post_svc_hook = nullptr); int deactivate(); diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp index f0e512c6a..51ecac382 100644 --- a/src/shared/Threading.cpp +++ b/src/shared/Threading.cpp @@ -173,7 +173,7 @@ void Thread::destroy() // reference set at ACE_Thread::spawn Runnable* task = m_task; - m_task = NULL; + m_task = nullptr; task->decReference(); // Prevent race conditions, because at this point, m_task may be deleted! } diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index 27b60d596..8ffabef76 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -339,7 +339,7 @@ bool IsIPAddress(char const* ipaddress) uint32 CreatePIDFile(const std::string& filename) { FILE * pid_file = fopen (filename.c_str(), "w" ); - if (pid_file == NULL) + if (pid_file == nullptr) return 0; #ifdef WIN32 @@ -565,6 +565,6 @@ void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= fals uint32 j = 0; for (int32 i = init; i != end; i += 2 * op) { char buffer[3] = { str[i], str[i + 1], '\0' }; - out[j++] = strtoul(buffer, NULL, 16); + out[j++] = strtoul(buffer, nullptr, 16); } } \ No newline at end of file diff --git a/src/shared/WheatyExceptionReport.cpp b/src/shared/WheatyExceptionReport.cpp index 101b36a2b..f45786223 100644 --- a/src/shared/WheatyExceptionReport.cpp +++ b/src/shared/WheatyExceptionReport.cpp @@ -24,11 +24,11 @@ inline LPTSTR ErrorMessage(DWORD dw) FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, - 0, NULL ); + 0, nullptr ); return (LPTSTR)lpMsgBuf; } @@ -79,7 +79,7 @@ PEXCEPTION_POINTERS pExceptionInfo ) TCHAR crash_folder_path[MAX_PATH]; sprintf(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder); - if(!CreateDirectory(crash_folder_path, NULL)) + if(!CreateDirectory(crash_folder_path, nullptr)) { if(GetLastError() != ERROR_ALREADY_EXISTS) return 0; @@ -128,7 +128,7 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco return FALSE; TCHAR szTmp[2048]; DWORD cntBytes = sizeof(szTmp); - lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), NULL, NULL, + lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), nullptr, nullptr, (LPBYTE)szTmp, &cntBytes); if (lRet != ERROR_SUCCESS) return FALSE; @@ -459,7 +459,7 @@ PEXCEPTION_POINTERS pExceptionInfo ) CONTEXT trashableContext = *pCtx; - WriteStackDetails( &trashableContext, false, NULL ); + WriteStackDetails( &trashableContext, false, nullptr ); printTracesForAllThreads(); // #ifdef _M_IX86 // X86 Only! @@ -468,7 +468,7 @@ PEXCEPTION_POINTERS pExceptionInfo ) _tprintf( _T("Local Variables And Parameters\r\n") ); trashableContext = *pCtx; - WriteStackDetails( &trashableContext, true, NULL ); + WriteStackDetails( &trashableContext, true, nullptr ); _tprintf( _T("========================\r\n") ); _tprintf( _T("Global Variables\r\n") ); @@ -640,7 +640,7 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par // Get the next stack frame if ( ! StackWalk64( dwMachineType, m_hProcess, - pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(), + pThreadHandle != nullptr ? pThreadHandle : GetCurrentThread(), &sf, pContext, 0,