diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp index 98499a39b..9f1e506af 100644 --- a/src/server/authserver/Authentication/AuthCodes.cpp +++ b/src/server/authserver/Authentication/AuthCodes.cpp @@ -65,6 +65,6 @@ namespace AuthHelper if (PreBcAcceptedClientBuilds[i].Build == build) return &PreBcAcceptedClientBuilds[i]; - return NULL; + return nullptr; } }; diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index c1549b354..2ba5895dc 100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -180,7 +180,7 @@ Patcher PatchesCache; // Constructor - set the N and g values for SRP6 AuthSocket::AuthSocket(RealmSocket& socket) : - pPatch(NULL), socket_(socket), _status(STATUS_CHALLENGE), _build(0), + pPatch(nullptr), socket_(socket), _status(STATUS_CHALLENGE), _build(0), _expversion(0), _accountSecurityLevel(SEC_PLAYER) { N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); @@ -331,7 +331,7 @@ bool AuthSocket::_HandleLogonChallenge() { ACORE_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex); std::string ipaddr = socket().getRemoteAddress(); - uint32 currTime = time(NULL); + uint32 currTime = time(nullptr); std::map::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr); if (itr != LastLoginAttemptTimeForIP.end() && itr->second >= currTime) { @@ -635,7 +635,7 @@ bool AuthSocket::_HandleLogonProof() } SHA1Hash sha; - sha.UpdateBigNumbers(&A, &B, NULL); + sha.UpdateBigNumbers(&A, &B, nullptr); sha.Finalize(); BigNumber u; u.SetBinary(sha.GetDigest(), 20); @@ -671,11 +671,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) @@ -691,9 +691,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); @@ -721,7 +721,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(); // Check auth token @@ -947,7 +947,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)) @@ -1209,7 +1209,7 @@ void Patcher::LoadPatchesInfo() while (dirp) { errno = 0; - if ((dp = readdir(dirp)) != NULL) + if ((dp = readdir(dirp)) != nullptr) { int l = strlen(dp->d_name); diff --git a/src/server/authserver/Server/TOTP.cpp b/src/server/authserver/Server/TOTP.cpp index d3a571c98..0d8f4851d 100644 --- a/src/server/authserver/Server/TOTP.cpp +++ b/src/server/authserver/Server/TOTP.cpp @@ -71,7 +71,7 @@ namespace TOTP memset(encoded, 0, bufsize); unsigned int hmacResSize = HMAC_RES_SIZE; unsigned char hmacRes[HMAC_RES_SIZE]; - unsigned long timestamp = time(NULL)/30; + unsigned long timestamp = time(nullptr)/30; unsigned char challenge[8]; for (int i = 8; i--;timestamp >>= 8) challenge[i] = timestamp; diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index d6b75c21d..ec19cb95f 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -347,7 +347,7 @@ void PetAI::UpdateAI(uint32 diff) void PetAI::UpdateAllies() { Unit* owner = me->GetCharmerOrOwner(); - Group* group = NULL; + Group* group = nullptr; m_updateAlliesTimer = 10*IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance @@ -367,7 +367,7 @@ void PetAI::UpdateAllies() m_AllySet.insert(me->GetGUID()); 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 || !Target->IsInMap(owner) || !group->SameSubGroup(owner->ToPlayer(), Target)) @@ -470,7 +470,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const // Passive pets don't do next target selection if (me->HasReactState(REACT_PASSIVE)) - return NULL; + return nullptr; // Check pet attackers first so we don't drag a bunch of targets to the owner if (Unit* myAttacker = me->getAttackerForHelper()) @@ -491,7 +491,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const // Not sure why we wouldn't have an owner but just in case... Unit* owner = me->GetCharmerOrOwner(); if (!owner) - return NULL; + return nullptr; // Check owner attackers if (Unit* ownerAttacker = owner->getAttackerForHelper()) @@ -513,7 +513,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const return nearTarget; // Default - no valid targets - return NULL; + return nullptr; } void PetAI::HandleReturnMovement() @@ -703,7 +703,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo) if (me->GetVictim() && me->GetVictim() != target) { // Check if our owner selected this target and clicked "attack" - Unit* ownerTarget = NULL; + Unit* ownerTarget = nullptr; if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) ownerTarget = owner->GetSelectedUnit(); else diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 355d4d71e..61ea0a824 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -74,7 +74,7 @@ class PetAI : public CreatureAI Unit* SelectNextTarget(bool allowAutoSelect) const; void HandleReturnMovement(); void DoAttack(Unit* target, bool chase); - bool CanAttack(Unit* target, const SpellInfo* spellInfo = NULL); + bool CanAttack(Unit* target, const SpellInfo* spellInfo = nullptr); void ClearCharmInfoFlags(); }; #endif diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 63f6edcd2..2b673a32f 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -64,14 +64,14 @@ void TotemAI::UpdateAI(uint32 /*diff*/) // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems // pointer to appropriate target if found any - Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; + Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : nullptr; // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if (!victim || !victim->isTargetableForAttack(true, me) || !me->IsWithinDistInMap(victim, max_range) || me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim)) { - victim = NULL; + victim = nullptr; acore::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); acore::UnitLastSearcher checker(me, victim, u_check); me->VisitNearbyObject(max_range, checker); diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index c02b2c19f..8380023f5 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -125,7 +125,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered) void UnitAI::DoCast(uint32 spellId) { - Unit* target = NULL; + Unit* target = nullptr; //sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target); switch (AISpellInfo[spellId].target) { diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 52e418156..281a33178 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -196,7 +196,7 @@ class UnitAI { ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); if (position >= threatlist.size()) - return NULL; + return nullptr; std::list targetList; for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) @@ -204,7 +204,7 @@ class UnitAI targetList.push_back((*itr)->getTarget()); if (position >= targetList.size()) - return NULL; + return nullptr; if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) targetList.sort(acore::ObjectDistanceOrderPred(me)); @@ -235,7 +235,7 @@ class UnitAI break; } - return NULL; + return nullptr; } void SelectTargetList(std::list& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 3f5d415e7..7d7719042 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -246,7 +246,7 @@ bool CreatureAI::_EnterEvadeMode() me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); me->ResetPlayerDamageReq(); me->SetLastDamagedTime(0); diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 8dc2f2fd8..ed5768669 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -66,7 +66,7 @@ class CreatureAI : public UnitAI Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); public: - void Talk(uint8 id, WorldObject const* whisperTarget = NULL); + void Talk(uint8 id, WorldObject const* whisperTarget = nullptr); explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) {} virtual ~CreatureAI() {} @@ -85,7 +85,7 @@ class CreatureAI : public UnitAI // Called for reaction at stopping attack at no attackers or targets virtual void EnterEvadeMode(); - // 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* /*victim*/) {} // Called when the creature is killed diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 2bef6b620..c5dfefabf 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -18,7 +18,7 @@ namespace FactorySelector { CreatureAI* selectAI(Creature* creature) { - const CreatureAICreator* ai_factory = NULL; + const CreatureAICreator* ai_factory = nullptr; CreatureAIRegistry& ai_registry(*CreatureAIRegistry::instance()); // xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai @@ -84,7 +84,7 @@ namespace FactorySelector #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) // select NullCreatureAI if not another cases - ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); + ainame = (ai_factory == nullptr) ? "NullCreatureAI" : ai_factory->key(); sLog->outDebug(LOG_FILTER_TSCR, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str()); #endif return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature)); @@ -96,7 +96,7 @@ namespace FactorySelector ASSERT(creature->GetCreatureTemplate()); const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType()); - /* if (mv_factory == NULL) + /* if (mv_factory == nullptr) { int best_val = -1; StringVector l; @@ -105,7 +105,7 @@ namespace FactorySelector { const MovementGeneratorCreator *factory = mv_registry.GetRegistryItem((*iter).c_str()); const SelectableMovement *p = dynamic_cast(factory); - ASSERT(p != NULL); + ASSERT(p != nullptr); int val = p->Permit(creature); if (val > best_val) { @@ -121,7 +121,7 @@ namespace FactorySelector GameObjectAI* SelectGameObjectAI(GameObject* go) { - const GameObjectAICreator* ai_factory = NULL; + const GameObjectAICreator* ai_factory = nullptr; GameObjectAIRegistry& ai_registry(*GameObjectAIRegistry::instance()); if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go)) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index d5821190b..4fcabf4e0 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -123,7 +123,7 @@ Creature* SummonList::GetCreatureWithEntry(uint32 entry) const return summon; } - return NULL; + return nullptr; } ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), @@ -207,7 +207,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) void ScriptedAI::DoPlayMusic(uint32 soundId, bool zone) { - ObjectList* targets = NULL; + ObjectList* targets = nullptr; if (me && me->FindMap()) { @@ -253,11 +253,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec { //No target so we can't cast if (!target) - return NULL; + return nullptr; //Silenced so we can't cast if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return NULL; + return nullptr; //Using the extended script system we first create a list of viable spells SpellInfo const* apSpell[CREATURE_MAX_SPELLS]; @@ -265,7 +265,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec uint32 spellCount = 0; - SpellInfo const* tempSpell = NULL; + SpellInfo const* tempSpell = nullptr; //Check if each spell is viable(set it to null if not) for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++) @@ -321,7 +321,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec //We got our usable spells so now lets randomly pick one if (!spellCount) - return NULL; + return nullptr; return apSpell[urand(0, spellCount - 1)]; } @@ -377,7 +377,7 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) { - Unit* unit = NULL; + Unit* unit = nullptr; acore::MostHPMissingInRange u_check(me, range, minHPDiff); acore::UnitLastSearcher searcher(me, unit, u_check); me->VisitNearbyObject(range, searcher); @@ -405,7 +405,7 @@ std::list ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 u Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange) { - Player* player = NULL; + Player* player = nullptr; CellCoord pair(acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(pair); @@ -456,9 +456,9 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea() if (me->IsInEvadeMode() || !me->IsInCombat()) return false; - if (_evadeCheckCooldown == time(NULL)) + if (_evadeCheckCooldown == time(nullptr)) return false; - _evadeCheckCooldown = time(NULL); + _evadeCheckCooldown = time(nullptr); if (!CheckEvadeIfOutOfCombatArea()) return false; @@ -484,7 +484,7 @@ Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura if (!tList.empty()) return tList[urand(0,tList.size()-1)]; else - return NULL; + return nullptr; } // BossAI - for instanced bosses @@ -492,7 +492,7 @@ Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature), instance(creature->GetInstanceScript()), summons(creature), - _boundary(instance ? instance->GetBossBoundary(bossId) : NULL), + _boundary(instance ? instance->GetBossBoundary(bossId) : nullptr), _bossId(bossId) { } diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 351e7178f..552bec907 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -27,7 +27,7 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature), m_uiPlayerCheckTimer(0), m_uiEscortState(STATE_ESCORT_NONE), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), - m_pQuestForEscort(NULL), + m_pQuestForEscort(nullptr), m_bIsActiveAttacker(true), m_bIsRunning(false), m_bCanInstantRespawn(false), @@ -116,7 +116,7 @@ void npc_escortAI::JustDied(Unit* /*killer*/) { if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) if (Player* member = groupRef->GetSource()) if (member->IsInMap(player) && member->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) member->FailQuest(m_pQuestForEscort->GetQuestId()); @@ -158,7 +158,7 @@ void npc_escortAI::EnterEvadeMode() me->RemoveAllAuras(); me->DeleteThreatList(); me->CombatStop(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); if (HasEscortState(STATE_ESCORT_ESCORTING)) { @@ -183,7 +183,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange() { if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) if (Player* member = groupRef->GetSource()) if (me->IsWithinDistInMap(member, GetMaxPlayerDistance())) return true; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index d88dc7d4f..6dbc4d079 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -26,7 +26,7 @@ FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature), m_uiLeaderGUID(0), m_uiUpdateFollowTimer(2500), m_uiFollowState(STATE_FOLLOW_NONE), - m_pQuestForFollow(NULL) + m_pQuestForFollow(nullptr) {} void FollowerAI::AttackStart(Unit* who) @@ -109,7 +109,7 @@ void FollowerAI::JustDied(Unit* /*pKiller*/) { if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) { if (Player* member = groupRef->GetSource()) { @@ -144,7 +144,7 @@ void FollowerAI::EnterEvadeMode() me->RemoveAllAuras(); me->DeleteThreatList(); me->CombatStop(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { @@ -200,7 +200,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) { Player* member = groupRef->GetSource(); @@ -315,7 +315,7 @@ Player* FollowerAI::GetLeaderForFollower() { if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) { Player* member = groupRef->GetSource(); @@ -335,7 +335,7 @@ Player* FollowerAI::GetLeaderForFollower() #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader."); #endif - return NULL; + return nullptr; } void FollowerAI::SetFollowComplete(bool bWithEndEvent) diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index c3c270e1c..99987fc6d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -42,7 +42,7 @@ class FollowerAI : public ScriptedAI void UpdateAI(uint32); //the "internal" update, calls UpdateFollowerAI() virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc) - void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = NULL); + void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = nullptr); void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow void SetFollowComplete(bool bWithEndEvent = false); diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index ba486f182..8e9c12d4f 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -24,13 +24,13 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) { // copy script to local (protection for table reload) - mWayPoints = NULL; + mWayPoints = nullptr; mEscortState = SMART_ESCORT_NONE; mCurrentWPID = 0;//first wp id is 1 !! mWPReached = false; mOOCReached = false; mWPPauseTimer = 0; - mLastWP = NULL; + mLastWP = nullptr; mEscortNPCFlags = 0; mCanRepeatPath = false; @@ -91,7 +91,7 @@ void SmartAI::UpdateDespawn(const uint32 diff) WayPoint* SmartAI::GetNextWayPoint() { if (!mWayPoints || mWayPoints->empty()) - return NULL; + return nullptr; mCurrentWPID++; WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID); @@ -103,7 +103,7 @@ WayPoint* SmartAI::GetNextWayPoint() return (*itr).second; } - return NULL; + return nullptr; } void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) @@ -273,8 +273,8 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) void SmartAI::EndPath(bool fail) { RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING); - mWayPoints = NULL; - mLastWP = NULL; + mWayPoints = nullptr; + mLastWP = nullptr; mWPPauseTimer = 0; if (mEscortNPCFlags) @@ -291,7 +291,7 @@ void SmartAI::EndPath(bool fail) Player* player = (*targets->begin())->ToPlayer(); if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) { Player* groupGuy = groupRef->GetSource(); if (!groupGuy || !player->IsInMap(groupGuy)) @@ -525,7 +525,7 @@ bool SmartAI::IsEscortInvokerInRange() if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) { Player* groupGuy = groupRef->GetSource(); @@ -629,7 +629,7 @@ void SmartAI::EnterEvadeMode() me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); me->ResetPlayerDamageReq(); me->SetLastDamagedTime(0); @@ -1190,7 +1190,7 @@ class SmartTrigger : public AreaTriggerScript sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->entry); #endif SmartScript script; - script.OnInitialize(NULL, trigger); + script.OnInitialize(nullptr, trigger); script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->entry); return true; } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 399bb5ab7..8eeb2fa24 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -38,7 +38,7 @@ class SmartAI : public CreatureAI explicit SmartAI(Creature* c); // Start moving to the desired MovePoint - void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = NULL); + void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr); bool LoadPath(uint32 entry); void PausePath(uint32 delay, bool forced = false); void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false); @@ -66,7 +66,7 @@ class SmartAI : public CreatureAI // Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables void JustReachedHome(); - // 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* enemy); // Called for reaction at stopping attack at no attackers or targets diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 52c24c545..2cd145e81 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -50,9 +50,9 @@ public: SmartScript::SmartScript() { - go = NULL; - me = NULL; - trigger = NULL; + go = nullptr; + me = nullptr; + trigger = nullptr; mEventPhase = 0; mPathId = 0; mTargetStorage = new ObjectListMap(); @@ -122,7 +122,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 if (eventType == e/* && (!(*i).event.event_phase_mask || IsInPhase((*i).event.event_phase_mask)) && !((*i).event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE && (*i).runOnce)*/) { ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); - ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : NULL); + ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : nullptr); if (sConditionMgr->IsObjectMeetToConditions(info, conds)) ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); @@ -154,8 +154,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_TALK: { ObjectList* targets = GetTargets(e, unit); - Creature* talker = e.target.type == 0 ? me : NULL; // xinef: tc retardness fix - Unit* talkTarget = NULL; + Creature* talker = e.target.type == 0 ? me : nullptr; // xinef: tc retardness fix + Unit* talkTarget = nullptr; if (targets) { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) @@ -316,7 +316,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_MUSIC: { - ObjectList* targets = NULL; + ObjectList* targets = nullptr; if (e.action.music.type > 0) { @@ -367,7 +367,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_RANDOM_MUSIC: { - ObjectList* targets = NULL; + ObjectList* targets = nullptr; if (e.action.randomMusic.type > 0) { @@ -1045,7 +1045,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u me->DoFleeToGetAssistance(); if (e.action.flee.withEmote) { - AcoreStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_FLEE, LANG_UNIVERSAL, NULL); + AcoreStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_FLEE, LANG_UNIVERSAL, nullptr); sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -1358,7 +1358,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u (*itr)->ToCreature()->CallForHelp((float)e.action.callHelp.range); if (e.action.callHelp.withEmote) { - AcoreStringTextBuilder builder(*itr, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, NULL); + AcoreStringTextBuilder builder(*itr, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, nullptr); sCreatureTextMgr->SendChatPacket(*itr, builder, CHAT_MSG_MONSTER_EMOTE); } } @@ -1916,7 +1916,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - WorldObject* target = NULL; + WorldObject* target = nullptr; if (e.GetTargetType() == SMART_TARGET_RANDOM_POINT) { @@ -2125,7 +2125,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u meOrigGUID = me ? me->GetGUID() : 0; if (!goOrigGUID) goOrigGUID = go ? go->GetGUID() : 0; - go = NULL; + go = nullptr; me = (*itr)->ToCreature(); break; } @@ -2136,7 +2136,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!goOrigGUID) goOrigGUID = go ? go->GetGUID() : 0; go = (*itr)->ToGameObject(); - me = NULL; + me = nullptr; break; } } @@ -2817,7 +2817,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u waypoints[4] = e.action.closestWaypointFromList.wp5; waypoints[5] = e.action.closestWaypointFromList.wp6; float distanceToClosest = std::numeric_limits::max(); - WayPoint* closestWp = NULL; + WayPoint* closestWp = nullptr; ObjectList* targets = GetTargets(e, unit); if (targets) @@ -3304,7 +3304,7 @@ void SmartScript::ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, ui { // xinef: extended by selfs victim ConditionList const conds = sConditionMgr->GetConditionsForSmartEvent(e.entryOrGuid, e.event_id, e.source_type); - ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : NULL); + ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : nullptr); if (sConditionMgr->IsObjectMeetToConditions(info, conds)) { @@ -3428,7 +3428,7 @@ SmartScriptHolder SmartScript::CreateSmartEvent(SMART_EVENT e, uint32 event_flag ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*= NULL*/) { - Unit* scriptTrigger = NULL; + Unit* scriptTrigger = nullptr; if (invoker) scriptTrigger = invoker; else if (Unit* tempLastInvoker = GetLastInvoker()) @@ -3517,7 +3517,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { if (Group* group = player->GetGroup()) { - for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next()) if (Player* member = groupRef->GetSource()) if (member->IsInMap(player)) l->push_back(member); @@ -3626,7 +3626,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* } case SMART_TARGET_CREATURE_GUID: { - Creature* target = NULL; + Creature* target = nullptr; if (!scriptTrigger && !baseObject) { sLog->outError("SMART_TARGET_CREATURE_GUID can not be used without invoker"); @@ -3649,7 +3649,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* } case SMART_TARGET_GAMEOBJECT_GUID: { - GameObject* target = NULL; + GameObject* target = nullptr; if (!scriptTrigger && !GetBaseObject()) { sLog->outError("SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker"); @@ -3863,7 +3863,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* if (l->empty()) { delete l; - l = NULL; + l = nullptr; } return l; @@ -4325,7 +4325,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (!me || !me->IsInCombat()) return; - ObjectList* _targets = NULL; + ObjectList* _targets = nullptr; switch (e.GetTargetType()) { @@ -4345,7 +4345,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (!_targets) return; - Unit* target = NULL; + Unit* target = nullptr; for (ObjectList::const_iterator itr = _targets->begin(); itr != _targets->end(); ++itr) { @@ -4374,7 +4374,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (!me) return; - WorldObject* creature = NULL; + WorldObject* creature = nullptr; if (e.event.distance.guid != 0) { @@ -4405,7 +4405,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (!me) return; - WorldObject* gameobject = NULL; + WorldObject* gameobject = nullptr; if (e.event.distance.guid != 0) { @@ -4704,14 +4704,14 @@ void SmartScript::GetScript() e = sSmartScriptMgr->GetScript(-((int32)me->GetDBTableGUIDLow()), mScriptType); if (e.empty()) e = sSmartScriptMgr->GetScript((int32)me->GetEntry(), mScriptType); - FillScript(e, me, NULL); + FillScript(e, me, nullptr); } else if (go) { e = sSmartScriptMgr->GetScript(-((int32)go->GetDBTableGUIDLow()), mScriptType); if (e.empty()) e = sSmartScriptMgr->GetScript((int32)go->GetEntry(), mScriptType); - FillScript(e, go, NULL); + FillScript(e, go, nullptr); } else if (trigger) { @@ -4854,9 +4854,9 @@ return 0; Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) { if (!me) - return NULL; + return nullptr; - Unit* unit = NULL; + Unit* unit = nullptr; acore::MostHPMissingInRange u_check(me, range, MinHPDiff); acore::UnitLastSearcher searcher(me, unit, u_check); @@ -4887,9 +4887,9 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list& list, float ra Unit* SmartScript::DoFindClosestFriendlyInRange(float range, bool playerOnly) { if (!me) - return NULL; + return nullptr; - Unit* unit = NULL; + Unit* unit = nullptr; acore::AnyFriendlyNotSelfUnitInObjectRangeCheck u_check(me, me, range, playerOnly); acore::UnitLastSearcher searcher(me, unit, u_check); me->VisitNearbyObject(range, searcher); @@ -4933,5 +4933,5 @@ Unit* SmartScript::GetLastInvoker(Unit* invoker) // xinef: used for area triggers invoker cast else if (invoker) return ObjectAccessor::GetUnit(*invoker, mLastInvoker); - return NULL; + return nullptr; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 99b532675..dd2bc9a00 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -23,19 +23,19 @@ class SmartScript SmartScript(); ~SmartScript(); - void OnInitialize(WorldObject* obj, AreaTrigger const* at = NULL); + void OnInitialize(WorldObject* obj, AreaTrigger const* at = nullptr); void GetScript(); void FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at); - void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL); - void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL); + void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr); + void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr); bool CheckTimer(SmartScriptHolder const& e) const; void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max); void UpdateTimer(SmartScriptHolder& e, uint32 const diff); void InitTimer(SmartScriptHolder& e); - void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL); - void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL); - ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = NULL); + void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr); + void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = nullptr); + ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr); ObjectList* GetWorldObjectsInDist(float dist); void InstallTemplate(SmartScriptHolder const& e); SmartScriptHolder CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, uint32 event_param5, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 target_param4, uint32 phaseMask); @@ -44,7 +44,7 @@ class SmartScript uint32 GetPathId() const { return mPathId; } WorldObject* GetBaseObject() { - WorldObject* obj = NULL; + WorldObject* obj = nullptr; if (me) obj = me; else if (go) @@ -97,7 +97,7 @@ class SmartScript (*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject()); } - bool IsSmart(Creature* c = NULL) + bool IsSmart(Creature* c = nullptr) { bool smart = true; if (c && c->GetAIName() != "SmartAI") @@ -112,7 +112,7 @@ class SmartScript return smart; } - bool IsSmartGO(GameObject* g = NULL) + bool IsSmartGO(GameObject* g = nullptr) { bool smart = true; if (g && g->GetAIName() != "SmartGameObjectAI") @@ -131,7 +131,7 @@ class SmartScript ObjectListMap::iterator itr = mTargetStorage->find(id); if (itr != mTargetStorage->end()) return (*itr).second->GetObjectList(); - return NULL; + return nullptr; } void StoreCounter(uint32 id, uint32 value, uint32 reset) @@ -160,7 +160,7 @@ class SmartScript GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const { - GameObject* gameObject = NULL; + GameObject* gameObject = nullptr; CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); @@ -176,7 +176,7 @@ class SmartScript Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const { - Creature* creature = NULL; + Creature* creature = nullptr; CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); @@ -199,14 +199,14 @@ class SmartScript if (Creature* m = HashMapHolder::Find(meOrigGUID)) { me = m; - go = NULL; + go = nullptr; } } if (goOrigGUID) { if (GameObject* o = HashMapHolder::Find(goOrigGUID)) { - me = NULL; + me = nullptr; go = o; } } @@ -216,7 +216,7 @@ class SmartScript //TIMED_ACTIONLIST (script type 9 aka script9) void SetScript9(SmartScriptHolder& e, uint32 entry); - Unit* GetLastInvoker(Unit* invoker = NULL); + Unit* GetLastInvoker(Unit* invoker = nullptr); uint64 mLastInvoker; typedef std::unordered_map CounterMap; CounterMap mCounterList; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index dd68cf91d..92d2d9172 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1711,7 +1711,7 @@ class ObjectGuidList public: ObjectGuidList(ObjectList* objectList, WorldObject* baseObject) { - ASSERT(objectList != NULL); + ASSERT(objectList != nullptr); m_objectList = objectList; m_baseObject = baseObject; m_guidList = new GuidList(); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index de03d6cc3..ffdf94bd0 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -642,7 +642,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ continue; } - if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL)) + if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(nullptr)) continue; CriteriaProgress& progress = m_criteriaProgress[id]; @@ -701,7 +701,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8); data.append(GetPlayer()->GetPackGUID()); data << uint32(achievement->ID); - data.AppendPackedTime(time(NULL)); + data.AppendPackedTime(time(nullptr)); data << uint32(0); GetPlayer()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true); } @@ -767,7 +767,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u)", type, miscValue1, miscValue2); #endif - AchievementCriteriaEntryList const* achievementCriteriaList = NULL; + AchievementCriteriaEntryList const* achievementCriteriaList = nullptr; switch (type) { @@ -891,7 +891,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (achievement->categoryId == CATEGORY_CHILDRENS_WEEK) { AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria); - if (!data || !data->Meets(GetPlayer(), NULL)) + if (!data || !data->Meets(GetPlayer(), nullptr)) continue; } @@ -1274,7 +1274,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { // Xinef: skip progress only if data exists and is not meet AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria); - if (data && !data->Meets(GetPlayer(), NULL)) + if (data && !data->Meets(GetPlayer(), nullptr)) continue; } @@ -1684,7 +1684,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { // those requirements couldn't be found in the dbc AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria); - if (!data || !data->Meets(GetPlayer(), NULL)) + if (!data || !data->Meets(GetPlayer(), nullptr)) continue; // Check map id requirement @@ -1987,7 +1987,7 @@ CriteriaProgress* AchievementMgr::GetCriteriaProgress(AchievementCriteriaEntry c CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID); if (iter == m_criteriaProgress.end()) - return NULL; + return nullptr; return &(iter->second); } @@ -2043,7 +2043,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, } progress->changed = true; - progress->date = time(NULL); // set the date to the latest update. + progress->date = time(nullptr); // set the date to the latest update. uint32 timeElapsed = 0; bool timedCompleted = false; @@ -2163,7 +2163,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) SendAchievementEarned(achievement); CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; - ca.date = time(NULL); + ca.date = time(nullptr); ca.changed = true; sScriptMgr->OnAchievementComplete(GetPlayer(), achievement); @@ -2238,7 +2238,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) SQLTransaction trans = CharacterDatabase.BeginTransaction(); - Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer()) : NULL; + Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer()) : nullptr; if (item) { // save new item before send @@ -2275,7 +2275,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data, bool inspect) const { if (!m_completedAchievements.empty()) { - AchievementEntry const* achievement = NULL; + AchievementEntry const* achievement = nullptr; for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) { // Skip hidden achievements @@ -2311,7 +2311,7 @@ bool AchievementMgr::HasAchieved(uint32 achievementId) const bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement) { - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, nullptr)) return false; if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID)) @@ -2716,7 +2716,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() continue; } - if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) + if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, nullptr)) sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index 7c16dd2ee..0523e5de6 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -261,7 +261,7 @@ class AchievementMgr void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult); void SaveToDB(SQLTransaction& trans); void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false); - void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL); + void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr); void CompletedAchievement(AchievementEntry const* entry); void CheckAllAchievementCriteria(); void SendAllAchievementData() const; @@ -312,14 +312,14 @@ class AchievementGlobalMgr { if (m_SpecialList[type].find(val) != m_SpecialList[type].end()) return &m_SpecialList[type][val]; - return NULL; + return nullptr; } AchievementCriteriaEntryList const* GetAchievementCriteriaByCondition(AchievementCriteriaCondition condition, uint32 val) { if (m_AchievementCriteriasByCondition[condition].find(val) != m_AchievementCriteriasByCondition[condition].end()) return &m_AchievementCriteriasByCondition[condition][val]; - return NULL; + return nullptr; } AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const @@ -330,31 +330,31 @@ class AchievementGlobalMgr AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const { AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id); - return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : NULL; + return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : nullptr; } AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const { AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id); - return itr != m_AchievementListByReferencedId.end() ? &itr->second : NULL; + return itr != m_AchievementListByReferencedId.end() ? &itr->second : nullptr; } AchievementReward const* GetAchievementReward(AchievementEntry const* achievement) const { AchievementRewards::const_iterator iter = m_achievementRewards.find(achievement->ID); - return iter != m_achievementRewards.end() ? &iter->second : NULL; + return iter != m_achievementRewards.end() ? &iter->second : nullptr; } AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const { AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID); - return iter != m_achievementRewardLocales.end() ? &iter->second : NULL; + return iter != m_achievementRewardLocales.end() ? &iter->second : nullptr; } AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const* achievementCriteria) const { AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID); - return iter != m_criteriaDataMap.end() ? &iter->second : NULL; + return iter != m_criteriaDataMap.end() ? &iter->second : nullptr; } bool IsRealmCompleted(AchievementEntry const* achievement) const; diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 1b907a4f1..e2157719c 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -109,7 +109,7 @@ SavedAddon const* GetAddonInfo(const std::string& name) return &addon; } - return NULL; + return nullptr; } BannedAddonList const* GetBannedAddons() diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 0fe59a7a4..92543db03 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -449,7 +449,7 @@ bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction) // we need to delete the entry, it is not referenced any more delete auction; - auction = NULL; + auction = nullptr; return wasInMap; } @@ -630,7 +630,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player // These are found in ItemRandomSuffix.dbc and ItemRandomProperties.dbc // even though the DBC name seems misleading - char* const* suffix = NULL; + char* const* suffix = nullptr; if (propRefID < 0) { @@ -701,7 +701,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const data << uint32(bid ? GetAuctionOutBid() : 0); // Minimal outbid data << uint32(buyout); // Auction->buyout - data << uint32((expire_time - time(NULL)) * IN_MILLISECONDS); // time left + data << uint32((expire_time - time(nullptr)) * IN_MILLISECONDS); // time left data << uint64(bidder); // auction->bidder current data << uint32(bid); // current bid return true; diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 273dc930b..110f1ce91 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -104,7 +104,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; } void AddAuction(AuctionEntry* auction); @@ -148,7 +148,7 @@ class AuctionHouseMgr if (itr != mAitems.end()) return itr->second; - return NULL; + return nullptr; } //auction messages diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 3288849da..5bf286d8d 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -77,7 +77,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) else // No more vacant places { // TODO: Send a packet to announce it to player - m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10); + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30*MINUTE : 10); InvitePlayerToQueue(player); } } @@ -167,7 +167,7 @@ bool Battlefield::Update(uint32 diff) // Kick players who chose not to accept invitation to the battle if (m_uiKickDontAcceptTimer <= diff) { - time_t now = time(NULL); + time_t now = time(nullptr); for (int team = 0; team < 2; team++) for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr) if (itr->second <= now) @@ -253,7 +253,7 @@ void Battlefield::InvitePlayersInZoneToWar() if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) InvitePlayerToWar(player); else if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)// Battlefield is full of players - m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10; } } } @@ -277,7 +277,7 @@ void Battlefield::InvitePlayerToWar(Player* player) if (player->getLevel() < m_MinLevel) { if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) - m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10; + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10; return; } @@ -286,7 +286,7 @@ void Battlefield::InvitePlayerToWar(Player* player) return; m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); - m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite; + m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(nullptr) + m_TimeForAcceptInvite; player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite); } @@ -523,7 +523,7 @@ Group* Battlefield::GetFreeBfRaid(TeamId TeamId) if (!group->IsFull()) return group; - return NULL; + return nullptr; } Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) @@ -533,7 +533,7 @@ Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId) if (group->IsMember(guid)) return group; - return NULL; + return nullptr; } bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) @@ -588,12 +588,12 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const else sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id); - return NULL; + return nullptr; } GraveyardStruct const * Battlefield::GetClosestGraveyard(Player* player) { - BfGraveyard* closestGY = NULL; + BfGraveyard* closestGY = nullptr; float maxdist = -1; for (uint8 i = 0; i < m_GraveyardList.size(); i++) { @@ -614,7 +614,7 @@ GraveyardStruct const * Battlefield::GetClosestGraveyard(Player* player) if (closestGY) return sGraveyard->GetGraveyard(closestGY->GetGraveyardId()); - return NULL; + return nullptr; } void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid) @@ -752,7 +752,7 @@ void BfGraveyard::GiveControlTo(TeamId team) void BfGraveyard::RelocateDeadPlayers() { - GraveyardStruct const* closestGrave = NULL; + GraveyardStruct const* closestGrave = nullptr; for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { Player* player = ObjectAccessor::FindPlayer(*itr); @@ -796,7 +796,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl { sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; - return NULL; + return nullptr; } creature->setFaction(BattlefieldFactions[teamId]); @@ -806,7 +806,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl if (!cinfo) { sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry); - return NULL; + return nullptr; } // force using DB speeds -- do we really need this? creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); @@ -833,7 +833,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; - return NULL; + return nullptr; } // Add to world diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index dfb1d4e52..d8e03f741 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -416,7 +416,7 @@ class Battlefield : public ZoneScript Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); if (itr != m_capturePoints.end()) return itr->second; - return NULL; + return nullptr; } void RegisterZone(uint32 zoneid); diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index cdb20b6c4..ca234bacd 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -25,7 +25,7 @@ void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint3 WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12); data << uint32(BattleId); data << uint32(ZoneId); - data << uint32((time(NULL) + p_time)); + data << uint32((time(nullptr) + p_time)); //Sending the packet to player SendPacket(&data); diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 12e8c7f94..5e3bb1e90 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -105,10 +105,10 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) if (itr == m_BattlefieldMap.end()) { // no handle for this zone, return - return NULL; + return nullptr; } if (!itr->second->IsEnabled()) - return NULL; + return nullptr; return itr->second; } @@ -119,7 +119,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid) if ((*itr)->GetBattleId() == battleid) return (*itr); } - return NULL; + return nullptr; } void BattlefieldMgr::Update(uint32 diff) @@ -140,5 +140,5 @@ ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId) if (itr != m_BattlefieldMap.end()) return itr->second; else - return NULL; + return nullptr; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 708891200..1c02f79b6 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -888,7 +888,7 @@ void BattlefieldWG::FillInitialWorldStates(WorldPacket& data) data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime() ? 1 : 0); for (uint32 i = 0; i < 2; ++i) - data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000)); + data << ClockWorldState[i] << uint32(time(nullptr) + (m_Timer / 1000)); data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); @@ -1140,7 +1140,7 @@ WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, Tea { m_Bf = battlefield; m_team = teamInControl; - m_Workshop = NULL; + m_Workshop = nullptr; } void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/) diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 809bb0c62..5fddb6ae1 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -391,7 +391,7 @@ void ArenaTeam::Disband() void ArenaTeam::Roster(WorldSession* session) { - Player* player = NULL; + Player* player = nullptr; uint8 unk308 = 0; std::string tempName; @@ -950,5 +950,5 @@ ArenaTeamMember* ArenaTeam::GetMember(uint64 guid) if (itr->Guid == guid) return &(*itr); - return NULL; + return nullptr; } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 3334e1d2d..2535e8736 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -39,7 +39,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamById(uint32 arenaTeamId) const if (itr != ArenaTeamStore.end()) return itr->second; - return NULL; + return nullptr; } ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) const @@ -53,7 +53,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByName(const std::string& arenaTeamName) co if (search == teamName) return itr->second; } - return NULL; + return nullptr; } ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const @@ -62,7 +62,7 @@ ArenaTeam* ArenaTeamMgr::GetArenaTeamByCaptain(uint64 guid) const if (itr->second->GetCaptain() == guid) return itr->second; - return NULL; + return nullptr; } void ArenaTeamMgr::AddArenaTeam(ArenaTeam* arenaTeam) @@ -119,7 +119,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!newArenaTeam->LoadArenaTeamFromDB(result) || !newArenaTeam->LoadMembersFromDB(result2)) { - newArenaTeam->Disband(NULL); + newArenaTeam->Disband(nullptr); delete newArenaTeam; continue; } diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 4b1a1bdbd..b9a95b945 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -41,7 +41,7 @@ namespace acore class BattlegroundChatBuilder { public: - BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = NULL) + BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = nullptr) : _msgtype(msgtype), _textId(textId), _source(source), _args(args) { } void operator()(WorldPacket& data, LocaleConstant loc_idx) @@ -138,7 +138,7 @@ Battleground::Battleground() m_MinPlayersPerTeam = 0; m_MapId = 0; - m_Map = NULL; + m_Map = nullptr; m_StartMaxDist = 0.0f; ScriptId = 0; @@ -163,8 +163,8 @@ Battleground::Battleground() m_ArenaTeamMMR[TEAM_ALLIANCE] = 0; m_ArenaTeamMMR[TEAM_HORDE] = 0; - m_BgRaids[TEAM_ALLIANCE] = NULL; - m_BgRaids[TEAM_HORDE] = NULL; + m_BgRaids[TEAM_ALLIANCE] = nullptr; + m_BgRaids[TEAM_HORDE] = nullptr; m_PlayersCount[TEAM_ALLIANCE] = 0; m_PlayersCount[TEAM_HORDE] = 0; @@ -216,8 +216,8 @@ Battleground::~Battleground() { m_Map->SetUnload(); //unlink to prevent crash, always unlink all pointer reference before destruction - m_Map->SetBG(NULL); - m_Map = NULL; + m_Map->SetBG(nullptr); + m_Map = nullptr; } for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr) @@ -329,7 +329,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff) { for (std::map >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) { - Creature* sh = NULL; + Creature* sh = nullptr; for (std::vector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) { Player* player = ObjectAccessor::FindPlayer(*itr2); @@ -741,8 +741,8 @@ void Battleground::EndBattleground(TeamId winnerTeamId) bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs SetStatus(STATUS_WAIT_LEAVE); - ArenaTeam* winnerArenaTeam = NULL; - ArenaTeam* loserArenaTeam = NULL; + ArenaTeam* winnerArenaTeam = nullptr; + ArenaTeam* loserArenaTeam = nullptr; uint32 loserTeamRating = 0; uint32 loserMatchmakerRating = 0; @@ -770,7 +770,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId) else SetWinner(TEAM_NEUTRAL); - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; uint64 battlegroundId = 1; if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) { @@ -1133,7 +1133,7 @@ void Battleground::RemovePlayerAtLeave(Player* player) if (Group* group = GetBgRaid(teamId)) if (group->IsMember(player->GetGUID())) if (!group->RemoveMember(player->GetGUID())) // group was disbanded - SetBgRaid(teamId, NULL); + SetBgRaid(teamId, nullptr); // let others know sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, player->GetGUID()); @@ -1422,7 +1422,7 @@ void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, { // reward honor instantly if (doAddHonor) - player->RewardHonor(NULL, 1, value); // RewardHonor calls UpdatePlayerScore with doAddHonor = false + player->RewardHonor(nullptr, 1, value); // RewardHonor calls UpdatePlayerScore with doAddHonor = false else itr->second->BonusHonor += value; } @@ -1482,7 +1482,7 @@ void Battleground::RelocateDeadPlayers(uint64 queueIndex) std::vector& ghostList = m_ReviveQueue[queueIndex]; if (!ghostList.empty()) { - GraveyardStruct const* closestGrave = NULL; + GraveyardStruct const* closestGrave = nullptr; for (std::vector::const_iterator itr = ghostList.begin(); itr != ghostList.end(); ++itr) { Player* player = ObjectAccessor::FindPlayer(*itr); @@ -1624,7 +1624,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, Map* map = FindBgMap(); if (!map) - return NULL; + return nullptr; if (transport) { @@ -1636,7 +1636,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, return creature; } - return NULL; + return nullptr; } Creature* creature = new Creature(); @@ -1645,7 +1645,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; - return NULL; + return nullptr; } creature->SetHomePosition(x, y, z, o); @@ -1656,7 +1656,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; - return NULL; + return nullptr; } // Force using DB speeds creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); @@ -1665,7 +1665,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, if (!map->AddToMap(creature)) { delete creature; - return NULL; + return nullptr; } BgCreatures[type] = creature->GetGUID(); @@ -1783,7 +1783,7 @@ void Battleground::SendWarningToAll(uint32 entry, ...) vsnprintf(str, 1024, format, ap); va_end(ap); - ChatHandler::BuildChatPacket(localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, NULL, NULL, str); + ChatHandler::BuildChatPacket(localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, nullptr, nullptr, str); } itr->second->SendDirectMessage(&localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()]); @@ -1956,7 +1956,7 @@ void Battleground::SetBgRaid(TeamId teamId, Group* bg_raid) { Group*& old_raid = m_BgRaids[teamId]; if (old_raid) - old_raid->SetBattlegroundGroup(NULL); + old_raid->SetBattlegroundGroup(nullptr); if (bg_raid) bg_raid->SetBattlegroundGroup(this); old_raid = bg_raid; diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 1f2957b8f..7a2fd35c1 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -173,7 +173,7 @@ enum BattlegroundTeams struct BattlegroundObjectInfo { - BattlegroundObjectInfo() : object(NULL), timer(0), spellid(0) {} + BattlegroundObjectInfo() : object(nullptr), timer(0), spellid(0) {} GameObject *object; int32 timer; @@ -484,7 +484,7 @@ class Battleground void BlockMovement(Player* player); void SendWarningToAll(uint32 entry, ...); - void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = NULL); + void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr); void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...); // specialized version with 2 string id args @@ -555,7 +555,7 @@ class Battleground BGCreatures BgCreatures; void SpawnBGObject(uint32 type, uint32 respawntime); bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0, GOState goState = GO_STATE_READY); - Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime = 0, MotionTransport* transport = NULL); + Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime = 0, MotionTransport* transport = nullptr); bool DelCreature(uint32 type); bool DelObject(uint32 type); bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId); @@ -586,38 +586,38 @@ class Battleground // because BattleGrounds with different types and same level range has different m_BracketId uint8 GetUniqueBracketId() const; - BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast(this); else return NULL; } - BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast(this); else return NULL; } + BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast(this); else return nullptr; } + BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast(this); else return nullptr; } - BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast(this); else return NULL; } - BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast(this); else return NULL; } + BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast(this); else return nullptr; } + BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast(this); else return nullptr; } - BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast(this); else return NULL; } - BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast(this); else return NULL; } + BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast(this); else return nullptr; } + BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast(this); else return nullptr; } - BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast(this); else return NULL; } - BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast(this); else return NULL; } + BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast(this); else return nullptr; } + BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast(this); else return nullptr; } - BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast(this); else return NULL; } - BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast(this); else return NULL; } + BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast(this); else return nullptr; } + BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast(this); else return nullptr; } - BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast(this); else return NULL; } - BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast(this); else return NULL; } + BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast(this); else return nullptr; } + BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast(this); else return nullptr; } - BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast(this); else return NULL; } - BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast(this); else return NULL; } + BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast(this); else return nullptr; } + BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast(this); else return nullptr; } - BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast(this); else return NULL; } - BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast(this); else return NULL; } + BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast(this); else return nullptr; } + BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast(this); else return nullptr; } - BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast(this); else return NULL; } - BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast(this); else return NULL; } + BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast(this); else return nullptr; } + BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast(this); else return nullptr; } - BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast(this); else return NULL; } - BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast(this); else return NULL; } + BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast(this); else return nullptr; } + BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast(this); else return nullptr; } - BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast(this); else return NULL; } - BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast(this); else return NULL; } + BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast(this); else return nullptr; } + BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast(this); else return nullptr; } protected: // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 6a08bbe46..6dbf016f7 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -86,7 +86,7 @@ void BattlegroundMgr::Update(uint32 diff) bg->Update(diff); if (bg->ToBeDeleted()) { - itrDelete->second = NULL; + itrDelete->second = nullptr; m_Battlegrounds.erase(itrDelete); delete bg; } @@ -134,7 +134,7 @@ void BattlegroundMgr::Update(uint32 diff) { if (m_AutoDistributionTimeChecker < diff) { - if (time(NULL) > m_NextAutoDistributionTime) + if (time(nullptr) > m_NextAutoDistributionTime) { sArenaTeamMgr->DistributeArenaPoints(); m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); @@ -407,13 +407,13 @@ void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Pla Battleground* BattlegroundMgr::GetBattleground(uint32 instanceId) { if (!instanceId) - return NULL; + return nullptr; BattlegroundContainer::const_iterator itr = m_Battlegrounds.find(instanceId); if (itr != m_Battlegrounds.end()) return itr->second; - return NULL; + return nullptr; } Battleground* BattlegroundMgr::GetBattlegroundTemplate(BattlegroundTypeId bgTypeId) @@ -422,7 +422,7 @@ Battleground* BattlegroundMgr::GetBattlegroundTemplate(BattlegroundTypeId bgType if (itr != m_BattlegroundTemplates.end()) return itr->second; - return NULL; + return nullptr; } uint32 BattlegroundMgr::GetNextClientVisibleInstanceId() @@ -441,12 +441,12 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original // get the template BG Battleground* bg_template = GetBattlegroundTemplate(bgTypeId); if (!bg_template) - return NULL; + return nullptr; - Battleground* bg = NULL; + Battleground* bg = nullptr; // create a copy of the BG template if (BattlegroundMgr::bgTypeToTemplate.find(bgTypeId) == BattlegroundMgr::bgTypeToTemplate.end()) { - return NULL; + return nullptr; } bg = BattlegroundMgr::bgTypeToTemplate[bgTypeId](bg_template); @@ -491,10 +491,10 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) { // Create the BG - Battleground* bg = NULL; + Battleground* bg = nullptr; bg = BattlegroundMgr::bgtypeToBattleground[data.bgTypeId]; - if (bg == NULL) + if (bg == nullptr) return false; if (data.bgTypeId == BATTLEGROUND_RB) @@ -542,7 +542,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() uint32 bgTypeId = fields[0].GetUInt32(); - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, nullptr)) continue; // can be overwrite by values from DB @@ -645,7 +645,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution() return; time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME)); - time_t curtime = time(NULL); + time_t curtime = time(nullptr); sLog->outString("AzerothCore Battleground: Initializing Automatic Arena Point Distribution"); if (wstime < curtime) { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 68e21f31a..79da4c952 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -113,7 +113,7 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo * ginfo, uint32 d /*** 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, PvPDifficultyEntry const* bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid) { BattlegroundBracketId bracketId = bracketEntry->GetBracketId(); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 01cf8ebcf..11b0ddaba 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -310,7 +310,7 @@ bool BattlegroundEY::SetupBattleground() AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY); } - GraveyardStruct const* sg = NULL; + GraveyardStruct const* sg = nullptr; sg = sGraveyard->GetGraveyard(BG_EY_GRAVEYARD_MAIN_ALLIANCE); AddSpiritGuide(BG_EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, TEAM_ALLIANCE); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 9c75b058d..0bebc42b3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -43,8 +43,8 @@ BattlegroundIC::BattlegroundIC() siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME; - gunshipHorde = NULL; - gunshipAlliance = NULL; + gunshipHorde = nullptr; + gunshipAlliance = nullptr; respawnMap.clear(); } @@ -127,7 +127,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { // Check if creature respawn time is properly saved RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) + if (itr == respawnMap.end() || time(nullptr) < itr->second) continue; catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation()); @@ -145,7 +145,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { // Check if creature respawn time is properly saved RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) + if (itr == respawnMap.end() || time(nullptr) < itr->second) continue; glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation()); @@ -174,7 +174,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { // Check if creature respawn time is properly saved RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) + if (itr == respawnMap.end() || time(nullptr) < itr->second) continue; siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation()); @@ -191,7 +191,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { // Check if creature respawn time is properly saved RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) + if (itr == respawnMap.end() || time(nullptr) < itr->second) continue; demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation()); @@ -519,7 +519,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer) // Xinef: Add to respawn list if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A || entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT) - respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; + respawnMap[unit->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME; } } @@ -866,7 +866,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (!siegeVehicle->IsVehicleInUse()) Unit::Kill(siegeEngine, siegeEngine); - respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; + respawnMap[siegeEngine->GetGUIDLow()] = time(nullptr) + VEHICLE_RESPAWN_TIME; } } @@ -958,7 +958,7 @@ GraveyardStruct const* BattlegroundIC::GetClosestGraveyard(Player* player) if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested! nodes.push_back(i); - GraveyardStruct const* good_entry = NULL; + GraveyardStruct const* good_entry = nullptr; // If so, select the closest node to place ghost on if (!nodes.empty()) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 7b776660e..82e5abc68 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -334,6 +334,6 @@ GameObject* BattlegroundRV::GetPillarAtPosition(Position* p) { uint32 pillar = GetPillarIdForPos(p); if (!pillar) - return NULL; + return nullptr; return GetBgMap()->GetGameObject(BgObjects[pillar]); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 56fb3778b..0c04b7531 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -164,7 +164,7 @@ bool BattlegroundSA::ResetObjs() //Graveyards! for (uint8 i = 0;i < BG_SA_MAX_GY; i++) { - GraveyardStruct const* sg = NULL; + GraveyardStruct const* sg = nullptr; sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]); if (!sg) @@ -624,7 +624,7 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui case BG_SA_BLUE_GATE: case BG_SA_GREEN_GATE: { - GameObject* go = NULL; + GameObject* go = nullptr; if ((go = GetBGObject(BG_SA_RED_GATE))) go->SetDestructibleBuildingModifyState(true); if ((go = GetBGObject(BG_SA_PURPLE_GATE))) @@ -764,7 +764,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player) { - GraveyardStruct const* closest = NULL; + GraveyardStruct const* closest = nullptr; float mindist = 999999.0f; float x, y; @@ -884,7 +884,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) std::vector ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]]; if (!ghost_list.empty()) { - GraveyardStruct const* ClosestGrave = NULL; + GraveyardStruct const* ClosestGrave = nullptr; for (std::vector::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { Player* player = ObjectAccessor::FindPlayer(*itr); diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h index 4c2ee3409..48653ad90 100644 --- a/src/server/game/Calendar/CalendarMgr.h +++ b/src/server/game/Calendar/CalendarMgr.h @@ -134,7 +134,7 @@ struct CalendarInvite _text = calendarInvite.GetText(); } - CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)), + CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(nullptr)), _status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { } CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime, @@ -325,7 +325,7 @@ class CalendarMgr void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent); void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite); void SendCalendarClearPendingAction(uint64 guid); - void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = NULL); + void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = nullptr); void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent); }; diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 656a4fc65..3ebec9193 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -84,7 +84,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, bool Channel::IsBanned(uint64 guid) const { BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid)); - return itr != bannedStore.end() && itr->second > time(NULL); + return itr != bannedStore.end() && itr->second > time(nullptr); } void Channel::UpdateChannelInDB() const @@ -417,8 +417,8 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b { if (!IsBanned(victim)) { - bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION; - AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION); + bannedStore[GUID_LOPART(victim)] = time(nullptr) + CHANNEL_BAN_DURATION; + AddChannelBanToDB(GUID_LOPART(victim), time(nullptr) + CHANNEL_BAN_DURATION); if (notify) { diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index bd75105ea..55d596022 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -120,7 +120,7 @@ Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pk player->GetSession()->SendPacket(&data); } - return NULL; + return nullptr; } return i->second; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index b7bb60e82..9948351b2 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -83,7 +83,7 @@ bool ChatHandler::isAvailable(ChatCommand const& cmd) const bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) { - WorldSession* target_session = NULL; + WorldSession* target_session = nullptr; uint32 target_account = 0; if (target) @@ -166,7 +166,7 @@ void ChatHandler::SendSysMessage(const char *str) while (char* line = LineFromMessage(pos)) { - BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line); + BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line); m_session->SendPacket(&data); } @@ -184,7 +184,7 @@ void ChatHandler::SendGlobalSysMessage(const char *str) while (char* line = LineFromMessage(pos)) { - BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line); + BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line); sWorld->SendGlobalMessage(&data); } @@ -202,7 +202,7 @@ void ChatHandler::SendGlobalGMSysMessage(const char *str) while (char* line = LineFromMessage(pos)) { - BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line); + BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line); sWorld->SendGlobalGMMessage(&data); } @@ -553,7 +553,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector const& table, cons continue; // have subcommand - char const* subcmd = (*cmd) ? strtok(NULL, " ") : ""; + char const* subcmd = (*cmd) ? strtok(nullptr, " ") : ""; if (!table[i].ChildCommands.empty() && subcmd && *subcmd) { @@ -708,7 +708,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag Player* ChatHandler::getSelectedPlayer() { if (!m_session) - return NULL; + return nullptr; uint64 selected = m_session->GetPlayer()->GetTarget(); if (!selected) @@ -720,7 +720,7 @@ Player* ChatHandler::getSelectedPlayer() Unit* ChatHandler::getSelectedUnit() { if (!m_session) - return NULL; + return nullptr; if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit()) return selected; @@ -731,7 +731,7 @@ Unit* ChatHandler::getSelectedUnit() WorldObject* ChatHandler::getSelectedObject() { if (!m_session) - return NULL; + return nullptr; uint64 guid = m_session->GetPlayer()->GetTarget(); @@ -744,7 +744,7 @@ WorldObject* ChatHandler::getSelectedObject() Creature* ChatHandler::getSelectedCreature() { if (!m_session) - return NULL; + return nullptr; return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(), m_session->GetPlayer()->GetTarget()); } @@ -752,7 +752,7 @@ Creature* ChatHandler::getSelectedCreature() Player* ChatHandler::getSelectedPlayerOrSelf() { if (!m_session) - return NULL; + return nullptr; uint64 selected = m_session->GetPlayer()->GetTarget(); if (!selected) @@ -771,14 +771,14 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** s { // skip empty if (!text) - return NULL; + return nullptr; // skip spaces while (*text == ' '||*text == '\t'||*text == '\b') ++text; if (!*text) - return NULL; + return nullptr; // return non link case if (text[0] != '|') @@ -790,28 +790,28 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** s char* check = strtok(text, "|"); // skip color if (!check) - return NULL; // end of data + return nullptr; // end of data - char* cLinkType = strtok(NULL, ":"); // linktype + char* cLinkType = strtok(nullptr, ":"); // linktype if (!cLinkType) - return NULL; // end of data + return nullptr; // end of data if (strcmp(cLinkType, linkType) != 0) { - strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after retturn from function + strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after retturn from function SendSysMessage(LANG_WRONG_LINK_TYPE); - return NULL; + return nullptr; } - char* cKeys = strtok(NULL, "|"); // extract keys and values - char* cKeysTail = strtok(NULL, ""); + char* cKeys = strtok(nullptr, "|"); // extract keys and values + char* cKeysTail = strtok(nullptr, ""); char* cKey = strtok(cKeys, ":|"); // extract key if (something1) - *something1 = strtok(NULL, ":|"); // extract something + *something1 = strtok(nullptr, ":|"); // extract something strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces - strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function + strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function return cKey; } @@ -819,14 +819,14 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, { // skip empty if (!text) - return NULL; + return nullptr; // skip spaces while (*text == ' '||*text == '\t'||*text == '\b') ++text; if (!*text) - return NULL; + return nullptr; // return non link case if (text[0] != '|') @@ -844,48 +844,48 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, { char* check = strtok(text, "|"); // skip color if (!check) - return NULL; // end of data + return nullptr; // end of data - tail = strtok(NULL, ""); // tail + tail = strtok(nullptr, ""); // tail } else tail = text+1; // skip first | char* cLinkType = strtok(tail, ":"); // linktype if (!cLinkType) - return NULL; // end of data + return nullptr; // end of data for (int i = 0; linkTypes[i]; ++i) { if (strcmp(cLinkType, linkTypes[i]) == 0) { - char* cKeys = strtok(NULL, "|"); // extract keys and values - char* cKeysTail = strtok(NULL, ""); + char* cKeys = strtok(nullptr, "|"); // extract keys and values + char* cKeysTail = strtok(nullptr, ""); char* cKey = strtok(cKeys, ":|"); // extract key if (something1) - *something1 = strtok(NULL, ":|"); // extract something + *something1 = strtok(nullptr, ":|"); // extract something strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces - strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function + strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function if (found_idx) *found_idx = i; return cKey; } } - strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function + strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function SendSysMessage(LANG_WRONG_LINK_TYPE); - return NULL; + return nullptr; } GameObject* ChatHandler::GetNearbyGameObject() { if (!m_session) - return NULL; + return nullptr; Player* pl = m_session->GetPlayer(); - GameObject* obj = NULL; + GameObject* obj = nullptr; acore::NearestGameObjectCheck check(*pl); acore::GameObjectLastSearcher searcher(pl, obj, check); pl->VisitNearbyGridObject(SIZE_OF_GRIDS, searcher); @@ -895,7 +895,7 @@ GameObject* ChatHandler::GetNearbyGameObject() GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry) { if (!m_session) - return NULL; + return nullptr; Player* pl = m_session->GetPlayer(); @@ -944,7 +944,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) // number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r int type = 0; - char* param1_str = NULL; + char* param1_str = nullptr; char* idS = extractKeyFromLink(text, spellKeys, &type, ¶m1_str); if (!idS) return 0; @@ -995,7 +995,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text) // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r char* cId = extractKeyFromLink(text, "Htele"); if (!cId) - return NULL; + return nullptr; // id case (explicit or from shift link) if (cId[0] >= '0' || cId[0] <= '9') @@ -1141,12 +1141,12 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2) { char* p1 = strtok(args, " "); - char* p2 = strtok(NULL, " "); + char* p2 = strtok(nullptr, " "); if (!p2) { p2 = p1; - p1 = NULL; + p1 = nullptr; } if (arg1) @@ -1159,7 +1159,7 @@ void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2) char* ChatHandler::extractQuotedArg(char* args) { if (!*args) - return NULL; + return nullptr; if (*args == '"') return strtok(args+1, "\""); @@ -1174,7 +1174,7 @@ char* ChatHandler::extractQuotedArg(char* args) // return NULL if we reached the end of the string if (!*args) - return NULL; + return nullptr; // since we skipped all spaces, we expect another token now if (*args == '"') @@ -1192,7 +1192,7 @@ char* ChatHandler::extractQuotedArg(char* args) return strtok(args + 1, "\""); } else - return NULL; + return nullptr; } } @@ -1246,7 +1246,7 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline) { - player = NULL; + player = nullptr; guid = 0; if (cname) diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index daa7fe8e9..8db66b3fb 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -53,7 +53,7 @@ class ChatHandler // Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE); - static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; } + static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; } // function with different implementation for chat/console virtual char const* GetAcoreString(uint32 entry) const; @@ -91,8 +91,8 @@ class ChatHandler // Returns either the selected player or self if there is no selected player Player* getSelectedPlayerOrSelf(); - char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL); - char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL); + char* extractKeyFromLink(char* text, char const* linkType, char** something1 = nullptr); + char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = nullptr); // if args have single value then it return in arg2 and arg1 == NULL void extractOptFirstArg(char* args, char** arg1, char** arg2); @@ -104,7 +104,7 @@ class ChatHandler bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false); std::string extractPlayerNameFromLink(char* text); // select by arg (name/link) or in-game selection online/offline player - bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL); + bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = nullptr); std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; } std::string GetNameLink(Player* chr) const; @@ -118,7 +118,7 @@ class ChatHandler bool ShowHelpForCommand(std::vector const& table, const char* cmd); protected: - explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass + explicit ChatHandler() : m_session(nullptr), sentErrorMessage(false) {} // for CLI subclass static bool SetDataForCommandInTable(std::vector& table, const char* text, uint32 securityLevel, std::string const& help, std::string const& fullcommand); bool ExecuteCommandInTable(std::vector const& table, const char* text, std::string const& fullcmd); bool ShowHelpForSubCommands(std::vector const& table, char const* cmd, char const* subcmd); diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index f451f4d27..3a9233224 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -186,7 +186,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) { ChatLink::ValidateName(buffer, context); - char* const* suffixStrings = _suffix ? _suffix->nameSuffix : (_property ? _property->nameSuffix : NULL); + char* const* suffixStrings = _suffix ? _suffix->nameSuffix : (_property ? _property->nameSuffix : nullptr); bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer); @@ -638,12 +638,12 @@ bool LinkExtractor::IsValidMessage() std::istringstream::pos_type startPos = 0; uint32 color = 0; - ChatLink* link = NULL; + ChatLink* link = nullptr; while (!_iss.eof()) { if (validSequence == validSequenceIterator) { - link = NULL; + link = nullptr; _iss.ignore(255, PIPE_CHAR); startPos = _iss.tellg() - std::istringstream::pos_type(1); } diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h index 3b8bece42..71fb0410f 100644 --- a/src/server/game/Chat/ChatLink.h +++ b/src/server/game/Chat/ChatLink.h @@ -45,7 +45,7 @@ protected: class ItemChatLink : public ChatLink { public: - ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL) + ItemChatLink() : ChatLink(), _item(nullptr), _suffix(nullptr), _property(nullptr) { memset(_data, 0, sizeof(_data)); } @@ -65,7 +65,7 @@ protected: class QuestChatLink : public ChatLink { public: - QuestChatLink() : ChatLink(), _quest(NULL), _questLevel(0) { } + QuestChatLink() : ChatLink(), _quest(nullptr), _questLevel(0) { } virtual bool Initialize(std::istringstream& iss); virtual bool ValidateName(char* buffer, const char* context); @@ -78,7 +78,7 @@ protected: class SpellChatLink : public ChatLink { public: - SpellChatLink() : ChatLink(), _spell(NULL) { } + SpellChatLink() : ChatLink(), _spell(nullptr) { } virtual bool Initialize(std::istringstream& iss); virtual bool ValidateName(char* buffer, const char* context); @@ -90,7 +90,7 @@ protected: class AchievementChatLink : public ChatLink { public: - AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL) + AchievementChatLink() : ChatLink(), _guid(0), _achievement(nullptr) { memset(_data, 0, sizeof(_data)); } @@ -140,7 +140,7 @@ public: class GlyphChatLink : public SpellChatLink { public: - GlyphChatLink() : SpellChatLink(), _slotId(0), _glyph(NULL) { } + GlyphChatLink() : SpellChatLink(), _slotId(0), _glyph(nullptr) { } virtual bool Initialize(std::istringstream& iss); private: uint32 _slotId; diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h index d91c0340c..8c703aa13 100644 --- a/src/server/game/Combat/HostileRefManager.h +++ b/src/server/game/Combat/HostileRefManager.h @@ -30,7 +30,7 @@ class HostileRefManager : public RefManager // send threat to all my hateres for the victim // The victim is hated than by them as well // use for buffs and healing threat functionality - void threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell = NULL); + void threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell = nullptr); void addTempThreat(float threat, bool apply); diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 1fcb4eb39..973eb8176 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -242,7 +242,7 @@ void ThreatContainer::clearReferences() HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const { if (!victim) - return NULL; + return nullptr; uint64 const guid = victim->GetGUID(); for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) @@ -252,7 +252,7 @@ HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const return ref; } - return NULL; + return nullptr; } //============================================================ @@ -293,7 +293,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR { // pussywizard: pretty much remade this whole function - HostileReference* currentRef = NULL; + HostileReference* currentRef = nullptr; bool found = false; bool noPriorityTargetFound = false; uint32 currTime = sWorld->GetGameTime(); @@ -303,9 +303,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR { Unit* cvUnit = currentVictim->getTarget(); if (!attacker->_CanDetectFeignDeathOf(cvUnit) || !attacker->CanCreatureAttack(cvUnit) || attacker->isTargetNotAcceptableByMMaps(cvUnit->GetGUID(), currTime, cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target - currentVictim = NULL; + currentVictim = nullptr; else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage - currentVictim = NULL; + currentVictim = nullptr; } ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end(); @@ -361,7 +361,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR break; } } - else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's NULL), so end now + else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's nullptr), so end now { currentRef = currentVictim; found = true; @@ -377,7 +377,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR ++iter; } if (!found) - currentRef = NULL; + currentRef = nullptr; return currentRef; } @@ -386,7 +386,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR //=================== ThreatManager ========================== //============================================================ -ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL) +ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(nullptr), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL) { } @@ -396,7 +396,7 @@ void ThreatManager::clearReferences() { iThreatContainer.clearReferences(); iThreatOfflineContainer.clearReferences(); - iCurrentVictim = NULL; + iCurrentVictim = nullptr; iUpdateTimer = THREAT_UPDATE_INTERVAL; } @@ -461,7 +461,7 @@ Unit* ThreatManager::getHostilTarget() iThreatContainer.update(); HostileReference* nextVictim = iThreatContainer.selectNextVictim(GetOwner()->ToCreature(), getCurrentVictim()); setCurrentVictim(nextVictim); - return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; + return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : nullptr; } //============================================================ @@ -544,7 +544,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat { if (hostilRef == getCurrentVictim()) { - setCurrentVictim(NULL); + setCurrentVictim(nullptr); setDirty(true); } if (GetOwner() && GetOwner()->IsInWorld()) @@ -565,7 +565,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat case UEV_THREAT_REF_REMOVE_FROM_LIST: if (hostilRef == getCurrentVictim()) { - setCurrentVictim(NULL); + setCurrentVictim(nullptr); setDirty(true); } iOwner->SendRemoveFromThreatListOpcode(hostilRef); diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index 395ea7e82..eea330c57 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -28,8 +28,8 @@ class SpellInfo; struct ThreatCalcHelper { - static float calcThreat(Unit* hatedUnit, Unit* hatingUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); - static bool isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellInfo const* threatSpell = NULL); + static float calcThreat(Unit* hatedUnit, Unit* hatingUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr); + static bool isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellInfo const* threatSpell = nullptr); }; //============================================================== @@ -189,7 +189,7 @@ class ThreatManager void clearReferences(); - void addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); + void addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr); void doAddThreat(Unit* victim, float threat); diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h index c18417102..e6fa7190c 100644 --- a/src/server/game/Combat/UnitEvents.h +++ b/src/server/game/Combat/UnitEvents.h @@ -82,13 +82,13 @@ class 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; } @@ -112,8 +112,8 @@ class 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/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index de5e65a6e..ebfcdf6f6 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -165,12 +165,12 @@ struct ConditionSourceInfo { WorldObject* mConditionTargets[MAX_CONDITION_TARGETS]; // an array of targets available for conditions Condition* mLastFailedCondition; - ConditionSourceInfo(WorldObject* target0, WorldObject* target1 = NULL, WorldObject* target2 = NULL) + ConditionSourceInfo(WorldObject* target0, WorldObject* target1 = NULL, WorldObject* target2 = nullptr) { mConditionTargets[0] = target0; mConditionTargets[1] = target1; mConditionTargets[2] = target2; - mLastFailedCondition = NULL; + mLastFailedCondition = nullptr; } }; diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index c2d91aa49..4fff74e3c 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -104,10 +104,10 @@ class Lfg5Guids public: uint64 guid[5]; LfgRolesMap* roles; - Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; } - Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; } - Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } - Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/) { memcpy(guid, x.guid, 5*8); roles = NULL; } + Lfg5Guids() { memset(&guid, 0, 5*8); roles = nullptr; } + Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = nullptr; } + Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = nullptr; } + Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/) { memcpy(guid, x.guid, 5*8); roles = nullptr; } ~Lfg5Guids() { delete roles; } void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); } void clear() { memset(&guid, 0, 5*8); } @@ -182,7 +182,7 @@ public: { return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4]; } - void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } + void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = nullptr; } std::string toString() const // for debugging { std::ostringstream o; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index ca7935889..db0ed2d1e 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -112,7 +112,7 @@ void LFGMgr::LoadRewards() uint32 count = 0; - Field* fields = NULL; + Field* fields = nullptr; do { fields = result->Fetch(); @@ -160,7 +160,7 @@ LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id) if (itr != LfgDungeonStore.end()) return &(itr->second); - return NULL; + return nullptr; } void LFGMgr::LoadLFGDungeons(bool reload /* = false */) @@ -266,7 +266,7 @@ void LFGMgr::Update(uint32 tdiff, uint8 task) if (task == 0) { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); // Remove obsolete role checks for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();) @@ -656,7 +656,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const // Create new rolecheck LfgRoleCheck& roleCheck = RoleChecksStore[gguid]; roleCheck.roles.clear(); // pussywizard: NEW rolecheck, not old one with trash data >_> - roleCheck.cancelTime = time_t(time(NULL)) + LFG_TIME_ROLECHECK; + roleCheck.cancelTime = time_t(time(nullptr)) + LFG_TIME_ROLECHECK; roleCheck.state = LFG_ROLECHECK_INITIALITING; roleCheck.leader = guid; roleCheck.dungeons = dungeons; @@ -671,7 +671,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const SetState(gguid, LFG_STATE_ROLECHECK); // Send update to player LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { if (Player* plrg = itr->GetSource()) { @@ -694,7 +694,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const LfgRolesMap rolesMap; rolesMap[guid] = roles; LFGQueue& queue = GetQueue(guid); - queue.AddQueueData(guid, time(NULL), dungeons, rolesMap); + queue.AddQueueData(guid, time(nullptr), dungeons, rolesMap); if (!isContinue) { @@ -1361,7 +1361,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* { SetState(gguid, LFG_STATE_QUEUED); LFGQueue& queue = GetQueue(gguid); - queue.AddQueueData(gguid, time_t(time(NULL)), roleCheck.dungeons, roleCheck.roles); + queue.AddQueueData(gguid, time_t(time(nullptr)), roleCheck.dungeons, roleCheck.roles); RoleChecksStore.erase(itRoleCheck); } else if (roleCheck.state != LFG_ROLECHECK_INITIALITING) @@ -1493,7 +1493,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); - Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL; + Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : nullptr; uint64 oldGroupGUID = 0; for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it) { @@ -1638,7 +1638,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) bool sendUpdate = proposal.state != LFG_PROPOSAL_SUCCESS; proposal.state = LFG_PROPOSAL_SUCCESS; - time_t joinTime = time(NULL); + time_t joinTime = time(nullptr); LFGQueue& queue = GetQueue(guid); LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); @@ -1824,7 +1824,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co LfgPlayerBoot& boot = BootsStore[gguid]; boot.inProgress = true; - boot.cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT; + boot.cancelTime = time_t(time(nullptr)) + LFG_TIME_BOOT; boot.reason = reason; boot.victim = victim; @@ -1916,7 +1916,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) */ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/) { - LFGDungeonData const* dungeon = NULL; + LFGDungeonData const* dungeon = nullptr; Group* group = player->GetGroup(); if (group && group->isLFGGroup()) @@ -1959,7 +1959,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (!fromOpcode) { // Select a player inside to be teleported to - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* plrg = itr->GetSource(); if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map)) @@ -2117,7 +2117,7 @@ LfgDungeonSet const& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon) */ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level) { - LfgReward const* rew = NULL; + LfgReward const* rew = nullptr; LfgRewardContainerBounds bounds = RewardMapStore.equal_range(dungeon & 0x00FFFFFF); for (LfgRewardContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 81f8ea091..eaf7e8c59 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -207,7 +207,7 @@ LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid) { // unset roles here so they are not copied, restore after insertion LfgRolesMap* r = it->roles; - it->roles = NULL; + it->roles = nullptr; currentCompatibles.insert(*it); it->roles = r; } @@ -409,7 +409,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const return LFG_COMPATIBILITY_PENDING; // Create a new proposal - proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL; + proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL; proposal.state = LFG_PROPOSAL_INITIATING; proposal.leader = 0; proposal.dungeonId = acore::Containers::SelectRandomContainerElement(proposalDungeons); @@ -445,7 +445,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const void LFGQueue::UpdateQueueTimers(uint32 diff) { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); bool sendQueueStatus = false; if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL) diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h index 8aa9e3442..260d677c6 100644 --- a/src/server/game/DungeonFinding/LFGQueue.h +++ b/src/server/game/DungeonFinding/LFGQueue.h @@ -28,7 +28,7 @@ enum LfgCompatibility /// Stores player or group queue info struct LfgQueueData { - LfgQueueData(): joinTime(time_t(time(NULL))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED), + LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED) { } diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 31420b247..10f2e1645 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -108,7 +108,7 @@ void LFGPlayerScript::OnMapChanged(Player* player) return; } - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) player->GetSession()->SendNameQueryOpcode(member->GetGUID()); diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index c49003345..78ce48910 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -23,9 +23,9 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type m_valuesCount = CORPSE_END; - m_time = time(NULL); + m_time = time(nullptr); - lootRecipient = NULL; + lootRecipient = nullptr; } Corpse::~Corpse() @@ -116,7 +116,7 @@ void Corpse::SaveToDB() void Corpse::DeleteFromDB(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; if (GetType() == CORPSE_BONES) { // Only specific bones diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index 64042761d..3c7d22a6c 100644 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -54,7 +54,7 @@ class Corpse : public WorldObject, public GridObject uint64 GetOwnerGUID() const { return GetUInt64Value(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; } GridCoord const& GetGridCoord() const { return _gridCoord; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index f91703d7d..5eacfbf6a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -53,7 +53,7 @@ TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const if (itr != spellList.end()) return &itr->second; - return NULL; + return nullptr; } bool VendorItemData::RemoveItem(uint32 item_id) @@ -77,7 +77,7 @@ VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extend for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i) if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost) return *i; - return NULL; + return nullptr; } uint32 CreatureTemplate::GetRandomValidModelId() const @@ -164,7 +164,7 @@ m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false), -m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL), _lastDamagedTime(0) +m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_waypointID(0), m_path_id(0), m_formation(nullptr), _lastDamagedTime(0) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; @@ -184,7 +184,7 @@ m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureDat ResetLootMode(); // restore default loot mode TriggerJustRespawned = false; m_isTempWorldObject = false; - _focusSpell = NULL; + _focusSpell = nullptr; } Creature::~Creature() @@ -192,7 +192,7 @@ Creature::~Creature() m_vendorItemCounts.clear(); delete i_AI; - i_AI = NULL; + i_AI = nullptr; //if (m_uint32Values) // sLog->outError("Deconstruct Creature Entry = %u", GetEntry()); @@ -269,7 +269,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility) if (getDeathState() != CORPSE) return; - m_corpseRemoveTime = time(NULL); + m_corpseRemoveTime = time(nullptr); setDeathState(DEAD); RemoveAllAuras(); if (!skipVisibility) // pussywizard @@ -282,7 +282,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility) // Should get removed later, just keep "compatibility" with scripts if (setSpawnTime) { - m_respawnTime = time(NULL) + respawnDelay; + m_respawnTime = time(nullptr) + respawnDelay; //SaveRespawnTime(); } @@ -507,7 +507,7 @@ void Creature::Update(uint32 diff) break; case DEAD: { - time_t now = time(NULL); + time_t now = time(nullptr); if (m_respawnTime <= now) { bool allowed = IsAIEnabled ? AI()->CanRespawn() : true; // First check if there are any scripts that object to us respawning @@ -549,7 +549,7 @@ void Creature::Update(uint32 diff) } else m_groupLootTimer -= diff; } - else if (m_corpseRemoveTime <= time(NULL)) + else if (m_corpseRemoveTime <= time(nullptr)) { RemoveCorpse(false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -757,7 +757,7 @@ void Creature::DoFleeToGetAssistance() float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); if (radius >0) { - Creature* creature = NULL; + Creature* creature = nullptr; CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); @@ -946,14 +946,14 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const Player* Creature::GetLootRecipient() const { if (!m_lootRecipient) - return NULL; + return nullptr; return ObjectAccessor::FindPlayerInOrOutOfWorld(m_lootRecipient); } Group* Creature::GetLootRecipientGroup() const { if (!m_lootRecipientGroup) - return NULL; + return nullptr; return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup); } @@ -1478,7 +1478,7 @@ bool Creature::IsInvisibleDueToDespawn() const if (Unit::IsInvisibleDueToDespawn()) return true; - if (IsAlive() || m_corpseRemoveTime > time(NULL)) + if (IsAlive() || m_corpseRemoveTime > time(nullptr)) return false; return true; @@ -1543,8 +1543,8 @@ void Creature::setDeathState(DeathState s, bool despawn) if (s == JUST_DIED) { - m_corpseRemoveTime = time(NULL) + m_corpseDelay; - m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay; + m_corpseRemoveTime = time(nullptr) + m_corpseDelay; + m_respawnTime = time(nullptr) + m_respawnDelay + m_corpseDelay; // always save boss respawn time at death to prevent crash cheating if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE) @@ -1582,7 +1582,7 @@ void Creature::setDeathState(DeathState s, bool despawn) //if (IsPet()) // setActive(true); SetFullHealth(); - SetLootRecipient(NULL); + SetLootRecipient(nullptr); ResetPlayerDamageReq(); CreatureTemplate const* cinfo = GetCreatureTemplate(); // Xinef: npc run by default @@ -1751,7 +1751,7 @@ bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) { if (!victim) - return NULL; + return nullptr; for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { @@ -1793,13 +1793,13 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) continue; return spellInfo; } - return NULL; + return nullptr; } SpellInfo const* Creature::reachWithSpellCure(Unit* victim) { if (!victim) - return NULL; + return nullptr; for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { @@ -1840,7 +1840,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim) continue; return spellInfo; } - return NULL; + return nullptr; } // select nearest hostile unit within the given distance (regardless of threat list). @@ -1850,7 +1850,7 @@ Unit* Creature::SelectNearestTarget(float dist, bool playerOnly /* = false */) c Cell cell(p); cell.SetNoCreate(); - Unit* target = NULL; + Unit* target = nullptr; { if (dist == 0.0f) @@ -1876,7 +1876,7 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const Cell cell(p); cell.SetNoCreate(); - Unit* target = NULL; + Unit* target = nullptr; if (dist < ATTACK_DISTANCE) dist = ATTACK_DISTANCE; @@ -2389,7 +2389,7 @@ bool Creature::HasSpell(uint32 spellID) const time_t Creature::GetRespawnTimeEx() const { - time_t now = time(NULL); + time_t now = time(nullptr); if (m_respawnTime > now) return m_respawnTime; else @@ -2440,7 +2440,7 @@ void Creature::AllLootRemovedFromCorpse() { if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) { - time_t now = time(NULL); + time_t now = time(nullptr); if (m_corpseRemoveTime <= now) return; @@ -2454,7 +2454,7 @@ void Creature::AllLootRemovedFromCorpse() // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update if (cinfo && cinfo->SkinLootId) - m_corpseRemoveTime = time(NULL); + m_corpseRemoveTime = time(nullptr); else m_corpseRemoveTime -= diff; } @@ -2508,7 +2508,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) VendorItemCount* vCount = &*itr; - time_t ptime = time(NULL); + time_t ptime = time(nullptr); if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime) { @@ -2547,7 +2547,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us VendorItemCount* vCount = &*itr; - time_t ptime = time(NULL); + time_t ptime = time(nullptr); if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime) { @@ -2815,7 +2815,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell) if (focusSpell != _focusSpell) return; - _focusSpell = NULL; + _focusSpell = nullptr; if (Unit* victim = GetVictim()) SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); else diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 59a309e2a..f2e774feb 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -354,7 +354,7 @@ struct VendorItemData VendorItem* GetItem(uint32 slot) const { if (slot >= m_items.size()) - return NULL; + return nullptr; return m_items[slot]; } @@ -377,7 +377,7 @@ struct VendorItemData struct VendorItemCount { explicit VendorItemCount(uint32 _item, uint32 _count) - : itemId(_item), count(_count), lastIncrementTime(time(NULL)) {} + : itemId(_item), count(_count), lastIncrementTime(time(nullptr)) {} uint32 itemId; uint32 count; @@ -440,7 +440,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje void DisappearAndDie(); - bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = NULL); + bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = nullptr); bool LoadCreaturesAddon(bool reload = false); void SelectLevel(bool changelevel = true); void LoadEquipment(int8 id = 1, bool force = false); @@ -500,7 +500,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); } - bool AIM_Initialize(CreatureAI* ai = NULL); + bool AIM_Initialize(CreatureAI* ai = nullptr); void Motion_Initialize(); CreatureAI* AI() const { return (CreatureAI*)i_AI; } @@ -579,8 +579,8 @@ class Creature : public Unit, public GridObject, public MovableMapObje Group* GetLootRecipientGroup() const; bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party. - bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); } - void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); } + bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(nullptr); } + void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(nullptr) + MINUTE + GetCorpseDelay() + GetRespawnTime(); } void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; } void SetLootRecipient (Unit* unit, bool withGroup = true); @@ -633,7 +633,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; - void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; } + void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(nullptr) + respawn : 0; } void Respawn(bool force = false); void SaveRespawnTime() override; @@ -719,7 +719,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; } protected: - bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = NULL); + bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const CreatureData* data = nullptr); bool InitEntry(uint32 entry, const CreatureData* data=NULL); // vendor items diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 8a3138f83..0b97ff41d 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -165,10 +165,10 @@ void CreatureGroup::AddMember(Creature* member) void CreatureGroup::RemoveMember(Creature* member) { if (m_leader == member) - m_leader = NULL; + m_leader = nullptr; m_members.erase(member); - member->SetFormation(NULL); + member->SetFormation(nullptr); } void CreatureGroup::MemberAttackStart(Creature* member, Unit* target) diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index afb9fa9c3..fe65ec3dc 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -47,7 +47,7 @@ class CreatureGroup typedef std::map CreatureGroupMemberType; //Group cannot be created empty - explicit CreatureGroup(uint32 id) : m_leader(NULL), m_groupID(id), m_Formed(false) {} + explicit CreatureGroup(uint32 id) : m_leader(nullptr), m_groupID(id), m_Formed(false) {} ~CreatureGroup() {} Creature* getLeader() const { return m_leader; } diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 67278c4ff..fa4b71c42 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -177,7 +177,7 @@ class GossipMenu if (itr != _menuItems.end()) return &itr->second; - return NULL; + return nullptr; } GossipMenuItemData const* GetItemData(uint32 indexId) const @@ -186,7 +186,7 @@ class GossipMenu if (itr != _menuItemData.end()) return &itr->second; - return NULL; + return nullptr; } uint32 GetMenuItemSender(uint32 menuItemId) const; diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 28548fa59..11dd0fa0e 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -23,7 +23,7 @@ m_timer(0), m_lifetime(0) Unit* TempSummon::GetSummoner() const { - return m_summonerGUID ? ObjectAccessor::GetUnit(*this, m_summonerGUID) : NULL; + return m_summonerGUID ? ObjectAccessor::GetUnit(*this, m_summonerGUID) : nullptr; } void TempSummon::Update(uint32 diff) @@ -406,7 +406,7 @@ void Puppet::RemoveFromWorld() if (!IsInWorld()) return; - RemoveCharmedBy(NULL); + RemoveCharmedBy(nullptr); Minion::RemoveFromWorld(); } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index ab00926c3..224568863 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -17,7 +17,7 @@ #include "Transport.h" DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject), MovableMapObject(), - _aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _isViewpoint(false) + _aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false) { m_objectType |= TYPEMASK_DYNAMICOBJECT; m_objectTypeId = TYPEID_DYNAMICOBJECT; @@ -41,7 +41,7 @@ void DynamicObject::CleanupsBeforeDelete(bool finalCleanup /* = true */) if (Transport* transport = GetTransport()) { transport->RemovePassenger(this); - SetTransport(NULL); + SetTransport(nullptr); m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -193,7 +193,7 @@ void DynamicObject::RemoveAura() { ASSERT(_aura && !_removedAura); _removedAura = _aura; - _aura = NULL; + _aura = nullptr; if (!_removedAura->IsRemoved()) _removedAura->_Remove(AURA_REMOVE_BY_DEFAULT); } @@ -229,5 +229,5 @@ void DynamicObject::UnbindFromCaster() { ASSERT(_caster); _caster->_UnregisterDynObject(this); - _caster = NULL; + _caster = nullptr; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 280815504..fb2a8e01c 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -30,7 +30,7 @@ #endif GameObject::GameObject() : WorldObject(false), MovableMapObject(), - m_model(NULL), m_goValue(), m_AI(NULL) + m_model(nullptr), m_goValue(), m_AI(nullptr) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; @@ -46,9 +46,9 @@ GameObject::GameObject() : WorldObject(false), MovableMapObject(), m_usetimes = 0; m_spellId = 0; m_cooldownTime = 0; - m_goInfo = NULL; + m_goInfo = nullptr; m_ritualOwnerGUIDLow = 0; - m_goData = NULL; + m_goData = nullptr; m_packedRotation = 0; m_DBTableGuid = 0; @@ -95,7 +95,7 @@ void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/) if (GetTransport() && !ToTransport()) { GetTransport()->RemovePassenger(this); - SetTransport(NULL); + SetTransport(nullptr); m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -390,7 +390,7 @@ void GameObject::Update(uint32 diff) 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(); @@ -488,7 +488,7 @@ void GameObject::Update(uint32 diff) { if (m_respawnTime > 0) // timer on { - time_t now = time(NULL); + time_t now = time(nullptr); if (m_respawnTime <= now) // timer expired { uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT); @@ -571,7 +571,7 @@ void GameObject::Update(uint32 diff) if (goInfo->trap.type == 2) { if (goInfo->trap.spellId) - CastSpell(NULL, goInfo->trap.spellId); // FIXME: null target won't work for target type 1 + CastSpell(nullptr, goInfo->trap.spellId); // FIXME: null target won't work for target type 1 SetLootState(GO_JUST_DEACTIVATED); break; } @@ -595,7 +595,7 @@ void GameObject::Update(uint32 diff) // Type 0 and 1 - trap (type 0 will not get removed after casting a spell) Unit* owner = GetOwner(); - Unit* target = NULL; // pointer to appropriate target if found any + Unit* target = nullptr; // pointer to appropriate target if found any // Note: this hack with search required until GO casting not implemented // search unfriendly creature @@ -611,7 +611,7 @@ void GameObject::Update(uint32 diff) { // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support // affect only players - Player* player = NULL; + Player* player = nullptr; acore::AnyPlayerInObjectRangeCheck checker(this, radius, true, true); acore::PlayerSearcher searcher(this, player, checker); VisitNearbyWorldObject(radius, searcher); @@ -732,7 +732,7 @@ void GameObject::Update(uint32 diff) return; } - m_respawnTime = time(NULL) + m_respawnDelayTime; + m_respawnTime = time(nullptr) + m_respawnDelayTime; // if option not set then object will be saved at grid unload if (GetMap()->IsDungeon()) @@ -945,7 +945,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid); // ready to respawn - if (m_respawnTime && m_respawnTime <= time(NULL)) + if (m_respawnTime && m_respawnTime <= time(nullptr)) { m_respawnTime = 0; GetMap()->RemoveGORespawnTime(m_DBTableGuid); @@ -1029,7 +1029,7 @@ Unit* GameObject::GetOwner() const void GameObject::SaveRespawnTime() { - if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault) + if (m_goData && m_goData->dbData && m_respawnTime > time(nullptr) && m_spawnedByDefault) GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime); } @@ -1088,7 +1088,7 @@ void GameObject::Respawn() { if (m_spawnedByDefault && m_respawnTime > 0) { - m_respawnTime = time(NULL); + m_respawnTime = time(nullptr); GetMap()->RemoveGORespawnTime(m_DBTableGuid); } } @@ -1167,7 +1167,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) range = 5.0f; // search nearest linked GO - GameObject* trapGO = NULL; + GameObject* trapGO = nullptr; { // using original GO distance CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); @@ -1188,7 +1188,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) GameObject* GameObject::LookupFishingHoleAround(float range) { - GameObject* ok = NULL; + GameObject* ok = nullptr; CellCoord p(acore::ComputeCellCoord(GetPositionX(), GetPositionY())); Cell cell(p); @@ -1235,7 +1235,7 @@ void GameObject::SetGoArtKit(uint8 kit) void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid) { - const GameObjectData* data = NULL; + const GameObjectData* data = nullptr; if (go) { go->SetGoArtKit(artkit); @@ -2265,7 +2265,7 @@ void GameObject::EnableCollision(bool enable) GetMap()->InsertGameObjectModel(*m_model);*/ uint32 phaseMask = 0; - if (enable && !DisableMgr::IsDisabledFor(DISABLE_TYPE_GO_LOS, GetEntry(), NULL)) + if (enable && !DisableMgr::IsDisabledFor(DISABLE_TYPE_GO_LOS, GetEntry(), nullptr)) phaseMask = GetPhaseMask(); m_model->enable(phaseMask); @@ -2287,14 +2287,14 @@ void GameObject::UpdateModel() Player* GameObject::GetLootRecipient() const { if (!m_lootRecipient) - return NULL; + return nullptr; return ObjectAccessor::FindPlayerInOrOutOfWorld(m_lootRecipient); } Group* GameObject::GetLootRecipientGroup() const { if (!m_lootRecipientGroup) - return NULL; + return nullptr; return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup); } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index eae884b61..f80ef82b2 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -720,7 +720,7 @@ class GameObject : public WorldObject, public GridObject, public Mov 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 @@ -729,7 +729,7 @@ class GameObject : public WorldObject, public GridObject, public Mov void SetRespawnTime(int32 respawn) { - m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0; + m_respawnTime = respawn > 0 ? time(nullptr) + respawn : 0; m_respawnDelayTime = respawn > 0 ? respawn : 0; } void Respawn(); @@ -763,7 +763,7 @@ class GameObject : public WorldObject, public GridObject, public Mov LootState getLootState() const { return m_lootState; } // Note: unit is only used when s = GO_ACTIVATED - void SetLootState(LootState s, Unit* unit = NULL); + void SetLootState(LootState s, Unit* unit = nullptr); uint16 GetLootMode() const { return m_LootMode; } bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; } @@ -800,13 +800,13 @@ class GameObject : public WorldObject, public GridObject, public Mov bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } uint32 m_groupLootTimer; // (msecs)timer used for group loot uint32 lootingGroupLowGUID; // used to find group which is looting - void SetLootGenerationTime() { m_lootGenerationTime = time(NULL); } + void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); } uint32 GetLootGenerationTime() const { return m_lootGenerationTime; } bool hasQuest(uint32 quest_id) const override; bool hasInvolvedQuest(uint32 quest_id) const override; bool ActivateToQuest(Player* target) const; - void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = NULL); + void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = nullptr); // 0 = use `gameobject`.`spawntimesecs` void ResetDoorOrButton(); @@ -830,7 +830,7 @@ class GameObject : public WorldObject, public GridObject, public Mov void SendCustomAnim(uint32 anim); bool IsInRange(float x, float y, float z, float radius) const; - void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = NULL) override; // pussywizard! + void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = nullptr) override; // pussywizard! void ModifyHealth(int32 change, Unit* attackerOrHealer = NULL, uint32 spellId = 0); void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; } @@ -855,7 +855,7 @@ class GameObject : public WorldObject, public GridObject, public Mov uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); } GameObjectModel* m_model; - void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL) const; + void GetRespawnPosition(float &x, float &y, float &z, float* ori = nullptr) const; void SetPosition(float x, float y, float z, float o); void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } @@ -863,14 +863,14 @@ class GameObject : public WorldObject, public GridObject, public Mov bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; } bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } - Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } - Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } + Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return nullptr; } + Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return nullptr; } - StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } - StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } + StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return nullptr; } + StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return nullptr; } - MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return NULL; } - MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return NULL; } + MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return nullptr; } + MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast(this); else return nullptr; } float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); } float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); } diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 91587aea9..385d3efbb 100644 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -83,7 +83,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); - m_bagslot[i] = NULL; + m_bagslot[i] = nullptr; } return true; @@ -106,7 +106,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry { SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); delete m_bagslot[i]; - m_bagslot[i] = NULL; + m_bagslot[i] = nullptr; } return true; @@ -136,9 +136,9 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/) 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; SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0); } @@ -228,6 +228,6 @@ Item* Bag::GetItemByPos(uint8 slot) const if (slot < GetBagSize()) return m_bagslot[slot]; - return NULL; + return nullptr; } diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index 595584574..9398729ee 100644 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.h @@ -30,8 +30,8 @@ class Bag : public Item void RemoveItem(uint8 slot, bool update); Item* GetItemByPos(uint8 slot) const; - uint32 GetItemCount(uint32 item, Item* eItem = NULL) const; - uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; + uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const; + uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const; uint8 GetSlotByItemGUID(uint64 guid) const; bool IsEmpty() const; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index c8b2d754f..9c5e8d84c 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -33,7 +33,7 @@ void AddItemsSetItem(Player* player, Item* item) if (set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value) return; - ItemSetEffect* eff = NULL; + ItemSetEffect* eff = nullptr; for (size_t x = 0; x < player->ItemSetEff.size(); ++x) { @@ -111,7 +111,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto) return; } - ItemSetEffect* eff = NULL; + ItemSetEffect* eff = nullptr; size_t setindex = 0; for (; setindex < player->ItemSetEff.size(); setindex++) { @@ -153,7 +153,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto) { ASSERT(eff == player->ItemSetEff[setindex]); delete eff; - player->ItemSetEff[setindex] = NULL; + player->ItemSetEff[setindex] = nullptr; } } @@ -233,10 +233,10 @@ Item::Item() m_slot = 0; uState = ITEM_NEW; uQueuePos = -1; - m_container = NULL; + m_container = nullptr; m_lootGenerated = false; mb_in_trade = false; - m_lastPlayedTimeUpdate = time(NULL); + m_lastPlayedTimeUpdate = time(nullptr); m_refundRecipient = 0; m_paidMoney = 0; @@ -674,7 +674,7 @@ void Item::AddToUpdateQueueOf(Player* player) if (IsInUpdateQueue()) return; - ASSERT(player != NULL); + ASSERT(player != nullptr); if (player->GetGUID() != GetOwnerGUID()) { @@ -696,7 +696,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (!IsInUpdateQueue()) return; - ASSERT(player != NULL); + ASSERT(player != nullptr); if (player->GetGUID() != GetOwnerGUID()) { @@ -709,7 +709,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (player->m_itemUpdateQueueBlocked) return; - player->m_itemUpdateQueue[uQueuePos] = NULL; + player->m_itemUpdateQueue[uQueuePos] = nullptr; uQueuePos = -1; } @@ -1016,7 +1016,7 @@ void Item::SendTimeUpdate(Player* owner) Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clone, uint32 randomPropertyId) { if (count < 1) - return NULL; //don't create item at zero count + return nullptr; //don't create item at zero count ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) @@ -1042,7 +1042,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo } else ABORT(); - return NULL; + return nullptr; } Item* Item::CloneItem(uint32 count, Player const* player) const @@ -1050,7 +1050,7 @@ Item* Item::CloneItem(uint32 count, Player const* player) const // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue Item * newItem = CreateItem(GetEntry(), count, player, true, player ? GetItemRandomPropertyId() : 0); if (!newItem) - return NULL; + return nullptr; newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR)); newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR)); @@ -1143,7 +1143,7 @@ void Item::UpdatePlayedTime(Player* owner) // Get current played time uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME); // Calculate time elapsed since last played time update - time_t curtime = time(NULL); + time_t curtime = time(nullptr); uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate); uint32 new_playtime = current_playtime + elapsed; // Check if the refund timer has expired yet @@ -1164,7 +1164,7 @@ void Item::UpdatePlayedTime(Player* owner) uint32 Item::GetPlayedTime() { - time_t curtime = time(NULL); + time_t curtime = time(nullptr); uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate); return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed; } diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 42fcee21a..4d07b4339 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -197,7 +197,7 @@ class Item : public Object { public: static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL, bool clone = false, uint32 randomPropertyId = 0); - Item* CloneItem(uint32 count, Player const* player = NULL) const; + Item* CloneItem(uint32 count, Player const* player = nullptr) const; Item(); @@ -224,8 +224,8 @@ class Item : public Object void SaveRefundDataToDB(); void DeleteRefundDataFromDB(SQLTransaction* trans); - Bag* ToBag() { if (IsBag()) return reinterpret_cast(this); else return NULL; } - const Bag* ToBag() const { if (IsBag()) return reinterpret_cast(this); else return NULL; } + Bag* ToBag() { if (IsBag()) return reinterpret_cast(this); else return nullptr; } + const Bag* ToBag() const { if (IsBag()) return reinterpret_cast(this); else return nullptr; } bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); } bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; } @@ -257,7 +257,7 @@ class Item : public Object uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); } void SetContainer(Bag* container) { m_container = container; } - bool IsInBag() const { return m_container != NULL; } + bool IsInBag() const { return m_container != nullptr; } bool IsEquipped() const; uint32 GetSkill(); @@ -294,7 +294,7 @@ class Item : public Object // Update States ItemUpdateState GetState() const { return uState; } - void SetState(ItemUpdateState state, Player* forplayer = NULL); + void SetState(ItemUpdateState state, Player* forplayer = nullptr); void AddToUpdateQueueOf(Player* player); void RemoveFromUpdateQueueOf(Player* player); bool IsInUpdateQueue() const { return uQueuePos != -1; } @@ -312,7 +312,7 @@ class Item : public Object bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); } // Item Refund system - void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = NULL); + void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = nullptr); void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; } void SetPaidMoney(uint32 money) { m_paidMoney = money; } void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 8155ae362..cc44d690b 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -70,7 +70,7 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1) m_objectTypeId = TYPEID_OBJECT; m_objectType = TYPEMASK_OBJECT; - m_uint32Values = NULL; + m_uint32Values = nullptr; m_valuesCount = 0; _fieldNotifyFlags = UF_FLAG_DYNAMIC; @@ -84,7 +84,7 @@ WorldObject::~WorldObject() { #ifdef ELUNA delete elunaEvents; - elunaEvents = NULL; + elunaEvents = nullptr; #endif // this may happen because there are many !create/delete @@ -300,8 +300,8 @@ void Object::DestroyForPlayer(Player* target, bool onDeath) const void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const { - Unit const* unit = NULL; - WorldObject const* object = NULL; + Unit const* unit = nullptr; + WorldObject const* object = nullptr; if (isType(TYPEMASK_UNIT)) unit = ToUnit(); @@ -463,7 +463,7 @@ void Object::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* targe UpdateMask updateMask; updateMask.SetCount(m_valuesCount); - uint32* flags = NULL; + uint32* flags = nullptr; uint32 visibleFlag = GetUpdateFieldData(target, flags); for (uint16 index = 0; index < m_valuesCount; ++index) @@ -950,7 +950,7 @@ void MovementInfo::OutDebug() sLog->outString("guid " UI64FMTD, guid); sLog->outString("flags %u", flags); sLog->outString("flags2 %u", flags2); - sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); + sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(nullptr))); sLog->outString("position: `%s`", pos.ToString().c_str()); if (flags & MOVEMENTFLAG_ONTRANSPORT) { @@ -976,10 +976,10 @@ void MovementInfo::OutDebug() WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), #ifdef ELUNA -elunaEvents(NULL), +elunaEvents(nullptr), #endif -LastUsedScriptID(0), m_name(""), m_isActive(false), m_isVisibilityDistanceOverride(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL), -m_transport(NULL), m_currMap(NULL), m_InstanceId(0), +LastUsedScriptID(0), m_name(""), m_isActive(false), m_isVisibilityDistanceOverride(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr), +m_transport(nullptr), m_currMap(nullptr), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_useCombinedPhases(true), m_notifyflags(0), m_executed_notifies(0) { m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); @@ -1087,7 +1087,7 @@ void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool /*forceR InstanceScript* WorldObject::GetInstanceScript() { Map* map = GetMap(); - return map->IsDungeon() ? map->ToInstanceMap()->GetInstanceScript() : NULL; + return map->IsDungeon() ? map->ToInstanceMap()->GetInstanceScript() : nullptr; } float WorldObject::GetDistanceZ(const WorldObject* obj) const @@ -2094,10 +2094,10 @@ void WorldObject::ResetMap() #ifdef ELUNA delete elunaEvents; - elunaEvents = NULL; + elunaEvents = nullptr; #endif - m_currMap = NULL; + m_currMap = nullptr; //maybe not for corpse //m_mapId = 0; //m_InstanceId = 0; @@ -2170,7 +2170,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert break; } default: - return NULL; + return nullptr; } } @@ -2178,7 +2178,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert if (summoner) phase = summoner->GetPhaseMask(); - TempSummon* summon = NULL; + TempSummon* summon = nullptr; switch (mask) { case UNIT_MASK_SUMMON: @@ -2197,14 +2197,14 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert summon = new Minion(properties, summoner ? summoner->GetGUID() : 0, false); break; default: - return NULL; + return nullptr; } EnsureGridLoaded(Cell(pos.GetPositionX(), pos.GetPositionY())); if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation())) { delete summon; - return NULL; + return nullptr; } summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId); @@ -2245,14 +2245,14 @@ GameObject* Map::SummonGameObject(uint32 entry, float x, float y, float z, float if (!goinfo) { sLog->outErrorDb("Gameobject template %u not found in database!", entry); - return NULL; + return nullptr; } GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject(); if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, this, PHASEMASK_NORMAL, x, y, z, ang, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, GO_STATE_READY)) { delete go; - return NULL; + return nullptr; } // Xinef: if gameobject is temporary, set custom spellid @@ -2286,26 +2286,26 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempS { if (Map* map = FindMap()) { - if (TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL)) + if (TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : nullptr)) { summon->SetTempSummonType(spwtype); return summon; } } - return NULL; + return nullptr; } GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport) { if (!IsInWorld()) - return NULL; + return nullptr; GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { sLog->outErrorDb("Gameobject template %u not found in database!", entry); - return NULL; + return nullptr; } Map* map = GetMap(); @@ -2313,7 +2313,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, GO_STATE_READY)) { delete go; - return NULL; + return nullptr; } go->SetRespawnTime(respawnTime); @@ -2336,7 +2336,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3 TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; Creature* summon = SummonCreature(WORLD_TRIGGER, x, y, z, ang, summonType, duration); if (!summon) - return NULL; + return nullptr; //summon->SetName(GetName()); if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)) @@ -2375,7 +2375,7 @@ void WorldObject::SummonCreatureGroup(uint8 group, std::list* list Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const { - Creature* creature = NULL; + Creature* creature = nullptr; acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range); acore::CreatureLastSearcher searcher(this, creature, checker); VisitNearbyObject(range, searcher); @@ -2384,7 +2384,7 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const { - GameObject* go = NULL; + GameObject* go = nullptr; acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range); acore::GameObjectLastSearcher searcher(this, go, checker); VisitNearbyGridObject(range, searcher); @@ -2393,7 +2393,7 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const { - GameObject* go = NULL; + GameObject* go = nullptr; acore::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range); acore::GameObjectLastSearcher searcher(this, go, checker); VisitNearbyGridObject(range, searcher); @@ -2402,7 +2402,7 @@ GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float Player* WorldObject::SelectNearestPlayer(float distance) const { - Player* target = NULL; + Player* target = nullptr; acore::NearestPlayerInObjectRangeCheck checker(this, distance); acore::PlayerLastSearcher searcher(this, target, checker); @@ -2965,7 +2965,7 @@ struct WorldObjectChangeAccumulator } void Visit(PlayerMapType &m) { - Player* source = NULL; + Player* source = nullptr; for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { source = iter->GetSource(); @@ -2983,7 +2983,7 @@ struct WorldObjectChangeAccumulator void Visit(CreatureMapType &m) { - Creature* source = NULL; + Creature* source = nullptr; for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { source = iter->GetSource(); @@ -2998,7 +2998,7 @@ struct WorldObjectChangeAccumulator void Visit(DynamicObjectMapType &m) { - DynamicObject* source = NULL; + DynamicObject* source = nullptr; for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { source = iter->GetSource(); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 43aeb8724..ce54e9c73 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -307,21 +307,21 @@ class Object // FG: some hacky helpers void ForceValuesUpdateAtIndex(uint32); - Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return NULL; } - Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return NULL; } - Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast(this); else return NULL; } - Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return NULL; } + Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return nullptr; } + Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; } + Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast(this); else return nullptr; } + Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; } - Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return NULL; } - Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; } - GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast(this); else return NULL; } - GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; } + Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return nullptr; } + Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; } + GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast(this); else return nullptr; } + GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; } - Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast(this); else return NULL; } - Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; } + Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast(this); else return nullptr; } + Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; } - DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return NULL; } - DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return NULL; } + DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return nullptr; } + DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return nullptr; } DataMap CustomData; @@ -897,7 +897,7 @@ class WorldObject : public Object, public WorldLocation virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units virtual void SendMessageToSet(WorldPacket* data, bool self) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), self, true); } // pussywizard! - virtual void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = NULL); // pussywizard! + virtual void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = nullptr); // pussywizard! virtual void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), false, true, skipped_rcvr); } // pussywizard! virtual uint8 getLevelForTarget(WorldObject const* /*target*/) const { return 1; } @@ -911,8 +911,8 @@ class WorldObject : public Object, public WorldLocation void MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote = false); void MonsterWhisper(int32 textId, Player const* target, bool IsBossWhisper = false); - void PlayDistanceSound(uint32 sound_id, Player* target = NULL); - void PlayDirectSound(uint32 sound_id, Player* target = NULL); + void PlayDistanceSound(uint32 sound_id, Player* target = nullptr); + void PlayDirectSound(uint32 sound_id, Player* target = nullptr); void SendObjectDeSpawnAnim(uint64 guid); @@ -921,7 +921,7 @@ class WorldObject : public Object, public WorldLocation float GetGridActivationRange() const; float GetVisibilityRange() const; - float GetSightRange(const WorldObject* target = NULL) const; + float GetSightRange(const WorldObject* target = nullptr) const; //bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const; bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false) const; @@ -950,8 +950,8 @@ class WorldObject : public Object, public WorldLocation void SetZoneScript(); ZoneScript* GetZoneScript() const { return m_zoneScript; } - TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0, SummonPropertiesEntry const *properties = NULL) const; - TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, SummonPropertiesEntry const *properties = NULL) + TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0, SummonPropertiesEntry const *properties = nullptr) const; + TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, SummonPropertiesEntry const *properties = nullptr) { if (!x && !y && !z) { @@ -963,8 +963,8 @@ class WorldObject : public Object, public WorldLocation return SummonCreature(id, pos, spwtype, despwtime, 0, properties); } GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true); - Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel = false, CreatureAI* (*GetAI)(Creature*) = NULL); - void SummonCreatureGroup(uint8 group, std::list* list = NULL); + Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel = false, CreatureAI* (*GetAI)(Creature*) = nullptr); + void SummonCreatureGroup(uint8 group, std::list* list = nullptr); Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const; GameObject* FindNearestGameObject(uint32 entry, float range) const; diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp index 59449204e..16aee5417 100644 --- a/src/server/game/Entities/Object/ObjectPosSelector.cpp +++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp @@ -20,8 +20,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) @@ -35,7 +35,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/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index b7e5cd508..f1f47d918 100644 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.h @@ -22,9 +22,9 @@ class UpdateMask CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8, }; - UpdateMask() : _fieldCount(0), _blockCount(0), _bits(NULL) { } + UpdateMask() : _fieldCount(0), _blockCount(0), _bits(nullptr) { } - UpdateMask(UpdateMask const& right) : _bits(NULL) + UpdateMask(UpdateMask const& right) : _bits(nullptr) { SetCount(right.GetCount()); memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32); diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 487b48b39..345e80d5a 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -25,10 +25,10 @@ #define PET_XP_FACTOR 0.05f -Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner ? owner->GetGUID() : 0, true), +Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : 0, true), m_usedTalentCount(0), m_removed(false), m_owner(owner), m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0), -m_auraRaidUpdateMask(0), m_loading(false), m_petRegenTimer(PET_FOCUS_REGEN_INTERVAL), m_declinedname(NULL), m_tempspellTarget(NULL), m_tempoldTarget(NULL), m_tempspellIsPositive(false), m_tempspell(0), asynchLoadType(PET_LOAD_DEFAULT) +m_auraRaidUpdateMask(0), m_loading(false), m_petRegenTimer(PET_FOCUS_REGEN_INTERVAL), m_declinedname(nullptr), m_tempspellTarget(nullptr), m_tempoldTarget(nullptr), m_tempspellIsPositive(false), m_tempspell(0), asynchLoadType(PET_LOAD_DEFAULT) { m_unitTypeMask |= UNIT_MASK_PET; if (type == HUNTER_PET) @@ -289,7 +289,7 @@ void Pet::SavePetToDB(PetSaveMode mode, bool logout) stmt->setUInt32(12, curhealth); stmt->setUInt32(13, curmana); stmt->setUInt32(14, GetPower(POWER_HAPPINESS)); - stmt->setUInt32(15, time(NULL)); + stmt->setUInt32(15, time(nullptr)); std::ostringstream ss; for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) @@ -373,7 +373,7 @@ void Pet::Update(uint32 diff) { case CORPSE: { - if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL)) + if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(nullptr)) { Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER! return; @@ -463,7 +463,7 @@ void Pet::Update(uint32 diff) CastSpell(tempspellTarget, tempspell, true); m_tempspell = 0; - m_tempspellTarget = NULL; + m_tempspellTarget = nullptr; if (tempspellIsPositive) { @@ -489,7 +489,7 @@ void Pet::Update(uint32 diff) GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle()); } - m_tempoldTarget = NULL; + m_tempoldTarget = nullptr; m_tempspellIsPositive = false; } } @@ -498,8 +498,8 @@ void Pet::Update(uint32 diff) else { m_tempspell = 0; - m_tempspellTarget = NULL; - m_tempoldTarget = NULL; + m_tempspellTarget = nullptr; + m_tempoldTarget = nullptr; m_tempspellIsPositive = false; Unit* victim = charmer->GetVictim(); @@ -1060,7 +1060,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) // xinef: fixes orc death knight command racial if (owner->getRace() == RACE_ORC) - CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, owner->GetGUID()); + CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, nullptr, nullptr, owner->GetGUID()); // Avoidance, Night of the Dead if (Aura *aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) @@ -1128,7 +1128,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result) if (result) { - time_t curTime = time(NULL); + time_t curTime = time(nullptr); PacketCooldowns cooldowns; WorldPacket data; @@ -1174,7 +1174,7 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) stmt->setUInt32(0, m_charmInfo->GetPetNumber()); trans->Append(stmt); - time_t curTime = time(NULL); + time_t curTime = time(nullptr); uint32 checkTime = World::GetGameTimeMS() + 30*IN_MILLISECONDS; // remove oudated and save active @@ -1587,7 +1587,7 @@ void Pet::InitLevelupSpellsForLevel() { uint8 level = getLevel(); - if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL) + if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : nullptr) { // PetLevelupSpellSet ordered by levels, process in reversed order for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr) @@ -2157,7 +2157,7 @@ void Pet::HandleAsynchLoadSucceed() // Warlock pet exception, check if owner is casting new summon spell if (Spell* spell = owner->GetCurrentSpell(CURRENT_GENERIC_SPELL)) if (spell->GetSpellInfo()->HasEffect(SPELL_EFFECT_SUMMON_PET)) - CastSpell(this, 32752, true, NULL, NULL, GetGUID()); + CastSpell(this, 32752, true, nullptr, nullptr, GetGUID()); if (owner->NeedSendSpectatorData() && GetCreatureTemplate()->family) @@ -2215,7 +2215,7 @@ void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 as pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); pet->SetFullHealth(); pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped in this case } map->AddToMap(pet->ToCreature(), true); @@ -2324,8 +2324,8 @@ void Pet::ClearCastWhenWillAvailable() { m_tempspellIsPositive = false; m_tempspell = 0; - m_tempspellTarget = NULL; - m_tempoldTarget = NULL; + m_tempspellTarget = nullptr; + m_tempoldTarget = nullptr; } void Pet::RemoveSpellCooldown(uint32 spell_id, bool update /* = false */) diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 46e42409a..c09d0650e 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -64,7 +64,7 @@ class Pet : public Guardian bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); static SpellCastResult TryLoadFromDB(Player* owner, bool current = false, PetType mandatoryPetType = MAX_PET_TYPE); - static bool LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry = 0, uint32 petnumber = 0, bool current = false, AsynchPetSummon* info = NULL); + static bool LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry = 0, uint32 petnumber = 0, bool current = false, AsynchPetSummon* info = nullptr); bool isBeingLoaded() const override { return m_loading;} void SavePetToDB(PetSaveMode mode, bool logout); void Remove(PetSaveMode mode, bool returnreagent = false); @@ -136,7 +136,7 @@ class Pet : public Guardian void InitPetCreateSpells(); bool resetTalents(); - static void resetTalentsForAllPetsOf(Player* owner, Pet* online_pet = NULL); + static void resetTalentsForAllPetsOf(Player* owner, Pet* online_pet = nullptr); void InitTalentForLevel(); uint8 GetMaxTalentPointsForLevel(uint8 level); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 91043ffe1..96c6ed5ab 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -302,7 +302,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(uint64 itemGuid) const @@ -325,7 +325,7 @@ TradeSlots TradeData::GetTradeSlotForItem(uint64 itemGuid) 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) @@ -450,7 +450,7 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/) KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) : // 1. Initialize internal variables to default values. _killer(killer), _victim(victim), _group(killer->GetGroup()), - _groupRate(1.0f), _maxNotGrayMember(NULL), _count(0), _sumLevel(0), _xp(0), + _groupRate(1.0f), _maxNotGrayMember(nullptr), _count(0), _sumLevel(0), _xp(0), _isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false) { // mark the credit as pvp if victim is player @@ -468,7 +468,7 @@ inline void KillRewarder::_InitGroupData() if (_group) { // 2. In case when player is in group, initialize variables necessary for group calculations: - for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = _group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) if ((_killer == member || member->IsAtGroupRewardDistance(_victim)) && member->IsAlive()) { @@ -619,7 +619,7 @@ void KillRewarder::_RewardGroup() } // 3.1.3. Reward each group member (even dead or corpse) within reward distance. - for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = _group->GetFirstMember(); itr != nullptr; itr = itr->next()) { if (Player* member = itr->GetSource()) { @@ -692,7 +692,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_ExtraFlags = 0; - m_spellModTakingSpell = NULL; + m_spellModTakingSpell = nullptr; //m_pad = 0; // players always accept @@ -729,15 +729,15 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT); - m_social = NULL; + m_social = nullptr; // group is initialized in the reference constructor - SetGroupInvite(NULL); + SetGroupInvite(nullptr); m_groupUpdateMask = 0; m_auraRaidUpdateMask = 0; m_bPassOnGroupLoot = false; - duel = NULL; + duel = nullptr; m_GuildIdInvited = 0; m_ArenaTeamIdInvited = 0; @@ -752,7 +752,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_bHasDelayedTeleport = false; teleportStore_options = 0; - m_trade = NULL; + m_trade = nullptr; m_cinematic = 0; @@ -777,7 +777,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j) m_bgBattlegroundQueueID[j] = BATTLEGROUND_QUEUE_NONE; - m_logintime = time(NULL); + m_logintime = time(nullptr); m_Last_tick = m_logintime; m_Played_time[PLAYED_TIME_TOTAL] = 0; m_Played_time[PLAYED_TIME_LEVEL] = 0; @@ -850,7 +850,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_spellPenetrationItemMod = 0; // Honor System - m_lastHonorUpdateTime = time(NULL); + m_lastHonorUpdateTime = time(nullptr); m_IsBGRandomWinner = false; @@ -880,11 +880,11 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_contestedPvPTimer = 0; - m_declinedname = NULL; + m_declinedname = nullptr; m_isActive = true; - m_runes = NULL; + m_runes = nullptr; m_lastFallTime = 0; m_lastFallZ = 0; @@ -942,7 +942,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) Player::~Player() { // it must be unloaded already in PlayerLogout and accessed only for loggined player - //m_social = NULL; + //m_social = nullptr; // Note: buy back item already deleted from DB when player was saved for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i) @@ -1013,7 +1013,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) } for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++) - m_items[i] = NULL; + m_items[i] = nullptr; Relocate(info->positionX, info->positionY, info->positionZ, info->orientation); @@ -1108,7 +1108,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) } // 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; @@ -1289,7 +1289,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type) bool Player::IsImmuneToEnvironmentalDamage() { // check for GM and death state included in isAttackableByAOE - return (!isTargetableForAttack(false, NULL)); + return (!isTargetableForAttack(false, nullptr)); } uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) @@ -1551,7 +1551,7 @@ void Player::Update(uint32 p_time) sScriptMgr->OnBeforePlayerUpdate(this, p_time); // undelivered mail - if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(NULL)) + if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(nullptr)) { SendNewMail(); ++unReadMails; @@ -1565,7 +1565,7 @@ void Player::Update(uint32 p_time) Unit::Update(p_time); SetMustDelayTeleport(false); - time_t now = time(NULL); + time_t now = time(nullptr); UpdatePvPFlag(now); @@ -1716,7 +1716,7 @@ void Player::Update(uint32 p_time) { if (now > m_Last_tick && _restTime > 0) // freeze update { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); time_t timeDiff = currTime - _restTime; if (timeDiff >= 10) // freeze update { @@ -1965,7 +1965,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/) void Player::SetRestState(uint32 triggerId) { _innTriggerId = triggerId; - _restTime = time(NULL); + _restTime = time(nullptr); SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); } @@ -2106,7 +2106,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) continue; } - SpellItemEnchantmentEntry const* enchant = NULL; + SpellItemEnchantmentEntry const* enchant = nullptr; uint32 enchants = GetUInt32ValueFromArray(equipment, visualBase + 1); for (uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot) @@ -2210,7 +2210,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (GetTransport()) { m_transport->RemovePassenger(this); - m_transport = NULL; + m_transport = nullptr; m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :) @@ -2255,7 +2255,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati else { m_transport->RemovePassenger(this); - m_transport = NULL; + m_transport = nullptr; m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -2281,7 +2281,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (MustDelayTeleport()) { SetHasDelayedTeleport(true); - SetSemaphoreTeleportNear(time(NULL)); + SetSemaphoreTeleportNear(time(nullptr)); //lets save teleport destination for player teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); teleportStore_options = options; @@ -2303,11 +2303,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // this will be used instead of the current location in SaveToDB teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); - SetFallInformation(time(NULL), z); + SetFallInformation(time(nullptr), z); // code for finish transfer called in WorldSession::HandleMovementOpcodes() // at client packet MSG_MOVE_TELEPORT_ACK - SetSemaphoreTeleportNear(time(NULL)); + SetSemaphoreTeleportNear(time(nullptr)); // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing if (!GetSession()->PlayerLogout()) { @@ -2324,7 +2324,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; // far teleport to another map - 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 @@ -2343,7 +2343,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (MustDelayTeleport()) { SetHasDelayedTeleport(true); - SetSemaphoreTeleportFar(time(NULL)); + SetSemaphoreTeleportFar(time(nullptr)); //lets save teleport destination for player teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); teleportStore_options = options; @@ -2410,7 +2410,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati } teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); - SetFallInformation(time(NULL), z); + SetFallInformation(time(nullptr), z); // if the player is saved before worldportack (at logout for example) // this will be used instead of the current location in SaveToDB @@ -2429,7 +2429,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // move packet sent by client always after far teleport // code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet - SetSemaphoreTeleportFar(time(NULL)); + SetSemaphoreTeleportFar(time(nullptr)); } } return true; @@ -2854,9 +2854,9 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver) switch (questGiver->GetTypeId()) { case TYPEID_UNIT: - return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != NULL; + return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != nullptr; case TYPEID_GAMEOBJECT: - return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != NULL; + return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != nullptr; case TYPEID_PLAYER: return IsAlive() && questGiver->ToPlayer()->IsAlive(); case TYPEID_ITEM: @@ -2871,38 +2871,38 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) { // unit checks if (!guid) - return NULL; + return nullptr; if (!IsInWorld()) - return NULL; + return nullptr; if (IsInFlight()) - return NULL; + return nullptr; // exist (we need look pets also for some interaction (quest/etc) Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (!creature) - return NULL; + return nullptr; // Deathstate checks if (!IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_GHOST_VISIBLE)) - return NULL; + return nullptr; // alive or spirit healer if (!creature->IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_INTERACT_WHILE_DEAD)) - return NULL; + return nullptr; // appropriate npc type if (npcflagmask && !creature->HasFlag(UNIT_NPC_FLAGS, npcflagmask)) - return NULL; + return nullptr; // not allow interaction under control, but allow with own pets if (creature->GetCharmerGUID()) - return NULL; + return nullptr; // xinef: perform better check if (creature->GetReactionTo(this) <= REP_UNFRIENDLY) - return NULL; + return nullptr; // xinef: not needed, CORRECTLY checked above including forced reputations etc // not unfriendly @@ -2910,16 +2910,16 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) // if (factionTemplate->faction) // if (FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction)) // if (faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY) - // return NULL; + // return nullptr; // not too far if (!creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) - return NULL; + return nullptr; // pussywizard: many npcs have missing conditions for class training and rogue trainer can for eg. train dual wield to a shaman :/ too many to change in sql and watch in the future // pussywizard: this function is not used when talking, but when already taking action (buy spell, reset talents, show spell list) if (npcflagmask & (UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS) && creature->GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS && getClass() != creature->GetCreatureTemplate()->trainer_class) - return NULL; + return nullptr; return creature; } @@ -2938,7 +2938,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes #endif } } - return NULL; + return nullptr; } bool Player::IsInWater(bool allowAbove) const @@ -3129,13 +3129,13 @@ void Player::UninviteFromGroup() if (group->IsCreated()) { group->Disband(true); - group = NULL; // gets deleted in disband + group = nullptr; // gets deleted in disband } else { group->RemoveAllInvites(); delete group; - group = NULL; + group = nullptr; } } } @@ -3145,7 +3145,7 @@ void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = if (group) { group->RemoveMember(guid, method, kicker, reason); - group = NULL; + group = nullptr; } } @@ -3636,7 +3636,7 @@ void Player::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) @@ -3653,7 +3653,7 @@ void Player::UpdateNextMailTimeAndUnreads() void Player::AddNewMailDeliverTime(time_t deliver_time) { - if (deliver_time <= time(NULL)) // ready now + if (deliver_time <= time(nullptr)) // ready now { ++unReadMails; SendNewMail(); @@ -4353,7 +4353,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (result) { - time_t curTime = time(NULL); + time_t curTime = time(nullptr); do { @@ -4389,7 +4389,7 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) stmt->setUInt32(0, GetGUIDLow()); trans->Append(stmt); - time_t curTime = time(NULL); + time_t curTime = time(nullptr); uint32 curMSTime = World::GetGameTimeMS(); uint32 infTime = curMSTime + infinityCooldownDelayCheck; @@ -4553,7 +4553,7 @@ bool Player::resetTalents(bool noResetCost) UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1); m_resetTalentsCost = resetCost; - m_resetTalentsTime = time(NULL); + m_resetTalentsTime = time(nullptr); } return true; @@ -4571,7 +4571,7 @@ Mail* Player::GetMail(uint32 id) if ((*itr)->messageID == id) return (*itr); - return NULL; + return nullptr; } void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const @@ -4580,7 +4580,7 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c { for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); @@ -4588,14 +4588,14 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c for (uint8 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 (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); @@ -4611,7 +4611,7 @@ void Player::DestroyForPlayer(Player* target, bool onDeath) const for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) // xinef: previously INVENTORY_SLOT_BAG_END { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->DestroyForPlayer(target); @@ -4621,14 +4621,14 @@ void Player::DestroyForPlayer(Player* target, bool onDeath) const { for (uint8 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 (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - if (m_items[i] == NULL) + if (m_items[i] == nullptr) continue; m_items[i]->DestroyForPlayer(target); @@ -4772,7 +4772,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // Remove signs from petitions (also remove petitions if owner); RemovePetitionsAndSigns(playerguid, 10); - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; switch (charDelete_method) { @@ -5094,7 +5094,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS); - stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY))); + stmt->setUInt32(0, uint32(time(nullptr) - time_t(keepDays * DAY))); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) @@ -5614,7 +5614,7 @@ void Player::RepopAtGraveyard() SpawnCorpseBones(); } - GraveyardStruct const* ClosestGrave = NULL; + GraveyardStruct const* ClosestGrave = nullptr; // Special handle for battleground maps if (Battleground* bg = GetBattleground()) @@ -5718,7 +5718,7 @@ void Player::UpdateLocalChannels(uint32 newZone) { if (ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(i)) { - Channel* usedChannel = NULL; + Channel* usedChannel = nullptr; for (JoinedChannelsList::iterator itr = m_channels.begin(); itr != m_channels.end(); ++itr) { @@ -5729,8 +5729,8 @@ void Player::UpdateLocalChannels(uint32 newZone) } } - Channel* removeChannel = NULL; - Channel* joinChannel = NULL; + Channel* removeChannel = nullptr; + Channel* joinChannel = nullptr; bool sendRemove = true; if (CanJoinConstantChannelInZone(channel, current_zone)) @@ -5759,7 +5759,7 @@ void Player::UpdateLocalChannels(uint32 newZone) sendRemove = false; // Do not send leave channel, it already replaced at client } else - joinChannel = NULL; + joinChannel = nullptr; } } else @@ -5865,7 +5865,7 @@ float Player::GetMeleeCritFromAgility() GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass-1); GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - if (critBase == NULL || critRatio == NULL) + if (critBase == NULL || critRatio == nullptr) return 0.0f; float crit = critBase->base + GetStat(STAT_AGILITY)*critRatio->ratio; @@ -5935,7 +5935,7 @@ float Player::GetSpellCritFromIntellect() GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass-1); GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - if (critBase == NULL || critRatio == NULL) + if (critBase == NULL || critRatio == nullptr) return 0.0f; float crit=critBase->base + GetStat(STAT_INTELLECT)*critRatio->ratio; @@ -5987,7 +5987,7 @@ float Player::OCTRegenHPPerSpirit() GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - if (baseRatio == NULL || moreRatio == NULL) + if (baseRatio == NULL || moreRatio == nullptr) return 0.0f; // Formula from PaperDollFrame script @@ -6010,7 +6010,7 @@ float Player::OCTRegenMPPerSpirit() // GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - if (moreRatio == NULL) + if (moreRatio == nullptr) return 0.0f; // Formula get from PaperDollFrame script @@ -6812,7 +6812,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) { if (!IsActionButtonDataValid(button, action, type)) - return NULL; + return nullptr; // it create new button (NEW state) if need or return existed ActionButton& ab = m_actionButtons[button]; @@ -6846,7 +6846,7 @@ ActionButton const* Player::GetActionButton(uint8 button) { ActionButtonList::iterator buttonItr = m_actionButtons.find(button); if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED) - return NULL; + return nullptr; return &buttonItr->second; } @@ -6991,7 +6991,7 @@ void Player::CheckAreaExploreAndOutdoor() XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level)*sWorld->getRate(RATE_XP_EXPLORE)); } - GiveXP(XP, NULL); + GiveXP(XP, nullptr); SendExplorationExperience(areaId, XP); } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -7215,8 +7215,8 @@ void Player::RewardReputation(Quest const* quest) void Player::UpdateHonorFields() { /// called when rewarding honor and at each save - time_t now = time_t(time(NULL)); - time_t today = time_t(time(NULL) / DAY) * DAY; + time_t now = time_t(time(nullptr)); + time_t today = time_t(time(nullptr) / DAY) * DAY; if (m_lastHonorUpdateTime < today) { @@ -7351,7 +7351,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar } } - if (uVictim != NULL) + if (uVictim != nullptr) { if (groupsize > 1) honor_f /= groupsize; @@ -7389,7 +7389,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping // Xinef: Only for BG activities if (!uVictim) - GiveXP(uint32(honor*(3+getLevel()*0.30f)), NULL); + GiveXP(uint32(honor*(3+getLevel()*0.30f)), nullptr); } if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE)) @@ -7903,9 +7903,9 @@ void Player::DuelComplete(DuelCompleteType type) duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0); delete duel->opponent->duel; - duel->opponent->duel = NULL; + duel->opponent->duel = nullptr; delete duel; - duel = NULL; + duel = nullptr; } //---------------------------------------------------------// @@ -7954,7 +7954,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply if (slot >= INVENTORY_SLOT_BAG_END || !proto) return; - ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL; + ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr; if (only_level_scale && !ssd) return; @@ -7963,7 +7963,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply if (ssd && ssd_level > ssd->MaxLevel) ssd_level = ssd->MaxLevel; - ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; + ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr; if (only_level_scale && !ssv) return; @@ -8659,7 +8659,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 if (!spellInfo) { sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); - SendEquipError(EQUIP_ERR_NONE, item, NULL); + SendEquipError(EQUIP_ERR_NONE, item, nullptr); return; } @@ -9022,7 +9022,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) // Xinef: loot was generated and respawntime has passed since then, allow to recreate loot // Xinef: to avoid bugs, this rule covers spawned gameobjects only - if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(NULL)) + if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(nullptr)) go->SetLootState(GO_READY); if (go->getLootState() == GO_READY) @@ -10067,7 +10067,7 @@ void Player::SendBattlefieldWorldStates() SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, wg->IsWarTime() ? 1 : 0); for (uint32 i = 0; i < 2; ++i) - SendUpdateWorldState(ClockWorldState[i], uint32(time(NULL) + (wg->GetTimer() / 1000))); + SendUpdateWorldState(ClockWorldState[i], uint32(time(nullptr) + (wg->GetTimer() / 1000))); } } } @@ -10151,24 +10151,24 @@ 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)); SetVirtualItemSlot(1, GetWeaponForAttack(OFF_ATTACK, 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)); 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... @@ -10506,7 +10506,7 @@ Item* Player::GetItemByGuid(uint64 guid) const if (pItem->GetGUID() == guid) return pItem; - return NULL; + return nullptr; } Item* Player::GetItemByPos(uint16 pos) const @@ -10522,7 +10522,7 @@ Item* Player::GetItemByPos(uint8 bag, uint8 slot) const return m_items[slot]; else if (Bag* pBag = GetBagByPos(bag)) return pBag->GetItemByPos(slot); - return NULL; + return nullptr; } Bag* Player::GetBagByPos(uint8 bag) const @@ -10531,7 +10531,7 @@ Bag* Player::GetBagByPos(uint8 bag) const || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)) if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, bag)) return item->ToBag(); - return NULL; + return nullptr; } Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable /*= false*/) const @@ -10542,41 +10542,41 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable /*= f case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break; case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break; case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break; - default: return NULL; + default: return nullptr; } - Item* item = NULL; + Item* item = nullptr; if (useable) item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, slot); else item = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (!item || item->GetTemplate()->Class != ITEM_CLASS_WEAPON) - return NULL; + return nullptr; if (!useable) return item; if (item->IsBroken() || IsInFeralForm()) - return NULL; + return nullptr; return item; } Item* Player::GetShield(bool useable) const { - Item* item = NULL; + Item* item = nullptr; if (useable) item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); else item = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (!item || item->GetTemplate()->Class != ITEM_CLASS_ARMOR) - return NULL; + return nullptr; if (!useable) return item; if (item->IsBroken()) - return NULL; + return nullptr; return item; } @@ -10953,7 +10953,7 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP // ignore move item (this slot will be empty at move) if (pItem2 == pSrcItem) - pItem2 = NULL; + pItem2 = nullptr; uint32 need_space; @@ -11056,10 +11056,10 @@ InventoryResult Player::CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, Ite // 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(); @@ -11107,10 +11107,10 @@ InventoryResult Player::CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 sl // 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(); @@ -12482,7 +12482,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; } @@ -12553,7 +12553,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; const ItemTemplate *proto = pItem->GetTemplate(); @@ -12588,7 +12588,7 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update) { if (!pItem) - return NULL; + return nullptr; uint8 bag = pos >> 8; uint8 slot = pos & 255; @@ -12607,7 +12607,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem->SetCount(count); if (!pItem) - return NULL; + return nullptr; if (pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM || @@ -12623,7 +12623,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); pItem->SetSlot(slot); - pItem->SetContainer(NULL); + pItem->SetContainer(nullptr); // need update known currency if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) @@ -12699,7 +12699,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) @@ -12876,7 +12876,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID()); pItem->SetUInt64Value(ITEM_FIELD_OWNER, GetGUID()); pItem->SetSlot(slot); - pItem->SetContainer(NULL); + pItem->SetContainer(nullptr); if (slot < EQUIPMENT_SLOT_END) SetVisibleItemSlot(slot, pItem); @@ -12939,11 +12939,11 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap) } } - m_items[slot] = NULL; + m_items[slot] = nullptr; SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); if (slot < EQUIPMENT_SLOT_END) - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); } else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); @@ -13079,10 +13079,10 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) UpdateExpertise(OFF_ATTACK); // equipment visual show - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); } - m_items[slot] = NULL; + m_items[slot] = nullptr; } else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); @@ -13383,7 +13383,7 @@ Item* Player::GetItemByEntry(uint32 entry) const if (pItem->GetEntry() == entry) return pItem; - return NULL; + return nullptr; } void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) @@ -13423,28 +13423,28 @@ 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->m_lootGenerated) // prevent split looting item (item { //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; } // not let split all items (can be only at cheating) if (pSrcItem->GetCount() == count) { - SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_COULDNT_SPLIT_ITEMS, pSrcItem, nullptr); return; } // not let split more existed items (can be only at cheating) if (pSrcItem->GetCount() < count) { - SendEquipError(EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, pSrcItem, nullptr); return; } @@ -13462,7 +13462,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; } @@ -13477,7 +13477,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; } @@ -13497,7 +13497,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; } @@ -13517,7 +13517,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; } @@ -13558,7 +13558,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (GetLootGUID() == pSrcItem->GetGUID()) // prevent swap looting item { //best error message found for attempting to swap while looting - SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL); + SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, nullptr); return; } @@ -13603,7 +13603,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (pDstItem->GetGUID() == GetLootGUID()) // prevent swap looting item { //best error message found for attempting to swap while looting - SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, NULL); + SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, nullptr); return; } @@ -13632,7 +13632,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; } @@ -13648,7 +13648,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; } @@ -13663,7 +13663,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; } @@ -13772,8 +13772,8 @@ void Player::SwapItem(uint16 src, uint16 dst) { if (Bag* dstBag = pDstItem->ToBag()) { - Bag* emptyBag = NULL; - Bag* fullBag = NULL; + Bag* emptyBag = nullptr; + Bag* fullBag = nullptr; if (srcBag->IsEmpty() && !IsBagPos(src)) { emptyBag = srcBag; @@ -13941,7 +13941,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) #endif m_items[slot] = pItem; - time_t base = time(NULL); + time_t base = time(nullptr); uint32 etime = uint32(base - m_logintime + (30 * 3600)); uint32 eslot = slot - BUYBACK_SLOT_START; @@ -13965,7 +13965,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) #endif if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; - return NULL; + return nullptr; } void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) @@ -13983,7 +13983,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) pItem->SetState(ITEM_REMOVED, this); } - m_items[slot] = NULL; + m_items[slot] = nullptr; uint32 eslot = slot - BUYBACK_SLOT_START; SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0); @@ -14083,9 +14083,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; } } @@ -15081,7 +15081,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men break; case GOSSIP_OPTION_SPIRITHEALER: if (isDead()) - source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, NULL, NULL, GetGUID()); + source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, nullptr, nullptr, GetGUID()); break; case GOSSIP_OPTION_QUESTGIVER: PrepareQuestMenu(guid); @@ -15102,8 +15102,8 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men { // Cast spells that teach dual spec // Both are also ImplicitTarget self and must be cast by player - CastSpell(this, 63680, true, NULL, NULL, GetGUID()); - CastSpell(this, 63624, true, NULL, NULL, GetGUID()); + CastSpell(this, 63680, true, nullptr, nullptr, GetGUID()); + CastSpell(this, 63624, true, nullptr, nullptr, GetGUID()); PrepareGossipMenu(source, menuItemData->GossipActionMenuId); SendPreparedGossip(source); @@ -15378,7 +15378,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) if (pGameObject) objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); else - return NULL; + return nullptr; } uint32 nextQuestID = quest->GetNextQuestInChain(); @@ -15388,7 +15388,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) return sObjectMgr->GetQuestTemplate(nextQuestID); } - return NULL; + return nullptr; } bool Player::CanSeeStartQuest(Quest const* quest) @@ -15435,7 +15435,7 @@ bool Player::CanAddQuest(Quest const* quest, bool msg) return true; else if (msg2 != EQUIP_ERR_OK) { - SendEquipError(msg2, NULL, NULL, srcitem); + SendEquipError(msg2, nullptr, nullptr, srcitem); return false; } } @@ -15561,7 +15561,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) GetItemCount(quest->RequiredItemId[i]) < quest->RequiredItemCount[i]) { if (msg) - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->RequiredItemId[i]); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr, quest->RequiredItemId[i]); return false; } } @@ -15641,7 +15641,7 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardChoiceItemId[reward], quest->RewardChoiceItemCount[reward]); if (res != EQUIP_ERR_OK) { - SendEquipError(res, NULL, NULL, quest->RewardChoiceItemId[reward]); + SendEquipError(res, nullptr, nullptr, quest->RewardChoiceItemId[reward]); return false; } } @@ -15656,7 +15656,7 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardItemId[i], quest->RewardItemIdCount[i]); if (res != EQUIP_ERR_OK) { - SendEquipError(res, NULL, NULL, quest->RewardItemId[i]); + SendEquipError(res, nullptr, nullptr, quest->RewardItemId[i]); return false; } } @@ -15719,7 +15719,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) AddTimedQuest(quest_id); questStatusData.Timer = timeAllowed * IN_MILLISECONDS; - qtime = static_cast(time(NULL)) + timeAllowed; + qtime = static_cast(time(nullptr)) + timeAllowed; } else questStatusData.Timer = 0; @@ -15913,7 +15913,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, int32 moneyRew = 0; if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) - GiveXP(XP, NULL); + GiveXP(XP, nullptr); else moneyRew = int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY)); @@ -16507,7 +16507,7 @@ bool Player::GiveQuestSourceItem(Quest const* quest) else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) return true; else - SendEquipError(msg, NULL, NULL, srcitem); + SendEquipError(msg, nullptr, nullptr, srcitem); return false; } @@ -16536,7 +16536,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg) if (res != EQUIP_ERR_OK) { if (msg) - SendEquipError(res, NULL, NULL, srcItemId); + SendEquipError(res, nullptr, nullptr, srcItemId); return false; } @@ -16887,7 +16887,7 @@ void Player::AreaExploredOrEventHappens(uint32 questId) if (questId) { uint16 log_slot = FindQuestSlot(questId); - QuestStatusData* q_status = NULL; + QuestStatusData* q_status = nullptr; if (log_slot < MAX_QUEST_LOG_SIZE) { q_status = &m_QuestStatus[questId]; @@ -16915,7 +16915,7 @@ void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject) { if (Group* group = GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); @@ -17034,7 +17034,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) } StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : NULL); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : nullptr); for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -17857,10 +17857,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); - SetVisibleItemSlot(slot, NULL); + SetVisibleItemSlot(slot, nullptr); delete m_items[slot]; - m_items[slot] = NULL; + m_items[slot] = nullptr; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -18001,7 +18001,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (!acore::IsValidMapCoord(x, y, z, o) || std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 75.0f) { - m_transport = NULL; + m_transport = nullptr; m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); RelocateToHomebind(); @@ -18112,7 +18112,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SaveRecallPosition(); - time_t now = time(NULL); + time_t now = time(nullptr); time_t logoutTime = time_t(fields[27].GetUInt32()); // since last logout (in seconds) @@ -18284,7 +18284,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt32Value(PLAYER_CHOSEN_TITLE, curTitle); // has to be called after last Relocate() in Player::LoadFromDB - SetFallInformation(time(NULL), GetPositionZ()); + SetFallInformation(time(nullptr), GetPositionZ()); _LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS)); @@ -18650,7 +18650,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) // Item is not in bag if (!bagGuid) { - item->SetContainer(NULL); + item->SetContainer(nullptr); item->SetSlot(slot); if (IsInventoryPos(INVENTORY_SLOT_BAG_0, slot)) @@ -18752,7 +18752,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields) { - Item* item = NULL; + Item* item = nullptr; uint32 itemGuid = fields[13].GetUInt32(); uint32 itemEntry = fields[14].GetUInt32(); if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry)) @@ -18761,7 +18761,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F item = NewItemOrBag(proto); if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry)) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; // Do not allow to have item limited to another map/zone in alive state if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) @@ -18874,7 +18874,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F Item::DeleteFromInventoryDB(trans, itemGuid); item->FSetState(ITEM_REMOVED); item->SaveToDB(trans); // it also deletes item object! - item = NULL; + item = nullptr; } } else @@ -18934,7 +18934,7 @@ void Player::_LoadMailedItems(Mail* mail) item->FSetState(ITEM_REMOVED); - SQLTransaction temp = SQLTransaction(NULL); + SQLTransaction temp = SQLTransaction(nullptr); item->SaveToDB(temp); // it also deletes item object ! continue; } @@ -18961,7 +18961,7 @@ void Player::_LoadMailAsynch(PreparedQueryResult result) { m_mail.clear(); uint32 prevMailID = 0; - Mail* m = NULL; + Mail* m = nullptr; if (result) { do @@ -19034,7 +19034,7 @@ void Player::_LoadMailAsynch(PreparedQueryResult result) item->FSetState(ITEM_REMOVED); - SQLTransaction temp = SQLTransaction(NULL); + SQLTransaction temp = SQLTransaction(nullptr); item->SaveToDB(temp); // it also deletes item object ! continue; } @@ -19420,7 +19420,7 @@ void Player::SendRaidInfo() size_t p_counter = data.wpos(); data << uint32(counter); // placeholder - time_t now = time(NULL); + time_t now = time(nullptr); for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { @@ -19754,7 +19754,7 @@ void Player::SaveGoldToDB(SQLTransaction& trans) void Player::_SaveActions(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();) { @@ -19860,7 +19860,7 @@ void Player::_SaveAuras(SQLTransaction& trans, bool logout) void Player::_SaveInventory(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; // force items in buyback slots to new state // and remove those that aren't already for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i) @@ -19936,7 +19936,7 @@ void Player::_SaveInventory(SQLTransaction& trans) if (item->GetState() != ITEM_REMOVED) { 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())) @@ -19999,7 +19999,7 @@ void Player::_SaveMail(SQLTransaction& trans) if (!m_mailsLoaded) return; - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) { @@ -20075,7 +20075,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) QuestStatusSaveMap::iterator saveItr; QuestStatusMap::iterator statusItr; - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; bool keepAbandoned = !(sWorld->GetCleaningFlags() & CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS); @@ -20247,7 +20247,7 @@ void Player::_SaveMonthlyQuestStatus(SQLTransaction& trans) void Player::_SaveSkills(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; // we don't need transactions here. for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();) { @@ -20303,7 +20303,7 @@ void Player::_SaveSkills(SQLTransaction& trans) void Player::_SaveSpells(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();) { @@ -20354,7 +20354,7 @@ void Player::_SaveStats(SQLTransaction& trans) if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE)) return; - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS); stmt->setUInt32(0, GetGUIDLow()); @@ -20420,7 +20420,7 @@ void Player::UpdateSpeakTime(uint32 specialMessageLimit) if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) return; - time_t current = time (NULL); + time_t current = time (nullptr); if (m_speakTime > current) { uint32 max_count = specialMessageLimit ? specialMessageLimit : sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT); @@ -20446,7 +20446,7 @@ void Player::UpdateSpeakTime(uint32 specialMessageLimit) bool Player::CanSpeak() const { - return GetSession()->m_muteTime <= time (NULL); + return GetSession()->m_muteTime <= time (nullptr); } /*********************************************************/ @@ -20766,12 +20766,12 @@ Pet* Player::GetPet() const if (uint64 pet_guid = GetPetGUID()) { if (!IS_PET_GUID(pet_guid)) - return NULL; + return nullptr; Pet* pet = ObjectAccessor::GetPet(*this, pet_guid); if (!pet) - return NULL; + return nullptr; if (IsInWorld() && pet) return pet; @@ -20781,7 +20781,7 @@ Pet* Player::GetPet() const //const_cast(this)->SetPetGUID(0); } - return NULL; + return nullptr; } void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) @@ -21453,11 +21453,11 @@ void Player::DropModCharge(SpellModifier* mod, Spell* spell) void Player::SetSpellModTakingSpell(Spell* spell, bool apply) { - if (apply && m_spellModTakingSpell != NULL) + if (apply && m_spellModTakingSpell != nullptr) { sLog->outMisc("Player::SetSpellModTakingSpell (A1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); return; - //ASSERT(m_spellModTakingSpell == NULL); + //ASSERT(m_spellModTakingSpell == nullptr); } else if (!apply) { @@ -21471,7 +21471,7 @@ void Player::SetSpellModTakingSpell(Spell* spell, bool apply) //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell); } - m_spellModTakingSpell = apply ? spell : NULL; + m_spellModTakingSpell = apply ? spell : nullptr; } // send Proficiency @@ -21690,7 +21690,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) { GetSession()->SendActivateTaxiReply(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -21745,7 +21745,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc prevnode = lastnode; } - // get mount model (in case non taximaster (npc == NULL) allow more wide lookup) + // get mount model (in case non taximaster (npc == nullptr) allow more wide lookup) // // Hack-Fix for Alliance not being able to use Acherus taxi. There is // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes @@ -21992,7 +21992,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c CanEquipNewItem(slot, uiDest, item, false); if (msg != EQUIP_ERR_OK) { - SendEquipError(msg, NULL, NULL, item); + SendEquipError(msg, nullptr, nullptr, item); return false; } @@ -22147,14 +22147,14 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 // honor points price if (GetHonorPoints() < (iece->reqhonorpoints * count)) { - SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL); + SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, nullptr); return false; } // arena points price if (GetArenaPoints() < (iece->reqarenapoints * count)) { - SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, NULL); + SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, nullptr); return false; } @@ -22163,7 +22163,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 { if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count))) { - SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL); + SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, nullptr); return false; } } @@ -22172,7 +22172,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating) { // probably not the proper equip err - SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL); + SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, nullptr); return false; } } @@ -22207,7 +22207,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 { if (pProto->BuyCount * count != 1) { - SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL); + SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, nullptr); return false; } if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false)) @@ -22215,7 +22215,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } else { - SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL); + SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr); return false; } @@ -22315,7 +22315,7 @@ void Player::UpdatePvPState(bool onlyFFA) else // in friendly area { if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) && pvpInfo.EndTimer == 0) - pvpInfo.EndTimer = time(NULL); // start toggle-off + pvpInfo.EndTimer = time(nullptr); // start toggle-off } } @@ -22328,7 +22328,7 @@ void Player::UpdatePvP(bool state, bool _override) } else { - pvpInfo.EndTimer = time(NULL); + pvpInfo.EndTimer = time(nullptr); SetPvP(state); } RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); @@ -22735,7 +22735,7 @@ void Player::LeaveBattleground(Battleground* bg) } // xinef: reset corpse reclaim time - m_deathExpireTime = time(NULL); + m_deathExpireTime = time(nullptr); // pussywizard: clear movement, because after porting player will move to arena cords GetMotionMaster()->MovementExpired(); @@ -23052,7 +23052,7 @@ bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/) else { if (sendError) - SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); + SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, nullptr); return false; } } @@ -23064,14 +23064,14 @@ Unit* Player::GetSelectedUnit() const { if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET)) return ObjectAccessor::GetUnit(*this, selectionGUID); - return NULL; + return nullptr; } Player* Player::GetSelectedPlayer() const { if (uint64 selectionGUID = GetUInt64Value(UNIT_FIELD_TARGET)) return ObjectAccessor::GetPlayer(*this, selectionGUID); - return NULL; + return nullptr; } void Player::SetSelection(uint64 guid) @@ -23154,7 +23154,7 @@ void Player::ClearComboPoints() void Player::SetGroup(Group* group, int8 subgroup) { - if (group == NULL) + if (group == nullptr) m_group.unlink(); else { @@ -23287,7 +23287,7 @@ void Player::SendInitialPacketsAfterAddToMap() } } else if (GetRaidDifficulty() != GetStoredRaidDifficulty()) - SendRaidDifficulty(GetGroup() != NULL); + SendRaidDifficulty(GetGroup() != nullptr); } void Player::SendUpdateToOutOfRangeGroupMembers() @@ -23389,7 +23389,7 @@ void Player::ApplyEquipCooldown(Item* pItem) // Don't replace longer cooldowns by equip cooldown if we have any. SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId); - if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(NULL) + 30) + if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(nullptr) + 30) continue; // xinef: dont apply eqiup cooldown for spells with this attribute @@ -23561,7 +23561,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id) if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) { SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx, quest_id); - m_lastDailyQuestTime = time(NULL); // last daily quest time + m_lastDailyQuestTime = time(nullptr); // last daily quest time m_DailyQuestChanged = true; break; } @@ -23569,7 +23569,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id) } else { m_DFQuests.insert(quest_id); - m_lastDailyQuestTime = time(NULL); + m_lastDailyQuestTime = time(nullptr); m_DailyQuestChanged = true; } } @@ -23642,10 +23642,10 @@ void Player::ResetMonthlyQuestStatus() Battleground* Player::GetBattleground(bool create) const { if (GetBattlegroundId() == 0) - return NULL; + return nullptr; Battleground* bg = sBattlegroundMgr->GetBattleground(GetBattlegroundId()); - return (create || (bg && bg->FindBgMap()) ? bg : NULL); + return (create || (bg && bg->FindBgMap()) ? bg : nullptr); } bool Player::InArena() const @@ -23827,7 +23827,7 @@ void Player::SummonIfPossible(bool agree, uint32 summoner_guid) } // expire and auto declined - if (m_summon_expire < time(NULL)) + if (m_summon_expire < time(nullptr)) return; // drop flag at summon @@ -24082,7 +24082,7 @@ bool Player::GetsRecruitAFriendBonus(bool forXP) { if (Group* group = this->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); if (!player || !player->IsInMap(this)) @@ -24130,7 +24130,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar // prepare data for near group iteration if (Group* group = GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); if (!player) @@ -24273,7 +24273,7 @@ void Player::SetMover(Unit* target) sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); } - m_mover->m_movedByPlayer = NULL; + m_mover->m_movedByPlayer = nullptr; m_mover = target; m_mover->m_movedByPlayer = this; } @@ -24311,7 +24311,7 @@ void Player::UpdateAreaDependentAuras(uint32 newArea) Unit::AuraMap& tAuras = controlled->GetOwnedAuras(); for (Unit::AuraMap::iterator auraIter = tAuras.begin(); auraIter != tAuras.end();) { - if (auraIter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, NULL) != SPELL_CAST_OK) + if (auraIter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, nullptr) != SPELL_CAST_OK) controlled->RemoveOwnedAura(auraIter); else ++auraIter; @@ -24349,7 +24349,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)) return 0; - time_t now = time(NULL); + time_t now = time(nullptr); // 0..2 full period // should be ceil(x)-1 but not floor(x) uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0; @@ -24364,7 +24364,7 @@ void Player::UpdateCorpseReclaimDelay() (!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))) return; - time_t now = time(NULL); + time_t now = time(nullptr); if (now < m_deathExpireTime) { @@ -24408,7 +24408,7 @@ int32 Player::CalculateCorpseReclaimDelay(bool load) } time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count]; - time_t now = time(NULL); + time_t now = time(nullptr); if (now >= expected_time) return -1; @@ -24432,12 +24432,12 @@ Player* Player::GetNextRandomRaidMember(float radius) { Group* group = GetGroup(); if (!group) - return NULL; + return nullptr; std::vector nearMembers; nearMembers.reserve(group->GetMembersCount()); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->GetSource(); @@ -24448,7 +24448,7 @@ Player* Player::GetNextRandomRaidMember(float radius) } if (nearMembers.empty()) - return NULL; + return nullptr; uint32 randTarget = urand(0, nearMembers.size()-1); return nearMembers[randTarget]; @@ -24480,7 +24480,7 @@ PartyResult Player::CanUninviteFromGroup() const return ERR_PARTY_LFG_BOOT_LOOT_ROLLS; // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. - for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference const* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) if (itr->GetSource() && itr->GetSource()->IsInMap(this) && itr->GetSource()->IsInCombat()) return ERR_PARTY_LFG_BOOT_IN_COMBAT; @@ -24542,12 +24542,12 @@ void Player::RemoveFromBattlegroundOrBattlefieldRaid() 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 { @@ -24576,7 +24576,7 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) if (_lastLiquid && _lastLiquid->SpellId) RemoveAurasDueToSpell(_lastLiquid->SpellId); - _lastLiquid = NULL; + _lastLiquid = nullptr; return; } @@ -24602,7 +24602,7 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) else if (_lastLiquid && _lastLiquid->SpellId) { RemoveAurasDueToSpell(_lastLiquid->SpellId); - _lastLiquid = NULL; + _lastLiquid = nullptr; } @@ -24737,7 +24737,7 @@ WorldObject* Player::GetViewpoint() const { if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT)) return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER); - return NULL; + return nullptr; } bool Player::CanUseBattlegroundObject(GameObject* gameobject) const @@ -25069,7 +25069,7 @@ void Player::RemoveRunesByAuraEffect(AuraEffect const* aura) if (m_runes->runes[i].ConvertAura == aura) { ConvertRune(i, GetBaseRune(i)); - SetRuneConvertAura(i, NULL); + SetRuneConvertAura(i, nullptr); } } } @@ -25081,7 +25081,7 @@ void Player::RestoreBaseRune(uint8 index) if (aura && !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_PASSIVE)) return; ConvertRune(index, GetBaseRune(index)); - SetRuneConvertAura(index, NULL); + SetRuneConvertAura(index, nullptr); // Don't drop passive talents providing rune convertion if (!aura || aura->GetAuraType() != SPELL_AURA_CONVERT_RUNE) return; @@ -25148,7 +25148,7 @@ void Player::InitRunes() SetCurrentRune(i, runeSlotTypes[i]); // init current types SetRuneCooldown(i, 0); // reset cooldowns SetGracePeriod(i, 0); // xinef: reset grace period - SetRuneConvertAura(i, NULL); + SetRuneConvertAura(i, nullptr); m_runes->SetRuneState(i); } @@ -25183,7 +25183,7 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons 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; } @@ -25194,22 +25194,22 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons void Player::StoreLootItem(uint8 lootSlot, Loot* loot) { - QuestItem* qitem = NULL; - QuestItem* ffaitem = NULL; - QuestItem* conditem = NULL; + QuestItem* qitem = nullptr; + QuestItem* ffaitem = nullptr; + QuestItem* conditem = nullptr; LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem); if (!item) { - SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, NULL); + SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, nullptr); return; } // Xinef: exploit protection, dont allow to loot normal items if player is not master loot // Xinef: only quest, ffa and conditioned items if (!IS_ITEM_GUID(GetLootGUID()) && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid()) - if (qitem == NULL && ffaitem == NULL && conditem == NULL) + if (qitem == NULL && ffaitem == NULL && conditem == nullptr) { SendLootRelease(GetLootGUID()); return; @@ -25287,7 +25287,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID()); } else - SendEquipError(msg, NULL, NULL, item->itemid); + SendEquipError(msg, nullptr, nullptr, item->itemid); } void Player::UpdateLootAchievements(LootItem *item, Loot* loot) @@ -26190,7 +26190,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans) { uint32 index = itr->first; EquipmentSet& eqset = itr->second; - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; uint8 j = 0; switch (eqset.state) { @@ -26326,7 +26326,7 @@ void Player::SetMap(Map* map) void Player::_SaveCharacter(bool create, SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; uint8 index = 0; if (create) @@ -26374,7 +26374,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans) stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]); stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]); stmt->setFloat(index++, finiteAlways(_restBonus)); - stmt->setUInt32(index++, uint32(time(NULL))); + stmt->setUInt32(index++, uint32(time(nullptr))); stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0)); //save, far from tavern/city //save, but in tavern/city @@ -26506,7 +26506,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans) stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]); stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]); stmt->setFloat(index++, finiteAlways(_restBonus)); - stmt->setUInt32(index++, uint32(time(NULL))); + stmt->setUInt32(index++, uint32(time(nullptr))); stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0)); //save, far from tavern/city //save, but in tavern/city @@ -26656,7 +26656,7 @@ void Player::_LoadTalents(PreparedQueryResult result) void Player::_SaveTalents(SQLTransaction& trans) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end();) { @@ -26709,7 +26709,7 @@ void Player::UpdateSpecCount(uint8 count) ActivateSpec(0); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; // Copy spec data if (count > curCount) @@ -27407,7 +27407,7 @@ void Player::_LoadBrewOfTheMonth(PreparedQueryResult result) lastEventId = fields[0].GetUInt32(); } - time_t curtime = time(NULL); + time_t curtime = time(nullptr); tm localTime; ACE_OS::localtime_r(&curtime, &localTime); @@ -27490,7 +27490,7 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/) return false; if (!apply) - SetFallInformation(time(NULL), GetPositionZ()); + SetFallInformation(time(nullptr), GetPositionZ()); WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); data.append(GetPackGUID()); @@ -27562,7 +27562,7 @@ bool Player::SetFeatherFall(bool apply, bool packetOnly /*= false*/) Guild* Player::GetGuild() const { uint32 guildId = GetGuildId(); - return guildId ? sGuildMgr->GetGuildById(guildId) : NULL; + return guildId ? sGuildMgr->GetGuildById(guildId) : nullptr; } void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration, uint32 createdBySpell, uint64 casterGUID, uint8 asynchLoadType) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b1442bbef..a40335595 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -143,7 +143,7 @@ enum TalentTree // talent tabs // Spell modifier (used for modify other spells) struct SpellModifier { - SpellModifier(Aura* _ownerAura = NULL) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {} + SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {} SpellModOp op : 8; SpellModType type : 8; int16 charges : 16; @@ -257,7 +257,7 @@ struct PlayerClassLevelInfo struct PlayerClassInfo { - PlayerClassInfo() : levelInfo(NULL) { } + PlayerClassInfo() : levelInfo(nullptr) { } PlayerClassLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 }; @@ -286,7 +286,7 @@ typedef std::list PlayerCreateInfoActions; struct PlayerInfo { // existence checked by displayId != 0 - PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(NULL) { } + PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { } uint32 mapId; uint32 areaId; @@ -316,7 +316,7 @@ struct PvPInfo struct DuelInfo { - DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0), isMounted(false) {} + DuelInfo() : initiator(nullptr), opponent(nullptr), startTimer(0), startTime(0), outOfBound(0), isMounted(false) {} Player* initiator; Player* opponent; @@ -380,7 +380,7 @@ struct Runes struct EnchantDuration { - EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {}; + EnchantDuration() : item(nullptr), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {}; EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration){ ASSERT(item); }; @@ -1065,7 +1065,7 @@ class TradeData void SetItem(TradeSlots slot, Item* item); uint32 GetSpell() const { return m_spell; } - void SetSpell(uint32 spell_id, Item* castItem = NULL); + void SetSpell(uint32 spell_id, Item* castItem = nullptr); Item* GetSpellCastItem() const; bool HasSpellCastItem() const { return m_spellCastItem != 0; } @@ -1161,14 +1161,14 @@ class Player : public Unit, public GridObject void SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay = 0, bool asSpectator = false) { - m_summon_expire = time(NULL) + (delay ? delay : MAX_PLAYER_SUMMON_DELAY); + m_summon_expire = time(nullptr) + (delay ? delay : MAX_PLAYER_SUMMON_DELAY); m_summon_mapid = mapid; m_summon_x = x; m_summon_y = y; m_summon_z = z; m_summon_asSpectator = asSpectator; } - bool IsSummonAsSpectator() const { return m_summon_asSpectator && m_summon_expire >= time(NULL); } + bool IsSummonAsSpectator() const { return m_summon_asSpectator && m_summon_expire >= time(nullptr); } void SetSummonAsSpectator(bool on) { m_summon_asSpectator = on; } void SummonIfPossible(bool agree, uint32 summoner_guid); time_t GetSummonExpireTimer() const { return m_summon_expire; } @@ -1271,8 +1271,8 @@ class Player : public Unit, public GridObject void SetVirtualItemSlot(uint8 i, Item* item); void SetSheath(SheathState sheathed) override; // overwrite Unit version uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const; - uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const; - uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const; + uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const; + uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const; Item* GetItemByGuid(uint64 guid) const; Item* GetItemByEntry(uint32 entry) const; Item* GetItemByPos(uint16 pos) const; @@ -1281,7 +1281,7 @@ class Player : public Unit, public GridObject inline Item* GetUseableItemByPos(uint8 bag, uint8 slot) const //Does additional check for disarmed weapons { if (!CanUseAttackType(GetAttackBySlot(slot))) - return NULL; + return nullptr; return GetItemByPos(bag, slot); } Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const; @@ -1300,13 +1300,13 @@ class Player : public Unit, public GridObject uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); } void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); } bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const; - bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL) const; + bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const; bool CanNoReagentCast(SpellInfo const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); } - InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, NULL); } - InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const + InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, nullptr); } + InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const { return CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count); } @@ -1315,7 +1315,7 @@ class Player : public Unit, public GridObject if (!pItem) return EQUIP_ERR_ITEM_NOT_FOUND; uint32 count = pItem->GetCount(); - return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL); + return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, nullptr); } InventoryResult CanStoreItems(Item** pItem, int32 count) const; InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const; @@ -1345,8 +1345,8 @@ class Player : public Unit, public GridObject void UpdateLootAchievements(LootItem *item, Loot* loot); void UpdateTitansGrip(); - InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; - InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; + InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr) const; + InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = nullptr) const; void AddRefundReference(uint32 it); void DeleteRefundReference(uint32 it); @@ -1400,7 +1400,7 @@ class Player : public Unit, public GridObject float GetReputationPriceDiscount(Creature const* creature) const; - Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : NULL; } + Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; } TradeData* GetTradeData() const { return m_trade; } void TradeCancel(bool sendback); @@ -1456,7 +1456,7 @@ class Player : public Unit, public GridObject bool CanSeeStartQuest(Quest const* quest); bool CanTakeQuest(Quest const* quest, bool msg); bool CanAddQuest(Quest const* quest, bool msg); - bool CanCompleteQuest(uint32 quest_id, const QuestStatusData* q_savedStatus = NULL); + bool CanCompleteQuest(uint32 quest_id, const QuestStatusData* q_savedStatus = nullptr); bool CanCompleteRepeatableQuest(Quest const* quest); bool CanRewardQuest(Quest const* quest, bool msg); bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg); @@ -1692,7 +1692,7 @@ class Player : public Unit, public GridObject 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) @@ -1793,12 +1793,12 @@ class Player : public Unit, public GridObject SpellCooldowns & GetSpellCooldownMap() { return m_spellCooldowns; } void AddSpellMod(SpellModifier* mod, bool apply); - bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = NULL); + bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr); bool HasSpellMod(SpellModifier* mod, Spell* spell); template T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL, bool temporaryPet = false); void RemoveSpellMods(Spell* spell); - void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL); - void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = NULL); + void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr); + void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr); void DropModCharge(SpellModifier* mod, Spell* spell); void SetSpellModTakingSpell(Spell* spell, bool apply); @@ -1911,7 +1911,7 @@ class Player : public Unit, public GridObject bool IsInSameGroupWith(Player const* p) const; bool IsInSameRaidWith(Player const* p) const { return p == this || (GetGroup() != NULL && GetGroup() == p->GetGroup()); } void UninviteFromGroup(); - static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL); + static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = nullptr); void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); } void SendUpdateToOutOfRangeGroupMembers(); @@ -2055,7 +2055,7 @@ class Player : public Unit, public GridObject void UpdateUnderwaterState(Map* m, float x, float y, float z) override; void SendMessageToSet(WorldPacket* data, bool self) override { SendMessageToSetInRange(data, GetVisibilityRange(), self, true); } // pussywizard! - void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool includeMargin = false, Player const* skipped_rcvr = NULL) override; // pussywizard! + void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool includeMargin = false, Player const* skipped_rcvr = nullptr) override; // pussywizard! void SendMessageToSetInRange_OwnTeam(WorldPacket* data, float dist, bool self); // pussywizard! param includeMargin not needed here void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) override { SendMessageToSetInRange(data, GetVisibilityRange(), skipped_rcvr != this, true, skipped_rcvr); } // pussywizard! @@ -2167,8 +2167,8 @@ class Player : public Unit, public GridObject bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool awardXP = true); uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); } uint32 GetArenaPoints() const { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); } - void ModifyHonorPoints(int32 value, SQLTransaction* trans = NULL); //! If trans is specified, honor save query will be added to trans - void ModifyArenaPoints(int32 value, SQLTransaction* trans = NULL); //! If trans is specified, arena point save query will be added to trans + void ModifyHonorPoints(int32 value, SQLTransaction* trans = nullptr); //! If trans is specified, honor save query will be added to trans + void ModifyArenaPoints(int32 value, SQLTransaction* trans = nullptr); //! If trans is specified, arena point save query will be added to trans uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const; void SetHonorPoints(uint32 value); void SetArenaPoints(uint32 value); @@ -2328,7 +2328,7 @@ class Player : public Unit, public GridObject TeamId GetBgTeamId() const { return m_bgData.bgTeamId != TEAM_NEUTRAL ? m_bgData.bgTeamId : GetTeamId(); } - void LeaveBattleground(Battleground* bg = NULL); + void LeaveBattleground(Battleground* bg = nullptr); bool CanJoinToBattleground() const; bool CanReportAfkDueToLimit(); void ReportedAfkBy(Player* reporter); @@ -2555,7 +2555,7 @@ class Player : public Unit, public GridObject void ResetAchievements(); void CheckAllAchievementCriteria(); void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete = false); - void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL); + void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr); void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0); void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); void CompletedAchievement(AchievementEntry const* entry); diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index b01079723..ecb33d87c 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -131,7 +131,7 @@ void Totem::UnSummon(uint32 msTime) if (Group* group = player->GetGroup()) { - 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 && target->IsInMap(player) && group->SameSubGroup(player, target)) diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index ea17fc906..40729c3d3 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -21,7 +21,7 @@ #include "WorldModel.h" #include "Spell.h" -MotionTransport::MotionTransport() : Transport(), _transportInfo(NULL), _isMoving(true), _pendingStop(false), _triggeredArrivalEvent(false), _triggeredDepartureEvent(false), _passengersLoaded(false), _delayedTeleport(false) +MotionTransport::MotionTransport() : Transport(), _transportInfo(nullptr), _isMoving(true), _pendingStop(false), _triggeredArrivalEvent(false), _triggeredDepartureEvent(false), _passengersLoaded(false), _delayedTeleport(false) { m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION; } @@ -102,7 +102,7 @@ void MotionTransport::CleanupsBeforeDelete(bool finalCleanup /*= true*/) { WorldObject* obj = *_passengers.begin(); RemovePassenger(obj); - obj->SetTransport(NULL); + obj->SetTransport(nullptr); obj->m_movementInfo.transport.Reset(); obj->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -281,12 +281,12 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll) if (Player* plr = passenger->ToPlayer()) { sScriptMgr->OnRemovePassenger(ToTransport(), plr); - plr->SetFallInformation(time(NULL), plr->GetPositionZ()); + plr->SetFallInformation(time(nullptr), plr->GetPositionZ()); } if (withAll) { - passenger->SetTransport(NULL); + passenger->SetTransport(nullptr); passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; passenger->m_movementInfo.transport.guid = 0; passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); @@ -302,7 +302,7 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d if (!creature->LoadCreatureFromDB(guid, map, false)) { delete creature; - return NULL; + return nullptr; } float x = data->posX; @@ -327,13 +327,13 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d { sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY()); delete creature; - return NULL; + return nullptr; } if (!map->AddToMap(creature)) { delete creature; - return NULL; + return nullptr; } _staticPassengers.insert(creature); @@ -350,7 +350,7 @@ GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const if (!go->LoadGameObjectFromDB(guid, map, false)) { delete go; - return NULL; + return nullptr; } float x = data->posX; @@ -368,13 +368,13 @@ GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const { sLog->outError("GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY()); delete go; - return NULL; + return nullptr; } if (!map->AddToMap(go)) { delete go; - return NULL; + return nullptr; } _staticPassengers.insert(go); @@ -754,7 +754,7 @@ void StaticTransport::CleanupsBeforeDelete(bool finalCleanup /*= true*/) { WorldObject* obj = *_passengers.begin(); RemovePassenger(obj); - obj->SetTransport(NULL); + obj->SetTransport(nullptr); obj->m_movementInfo.transport.Reset(); obj->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -829,7 +829,7 @@ void StaticTransport::Update(uint32 diff) void StaticTransport::RelocateToProgress(uint32 progress) { - TransportAnimationEntry const *curr = NULL, *next = NULL; + TransportAnimationEntry const *curr = NULL, *next = nullptr; float percPos; if (m_goValue.Transport.AnimationInfo->GetAnimNode(progress, curr, next, percPos)) { @@ -955,12 +955,12 @@ void StaticTransport::RemovePassenger(WorldObject* passenger, bool withAll) if (Player* plr = passenger->ToPlayer()) { sScriptMgr->OnRemovePassenger(ToTransport(), plr); - plr->SetFallInformation(time(NULL), plr->GetPositionZ()); + plr->SetFallInformation(time(nullptr), plr->GetPositionZ()); } if (withAll) { - passenger->SetTransport(NULL); + passenger->SetTransport(nullptr); passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; passenger->m_movementInfo.transport.guid = 0; passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 92b6c428b..4900a72a1 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -18,8 +18,8 @@ class Transport : public GameObject, public TransportBase { public: Transport() : GameObject() {} - void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const { TransportBase::CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } - void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const { TransportBase::CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } + void CalculatePassengerPosition(float& x, float& y, float& z, float* o = nullptr) const { TransportBase::CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } + void CalculatePassengerOffset(float& x, float& y, float& z, float* o = nullptr) const { TransportBase::CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } typedef std::set PassengerSet; virtual void AddPassenger(WorldObject* passenger, bool withAll = false) = 0; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0b7837326..410559756 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -106,7 +106,7 @@ m_damageType(_damageType), m_attackType(BASE_ATTACK) m_block = 0; } DamageInfo::DamageInfo(CalcDamageInfo& dmgInfo) -: m_attacker(dmgInfo.attacker), m_victim(dmgInfo.target), m_damage(dmgInfo.damage), m_spellInfo(NULL), m_schoolMask(SpellSchoolMask(dmgInfo.damageSchoolMask)), +: m_attacker(dmgInfo.attacker), m_victim(dmgInfo.target), m_damage(dmgInfo.damage), m_spellInfo(nullptr), m_schoolMask(SpellSchoolMask(dmgInfo.damageSchoolMask)), m_damageType(DIRECT_DAMAGE), m_attackType(dmgInfo.attackType) { m_absorb = 0; @@ -153,9 +153,9 @@ _hitMask(hitMask), _damageInfo(damageInfo), _healInfo(healInfo), _triggeredByAur #pragma warning(disable:4355) #endif Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject), -m_movedByPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), -m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), i_disabledAI(NULL), m_realRace(0), m_race(0), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0), -i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) +m_movedByPlayer(nullptr), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), +m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(nullptr), i_disabledAI(nullptr), m_realRace(0), m_race(0), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0), +i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_vehicle(nullptr), m_vehicleKit(nullptr), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -182,7 +182,7 @@ i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_deathState = ALIVE; for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) - m_currentSpells[i] = NULL; + m_currentSpells[i] = nullptr; for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i) m_SummonSlot[i] = 0; @@ -218,7 +218,7 @@ i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), for (uint8 i = 0; i < MAX_STATS; ++i) m_createStats[i] = 0.0f; - m_attacking = NULL; + m_attacking = nullptr; m_modMeleeHitChance = 0.0f; m_modRangedHitChance = 0.0f; m_modSpellHitChance = 0.0f; @@ -233,7 +233,7 @@ i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) m_speed_rate[i] = 1.0f; - m_charmInfo = NULL; + m_charmInfo = nullptr; _redirectThreatInfo = RedirectThreatInfo(); @@ -268,7 +268,7 @@ i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_applyResilience = false; _instantCast = false; - _lastLiquid = NULL; + _lastLiquid = nullptr; _oldFactionId = 0; } @@ -300,7 +300,7 @@ Unit::~Unit() if (m_currentSpells[i]) { m_currentSpells[i]->SetReferencedFromCurrent(false); - m_currentSpells[i] = NULL; + m_currentSpells[i] = nullptr; } _DeleteRemovedAuras(); @@ -653,7 +653,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->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction return ( HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE, excludeAura) @@ -677,7 +677,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage { // Xinef: initialize damage done for rage calculations // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0 - uint32 rage_damage = damage + ((cleanDamage != NULL) ? cleanDamage->absorbed_damage : 0); + uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0); //if (attacker) { @@ -1235,7 +1235,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) return; SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID); - if (spellProto == NULL) + if (spellProto == nullptr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_UNITS, "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID); @@ -1565,7 +1565,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that - Unit::DealDamageMods(this, damage, NULL); + Unit::DealDamageMods(this, damage, nullptr); // TODO: Move this to a packet handler WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8+8+4+4+4+4)); @@ -1992,7 +1992,7 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school // create procs createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); - caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); + caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, nullptr); if (attacker) attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted+splitted_absorb, schoolMask, splitted_absorb, 0, false, 0, false); @@ -2060,7 +2060,7 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school // create procs createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); - caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); + caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, nullptr); if (attacker) attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo->Id, splitted+splitted_absorb, splitSchoolMask, splitted_absorb, 0, false, 0, false); @@ -3151,7 +3151,7 @@ void Unit::_UpdateSpells(uint32 time) if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED) { m_currentSpells[i]->SetReferencedFromCurrent(false); - m_currentSpells[i] = NULL; // remove pointer + m_currentSpells[i] = nullptr; // remove pointer } } @@ -3332,7 +3332,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi if (spell->getState() != SPELL_STATE_FINISHED) spell->cancel(bySelf); - m_currentSpells[spellType] = NULL; + m_currentSpells[spellType] = nullptr; spell->SetReferencedFromCurrent(false); } } @@ -3399,7 +3399,7 @@ Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id == spell_id) return m_currentSpells[i]; - return NULL; + return nullptr; } int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const @@ -3541,7 +3541,7 @@ void Unit::UpdateEnvironmentIfNeeded(const uint8 option) RemoveAurasDueToSpell(_lastLiquid->SpellId); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - _lastLiquid = NULL; + _lastLiquid = nullptr; } else if (uint32 liqEntry = liquidData.entry) { @@ -3567,7 +3567,7 @@ void Unit::UpdateEnvironmentIfNeeded(const uint8 option) { RemoveAurasDueToSpell(_lastLiquid->SpellId); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - _lastLiquid = NULL; + _lastLiquid = nullptr; } } } @@ -3760,7 +3760,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 // Xinef: Hax for mixology, best solution qq if (sSpellMgr->GetSpellGroup(newAura->Id) == 1) - return NULL; + return nullptr; // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times if (!newAura->IsMultiSlotAura()) @@ -3777,7 +3777,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 // extremely rare case // let's just recreate aura if (effMask != foundAura->GetEffectMask()) - return NULL; + return nullptr; // update basepoints with new values - effect amount will be recalculated in ModStackAmount for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -3808,7 +3808,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 } } - return NULL; + return nullptr; } void Unit::_AddAura(UnitAura* aura, Unit* caster) @@ -3866,7 +3866,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask) // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) // Xinef: Added IsAllowingDeadTarget check if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading())) - return NULL; + return nullptr; Unit* caster = aura->GetCaster(); @@ -4162,7 +4162,7 @@ Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUI return itr->second; } } - return NULL; + return nullptr; } void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode) @@ -4829,7 +4829,7 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) c return itr->second->GetBase()->GetEffect(effIndex); } } - return NULL; + return nullptr; } AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 caster) const @@ -4841,7 +4841,7 @@ AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uin return aurEff; rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell); } - return NULL; + return nullptr; } AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const @@ -4855,7 +4855,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico if (spell->SpellIconID == iconId && spell->SpellFamilyName == name) return *itr; } - return NULL; + return nullptr; } AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID) const @@ -4871,7 +4871,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 f return (*i); } } - return NULL; + return nullptr; } AuraEffect* Unit::GetAuraEffectDummy(uint32 spellid) const @@ -4883,7 +4883,7 @@ AuraEffect* Unit::GetAuraEffectDummy(uint32 spellid) const return *itr; } - return NULL; + return nullptr; } AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const @@ -4902,13 +4902,13 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui return app; } } - return NULL; + return nullptr; } Aura* Unit::GetAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const { AuraApplication * aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask); - return aurApp ? aurApp->GetBase() : NULL; + return aurApp ? aurApp->GetBase() : nullptr; } AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const @@ -4920,13 +4920,13 @@ AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 c return aurApp; rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell); } - return NULL; + return nullptr; } Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask) const { AuraApplication * aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask); - return aurApp ? aurApp->GetBase() : NULL; + return aurApp ? aurApp->GetBase() : nullptr; } void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList) @@ -5103,7 +5103,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const if ((*i)->IsAffectedOnSpell(spell)) return (*i); } - return NULL; + return nullptr; } uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, uint8 mode) @@ -5142,7 +5142,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, uint8 mode) { Aura* aura = (*i)->GetBase(); if (aura && !aura->IsRemoved() && aura->GetDuration() > 0) - if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (time(NULL) + aura->GetDuration()/1000)) + if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (time(nullptr) + aura->GetDuration()/1000)) aura->SetDuration(aura->GetDuration()+3000); } } @@ -5416,14 +5416,14 @@ void Unit::_UnregisterDynObject(DynamicObject* dynObj) DynamicObject* Unit::GetDynObject(uint32 spellId) { if (m_dynObj.empty()) - return NULL; + return nullptr; for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end();++i) { DynamicObject* dynObj = *i; if (dynObj->GetSpellId() == spellId) return dynObj; } - return NULL; + return nullptr; } void Unit::RemoveDynObject(uint32 spellId) @@ -5456,7 +5456,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const if (go->GetSpellId() == spellId) return go; - return NULL; + return nullptr; } void Unit::AddGameObject(GameObject* gameObj) @@ -5796,7 +5796,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere int32 triggerAmount = triggeredByAura->GetAmount(); Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER - ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL; + ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; uint32 triggered_spell_id = 0; uint32 cooldown_spell_id = 0; // for random trigger, will be one of the triggered spell to avoid repeatable triggers @@ -6162,7 +6162,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 67534: { const int32 dmg = (int32)damage; - CastCustomSpell(this, 67535, &dmg, NULL, NULL, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID()); + CastCustomSpell(this, 67535, &dmg, nullptr, nullptr, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID()); return true; } // Trial of the Crusader, Faction Champions, Retaliation @@ -6463,10 +6463,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (target) { // regen mana for pet - CastCustomSpell(target, 54607, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); + CastCustomSpell(target, 54607, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura); } // regen mana for caster - CastCustomSpell(this, 59117, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); + CastCustomSpell(this, 59117, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura); // Get second aura of spell for replenishment effect on party if (AuraEffect const* aurEff = (*i)->GetBase()->GetEffect(EFFECT_1)) { @@ -6824,7 +6824,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID())) if (Aura* aur = aurEff->GetBase()) if (!aur->IsRemoved() && aur->GetDuration() > 0) - if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (time(NULL) + aur->GetDuration()/1000) ) + if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (time(nullptr) + aur->GetDuration()/1000) ) { aur->SetDuration(aur->GetDuration()+2000); return true; @@ -6963,13 +6963,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!victim) return false; - victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID()); + victim->CastSpell(victim, 57894, true, nullptr, nullptr, GetGUID()); return true; } // Glyph of Freezing Trap case 56845: { - victim->CastSpell(this, 61394, true, NULL, NULL, victim->GetGUID()); + victim->CastSpell(this, 61394, true, nullptr, nullptr, victim->GetGUID()); return true; } } @@ -6990,7 +6990,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere basepoints0 = int32(damage); triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654; - victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID()); + victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura, victim->GetGUID()); return true; } // Judgements of the Wise @@ -7044,7 +7044,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // 2% of base mana basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2)); - victim->CastCustomSpell(victim, 20268, &basepoints0, NULL, NULL, true, 0, triggeredByAura); + victim->CastCustomSpell(victim, 20268, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura); victim->AddSpellCooldown(20268, 0, 4*IN_MILLISECONDS); return true; } @@ -7389,7 +7389,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Attack Twice for (uint32 i = 0; i < 2; ++i) - CastCustomSpell(victim, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); + CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura); return true; } @@ -7445,7 +7445,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere basepoints0 = CalculatePct(int32(damage), triggerAmount); triggered_spell_id = 58879; // Heal wolf - CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); + CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster); break; } // Shaman T8 Elemental 4P Bonus @@ -7559,7 +7559,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere else return false; - CastCustomSpell(victim, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); + CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura); return true; } // Improved Water Shield @@ -7753,8 +7753,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // This should do, restore spell mod so next attack can also use this! // crit chance for first strike is already computed - ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, NULL); // Killing Machine - ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, NULL); // Deathchill + ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, nullptr); // Killing Machine + ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, nullptr); // Deathchill // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier) SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); @@ -7763,7 +7763,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SetCantProc(true); if(basepoints0) - CastCustomSpell(target, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); + CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster); else CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster); SetCantProc(false); @@ -7785,7 +7785,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Sudden Doom if (dummySpell->SpellIconID == 1939 && GetTypeId() == TYPEID_PLAYER) { - SpellChainNode const* chain = NULL; + SpellChainNode const* chain = nullptr; // get highest rank of the Death Coil spell PlayerSpellMap const& sp_list = ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) @@ -7841,7 +7841,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere continue; basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f); - CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura); + CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, NULL, triggeredByAura); } return true; } @@ -7903,7 +7903,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } if(basepoints0) - CastCustomSpell(target, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); + CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster); else CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster); @@ -7964,7 +7964,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp case 59906: { int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue()); - CastCustomSpell(this, 59913, &bp0, NULL, NULL, true); + CastCustomSpell(this, 59913, &bp0, nullptr, nullptr, true); *handled = true; break; } @@ -8003,7 +8003,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp return false; int32 bp0 = int32(CalculatePct(GetMaxPower(POWER_MANA), spInfo->Effects[0].CalcValue())); - CastCustomSpell(this, 67545, &bp0, NULL, NULL, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID()); + CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID()); return true; } } @@ -8077,7 +8077,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp case 70844: { int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue()); - CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true); + CastCustomSpell(this, 70845, &basepoints0, nullptr, nullptr, true); break; } default: @@ -8100,17 +8100,17 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Set trigger spell id, target, custom basepoints uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell; - Unit* target = NULL; + Unit* target = nullptr; int32 basepoints0 = 0; if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE) basepoints0 = triggerAmount; Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER - ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL; + ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; // Try handle unknown trigger spells - //if (sSpellMgr->GetSpellInfo(trigger_spell_id) == NULL) + //if (sSpellMgr->GetSpellInfo(trigger_spell_id) == nullptr) { switch (auraSpellInfo->SpellFamilyName) { @@ -8222,7 +8222,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 2); basepoints0 = int32(CalculatePct(GetMaxPower(POWER_MANA), value2)); // Drain Soul - CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); + CastCustomSpell(this, 18371, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura); break; } } @@ -8523,7 +8523,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // All ok. Check current trigger spell SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id); - if (triggerEntry == NULL) + if (triggerEntry == nullptr) { // Don't cast unknown spell // sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); @@ -8750,7 +8750,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg pTarget->AddSpellCooldown(trigger_spell_id, 0, cooldown); } - Unit* cptarget = NULL; + Unit* cptarget = nullptr; if (trigger_spell_id == 51699) { cptarget = ObjectAccessor::GetUnit(*target, pTarget->GetComboTarget()); @@ -8983,7 +8983,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } // try detect target manually if not set - if (target == NULL) + if (target == nullptr) target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim; if (cooldown) @@ -9010,7 +9010,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au return false; Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER - ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL; + ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; uint32 triggered_spell_id = 0; @@ -9488,7 +9488,7 @@ bool Unit::AttackStop() Unit* victim = m_attacking; m_attacking->_removeAttacker(this); - m_attacking = NULL; + m_attacking = nullptr; // Clear our target SetTarget(0); @@ -9679,7 +9679,7 @@ Unit* Unit::GetOwner() const if (uint64 ownerGUID = GetOwnerGUID()) return ObjectAccessor::GetUnit(*this, ownerGUID); - return NULL; + return nullptr; } Unit* Unit::GetCharmer() const @@ -9687,7 +9687,7 @@ Unit* Unit::GetCharmer() const if (uint64 charmerGUID = GetCharmerGUID()) return ObjectAccessor::GetUnit(*this, charmerGUID); - return NULL; + return nullptr; } Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const @@ -9707,7 +9707,7 @@ Player* Unit::GetAffectingPlayer() const if (Unit* owner = GetCharmerOrOwner()) return owner->GetCharmerOrOwnerPlayerOrPlayerItself(); - return NULL; + return nullptr; } Minion *Unit::GetFirstMinion() const @@ -9722,7 +9722,7 @@ Minion *Unit::GetFirstMinion() const const_cast(this)->SetMinionGUID(0); } - return NULL; + return nullptr; } Guardian* Unit::GetGuardianPet() const @@ -9737,7 +9737,7 @@ Guardian* Unit::GetGuardianPet() const const_cast(this)->SetPetGUID(0); } - return NULL; + return nullptr; } Unit* Unit::GetCharm() const @@ -9751,7 +9751,7 @@ Unit* Unit::GetCharm() const const_cast(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0); } - return NULL; + return nullptr; } void Unit::SetMinion(Minion *minion, bool apply) @@ -10174,7 +10174,7 @@ void Unit::RemoveAllControlled() Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) { - Player* player = NULL; + Player* player = nullptr; if (GetTypeId() == TYPEID_PLAYER) player = ToPlayer(); // Should we enable this also for charmed units? @@ -10182,27 +10182,27 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) player = GetOwner()->ToPlayer(); if (!player) - return NULL; + return nullptr; Group* group = player->GetGroup(); // When there is no group check pet presence if (!group) { // We are pet now, return owner if (player != this) - return IsWithinDistInMap(player, radius) ? player : NULL; + return IsWithinDistInMap(player, radius) ? player : nullptr; Unit* pet = GetGuardianPet(); // No pet, no group, nothing to return if (!pet) - return NULL; + return nullptr; // We are owner now, return pet - return IsWithinDistInMap(pet, radius) ? pet : NULL; + return IsWithinDistInMap(pet, radius) ? pet : nullptr; } std::vector nearMembers; // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then) nearMembers.reserve(group->GetMembersCount() * 2); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* Target = itr->GetSource()) { if (Target != this && !IsWithinDistInMap(Target, radius)) @@ -10219,7 +10219,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) } if (nearMembers.empty()) - return NULL; + return nullptr; uint32 randTarget = urand(0, nearMembers.size()-1); return nearMembers[randTarget]; @@ -12639,7 +12639,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const bool Unit::IsValidAttackTarget(Unit const* target) const { - return _IsValidAttackTarget(target, NULL); + return _IsValidAttackTarget(target, nullptr); } // function based on function Unit::CanAttack from 13850 client @@ -12731,8 +12731,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) return false; - Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL; - Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : NULL; + Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : nullptr; + Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : nullptr; // check duel - before sanctuary checks if (playerAffectingAttacker && playerAffectingTarget) @@ -12760,7 +12760,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo bool Unit::IsValidAssistTarget(Unit const* target) const { - return _IsValidAssistTarget(target, NULL); + return _IsValidAssistTarget(target, nullptr); } // function based on function Unit::CanAssist from 13850 client @@ -13266,7 +13266,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) // xinef: do not affect vehicles and possesed pets if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) || pet->IsVehicle())) - pet = NULL; + pet = nullptr; if (pet && pet->GetTypeId() == TYPEID_UNIT && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) pet->UpdateSpeed(mtype, forced); @@ -13507,7 +13507,7 @@ Unit* Creature::SelectVictim() // next-victim-selection algorithm and evade mode are called // threat list sorting etc. - Unit* target = NULL; + Unit* target = nullptr; // First checking if we have some taunt on us AuraEffectList const& tauntAuras = GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); @@ -13545,7 +13545,7 @@ Unit* Creature::SelectVictim() } } else - return NULL; + return nullptr; if (target && _CanDetectFeignDeathOf(target) && CanCreatureAttack(target)) { @@ -13563,12 +13563,12 @@ Unit* Creature::SelectVictim() if (m_mmapNotAcceptableStartTime) { if (sWorld->GetGameTime() <= m_mmapNotAcceptableStartTime+4) - return NULL; + return nullptr; } else { m_mmapNotAcceptableStartTime = sWorld->GetGameTime(); - return NULL; + return nullptr; } } @@ -13576,10 +13576,10 @@ Unit* Creature::SelectVictim() // pussywizard: if some npc (not player pet) is attacking us and we can't fight back - don't evade o_O for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) if ((*itr) && !CanCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) - return NULL; + return nullptr; if (GetVehicle()) - return NULL; + return nullptr; // search nearby enemies before evading if (HasReactState(REACT_AGGRESSIVE)) @@ -13600,13 +13600,13 @@ Unit* Creature::SelectVictim() AI()->EnterEvadeMode(); break; } - return NULL; + return nullptr; } // enter in evade mode in other case AI()->EnterEvadeMode(); - return NULL; + return nullptr; } //====================================================================== @@ -13920,7 +13920,7 @@ float Unit::GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spell return 0; if (spellInfo->RangeEntry->maxRangeFriend == spellInfo->RangeEntry->maxRangeHostile) return spellInfo->GetMaxRange(); - if (target == NULL) + if (target == nullptr) return spellInfo->GetMaxRange(true); return spellInfo->GetMaxRange(!IsHostileTo(target)); } @@ -14440,7 +14440,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup) if (GetTransport()) { GetTransport()->RemovePassenger(this); - SetTransport(NULL); + SetTransport(nullptr); m_movementInfo.transport.Reset(); m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -14459,7 +14459,7 @@ void Unit::UpdateCharmAI() { delete i_AI; i_AI = i_disabledAI; - i_disabledAI = NULL; + i_disabledAI = nullptr; } } else @@ -14490,7 +14490,7 @@ void Unit::DeleteCharmInfo() m_charmInfo->RestoreState(); delete m_charmInfo; - m_charmInfo = NULL; + m_charmInfo = nullptr; } CharmInfo::CharmInfo(Unit* unit) @@ -14758,7 +14758,7 @@ struct ProcTriggeredData : aura(_aura) { effMask = 0; - spellProcEvent = NULL; + spellProcEvent = nullptr; } SpellProcEventEntry const* spellProcEvent; Aura* aura; @@ -15093,7 +15093,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (isNonTriggerAura[aurEff->GetAuraType()]) continue; // If not trigger by default and spellProcEvent == NULL - skip - if (!isTriggerAura[aurEff->GetAuraType()] && triggerData.spellProcEvent == NULL) + if (!isTriggerAura[aurEff->GetAuraType()] && triggerData.spellProcEvent == nullptr) continue; // Some spells must always trigger //if (isAlwaysTriggeredAura[aurEff->GetAuraType()]) @@ -15379,18 +15379,18 @@ void Unit::GetProcAurasTriggeredOnEvent(std::list& aurasTrigge void Unit::TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo) { DamageInfo dmgInfo = DamageInfo(damageInfo); - TriggerAurasProcOnEvent(NULL, NULL, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, NULL, &dmgInfo, NULL); + TriggerAurasProcOnEvent(nullptr, NULL, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, NULL, &dmgInfo, nullptr); } void Unit::TriggerAurasProcOnEvent(std::list* myProcAuras, std::list* targetProcAuras, Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) { // prepare data for self trigger - ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo, NULL); + ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo, nullptr); std::list myAurasTriggeringProc; GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo); // prepare data for target trigger - ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo, NULL); + ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo, nullptr); std::list targetAurasTriggeringProc; if (typeMaskActionTarget) GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo); @@ -15424,7 +15424,7 @@ Player* Unit::GetSpellModOwner() const if (Player* player = owner->ToPlayer()) return player; - return NULL; + return nullptr; } ///----------Pet responses methods----------------- @@ -15555,8 +15555,8 @@ void Unit::SetDisplayId(uint32 modelId) void Unit::RestoreDisplayId() { - AuraEffect* handledAura = NULL; - AuraEffect* handledAuraForced = NULL; + AuraEffect* handledAura = nullptr; + AuraEffect* handledAuraForced = nullptr; // try to receive model from transform auras Unit::AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM); if (!transforms.empty()) @@ -15696,7 +15696,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const // no appropriate targets if (targets.empty()) - return NULL; + return nullptr; // select random return acore::Containers::SelectRandomContainerElement(targets); @@ -15731,7 +15731,7 @@ Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const // no appropriate targets if (targets.empty()) - return NULL; + return nullptr; // select random return acore::Containers::SelectRandomContainerElement(targets); @@ -15988,7 +15988,7 @@ void Unit::CastPetAura(PetAura const* aura) if (auraId == 35696) // Demonic Knowledge { int32 basePoints = aura->GetDamage(); - CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true); + CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true); } else CastSpell(this, auraId, true); @@ -16013,14 +16013,14 @@ bool Unit::IsPetAura(Aura const* aura) Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id) { if (GetTypeId() != TYPEID_PLAYER) - return NULL; + return nullptr; Pet* pet = new Pet(ToPlayer(), HUNTER_PET); if (!pet->CreateBaseAtCreature(creatureTarget)) { delete pet; - return NULL; + return nullptr; } uint8 level = creatureTarget->getLevel() + 5 < getLevel() ? (getLevel() - 5) : creatureTarget->getLevel(); @@ -16033,18 +16033,18 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id) Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id) { if (GetTypeId() != TYPEID_PLAYER) - return NULL; + return nullptr; CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry); if (!creatureInfo) - return NULL; + return nullptr; Pet* pet = new Pet(ToPlayer(), HUNTER_PET); if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, getLevel(), spell_id)) { delete pet; - return NULL; + return nullptr; } return pet; @@ -16135,7 +16135,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const Player* player = ToPlayer(); if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON) { - Item* item = NULL; + Item* item = nullptr; if (attType == BASE_ATTACK) item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); else if (attType == OFF_ATTACK) @@ -16237,7 +16237,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster); std::list nearMembers; - Player* player = NULL; + Player* player = nullptr; if (GetTypeId() == TYPEID_PLAYER) player = ToPlayer(); else if (GetOwner()) @@ -16261,7 +16261,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) } else { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* Target = itr->GetSource()) { if (Target != this && !IsWithinDistInMap(Target, radius)) @@ -16284,7 +16284,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) if (Unit* target = nearMembers.front()) { CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true); - CastCustomSpell(target, spellProto->Id, &heal, NULL, NULL, true, NULL, triggeredByAura, caster_guid); + CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, NULL, triggeredByAura, caster_guid); if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID())) aura->SetCharges(jumps); } @@ -16294,7 +16294,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) } // heal - CastCustomSpell(this, 33110, &heal, NULL, NULL, true, NULL, NULL, caster_guid); + CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid); return true; } @@ -16356,10 +16356,10 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp return; if (killer && !killer->IsInMap(victim)) - killer = NULL; + killer = nullptr; // find player: owner of controlled `this` or `this` itself maybe - Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : NULL; + Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr; Creature* creature = victim->ToCreature(); bool isRewardAllowed = true; @@ -16367,7 +16367,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp { isRewardAllowed = creature->IsDamageEnoughForLootingAndReward(); if (!isRewardAllowed) - creature->SetLootRecipient(NULL); + creature->SetLootRecipient(nullptr); } // pussywizard: remade this if section (player is on the same map @@ -16377,7 +16377,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (lr && lr->IsInMap(creature)) player = creature->GetLootRecipient(); else if (Group* lrg = creature->GetLootRecipientGroup()) - for (GroupReference* itr = lrg->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) if (member->IsAtGroupRewardDistance(creature)) { @@ -16451,7 +16451,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (hasLooterGuid) group->SendLooter(creature, looter); else - group->SendLooter(creature, NULL); + group->SendLooter(creature, nullptr); // Update round robin looter only if the creature had loot if (!creature->loot.empty()) @@ -16474,7 +16474,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp killer->ProcDamageAndSpell(victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto); // Proc auras on death - must be before aura/combat remove - victim->ProcDamageAndSpell(NULL, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto); + victim->ProcDamageAndSpell(nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto); // update get killing blow achievements, must be done before setDeathState to be able to require auras on target // and before Spirit of Redemption as it also removes auras @@ -16547,7 +16547,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp { // remember victim PvP death for corpse type and corpse reclaim delay // at original death (not at SpiritOfRedemtionTalent timeout) - plrVictim->SetPvPDeath(player != NULL); + plrVictim->SetPvPDeath(player != nullptr); // only if not player and not controlled by player pet. And not at BG if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP))) @@ -16909,7 +16909,7 @@ void Unit::SetFeared(bool apply) { SetTarget(0); - Unit* caster = NULL; + Unit* caster = nullptr; Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR); if (!fearAuras.empty()) caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID()); @@ -17137,7 +17137,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); // if charmed two demons the same session, the 2nd gets the 1st one's name - SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped + SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped } } GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle()); @@ -17346,7 +17346,7 @@ void Unit::RemoveVehicleKit() m_vehicleKit->Uninstall(); delete m_vehicleKit; - m_vehicleKit = NULL; + m_vehicleKit = nullptr; m_updateFlag &= ~UPDATEFLAG_VEHICLE; m_unitTypeMask &= ~UNIT_MASK_VEHICLE; @@ -17355,7 +17355,7 @@ void Unit::RemoveVehicleKit() Unit* Unit::GetVehicleBase() const { - return m_vehicle ? m_vehicle->GetBase() : NULL; + return m_vehicle ? m_vehicle->GetBase() : nullptr; } Creature* Unit::GetVehicleCreatureBase() const @@ -17364,7 +17364,7 @@ Creature* Unit::GetVehicleCreatureBase() const if (Creature* c = veh->ToCreature()) return c; - return NULL; + return nullptr; } uint64 Unit::GetTransGUID() const @@ -17433,7 +17433,7 @@ bool Unit::IsInRaidWith(Unit const* unit) const void Unit::GetPartyMembers(std::list &TagUnitMap) { Unit* owner = GetCharmerOrOwnerOrSelf(); - Group* group = NULL; + Group* group = nullptr; if (owner->GetTypeId() == TYPEID_PLAYER) group = owner->ToPlayer()->GetGroup(); @@ -17441,7 +17441,7 @@ void Unit::GetPartyMembers(std::list &TagUnitMap) { uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->GetSource(); @@ -17477,14 +17477,14 @@ void Unit::GetPartyMembers(std::list &TagUnitMap) Aura* Unit::AddAura(uint32 spellId, Unit* target) { if (!target) - return NULL; + return nullptr; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) - return NULL; + return nullptr; if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_DEAD)) - return NULL; + return nullptr; return AddAura(spellInfo, MAX_EFFECT_MASK, target); } @@ -17492,10 +17492,10 @@ Aura* Unit::AddAura(uint32 spellId, Unit* target) Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target) { if (!spellInfo) - return NULL; + return nullptr; if (target->IsImmunedToSpell(spellInfo)) - return NULL; + return nullptr; for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) { @@ -17510,7 +17510,7 @@ Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target) aura->ApplyForTargets(); return aura; } - return NULL; + return nullptr; } void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 stack) @@ -17544,7 +17544,7 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool if (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER) return; - Unit const* target = NULL; + Unit const* target = nullptr; if (victim->GetTypeId() == TYPEID_PLAYER) target = victim; else if (victim->GetTypeId() == TYPEID_UNIT) @@ -17741,7 +17741,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ) { player = charmer->ToPlayer(); if (player && player->m_mover != this) - player = NULL; + player = nullptr; } } @@ -18087,7 +18087,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) Unit* Unit::GetRedirectThreatTarget() const { - return _redirectThreatInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreatInfo.GetTargetGUID()) : NULL; + return _redirectThreatInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreatInfo.GetTargetGUID()) : nullptr; } void Unit::JumpTo(float speedXY, float speedZ, bool forward) @@ -18168,7 +18168,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) } if (IsInMap(caster)) - caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID); + caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID); else // This can happen during Player::_LoadAuras { int32 bp0[MAX_SPELL_EFFECTS]; @@ -18182,9 +18182,9 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else { if (IsInMap(caster)) - caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID); + caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID); else - Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); + Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID); } result = true; @@ -18263,7 +18263,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a if (!m_vehicle->AddPassenger(this, seatId)) { - m_vehicle = NULL; + m_vehicle = nullptr; return; } @@ -18334,7 +18334,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) // This should be done before dismiss, because there may be some aura removal Vehicle* vehicle = m_vehicle; Unit* vehicleBase = m_vehicle->GetBase(); - m_vehicle = NULL; + m_vehicle = nullptr; SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT @@ -18362,7 +18362,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) AddUnitState(UNIT_STATE_MOVE); if (player) - player->SetFallInformation(time(NULL), GetPositionZ()); + player->SetFallInformation(time(nullptr), GetPositionZ()); else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) { WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); @@ -18771,7 +18771,7 @@ class AuraMunchingQueue : public BasicEvent { if (_owner.IsInWorld() && _owner.FindMap()) if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) - _owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, _owner.GetGUID()); + _owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, _owner.GetGUID()); return true; } @@ -18797,7 +18797,7 @@ void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, Aura // xinef: delay only for casting on different unit if (this == caster) - caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, caster->GetGUID()); + caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, caster->GetGUID()); else caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400)); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8e54765e4..5a9c06f68 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -950,7 +950,7 @@ public: uint32 GetSpellTypeMask() const { return _spellTypeMask; } uint32 GetSpellPhaseMask() const { return _spellPhaseMask; } uint32 GetHitMask() const { return _hitMask; } - SpellInfo const* GetSpellInfo() const { return NULL; } + SpellInfo const* GetSpellInfo() const { return nullptr; } SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; } DamageInfo* GetDamageInfo() const { return _damageInfo; } HealInfo* GetHealInfo() const { return _healInfo; } @@ -1419,13 +1419,13 @@ class Unit : public WorldObject } Unit* getAttackerForHelper() const // If someone wants to help, who to give them { - if (GetVictim() != NULL) + if (GetVictim() != nullptr) return GetVictim(); if (!m_attackers.empty()) return *(m_attackers.begin()); - return NULL; + return nullptr; } bool Attack(Unit* victim, bool meleeAttack); void CastStop(uint32 except_spellid = 0, bool withInstant = true); @@ -1440,8 +1440,8 @@ class Unit : public WorldObject void StopAttackFaction(uint32 faction_id); Unit* SelectNearbyTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; Unit* SelectNearbyNoTotemTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; - void SendMeleeAttackStop(Unit* victim = NULL); - void SendMeleeAttackStart(Unit* victim, Player* sendTo = NULL); + void SendMeleeAttackStop(Unit* victim = nullptr); + void SendMeleeAttackStart(Unit* victim, Player* sendTo = nullptr); void AddUnitState(uint32 f) { m_state |= f; } bool HasUnitState(const uint32 f) const { return (m_state & f); } @@ -1481,7 +1481,7 @@ class Unit : public WorldObject uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); } uint32 GetResistance(SpellSchoolMask mask) const; void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school, val); } - static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = NULL); + static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr); uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } @@ -1577,14 +1577,14 @@ class Unit : public WorldObject void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0); void Dismount(); - uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } + uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } static void DealDamageMods(Unit const* victim, uint32 &damage, uint32* absorb); static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true, bool allowGM = false); - static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const *spellProto = NULL); + static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const *spellProto = nullptr); static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth); - void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL); - void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = NULL); + void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = nullptr); + void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = nullptr); void GetProcAurasTriggeredOnEvent(std::list& aurasTriggeringProc, std::list* procAuras, ProcEventInfo eventInfo); void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo); @@ -1655,9 +1655,9 @@ class Unit : public WorldObject return value; } - uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } - uint32 GetDefenseSkillValue(Unit const* target = NULL) const; - uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const; + uint32 GetUnitMeleeSkill(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } + uint32 GetDefenseSkillValue(Unit const* target = nullptr) const; + uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = nullptr) const; float GetWeaponProcChance() const; float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const; @@ -1706,7 +1706,7 @@ class Unit : public WorldObject bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const; bool virtual HasSpell(uint32 /*spellID*/) const { return false; } bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura = 0) const; - bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = NULL) const; + bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = nullptr) const; bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); } @@ -1716,10 +1716,10 @@ class Unit : public WorldObject bool isFrozen() const; - bool isTargetableForAttack(bool checkFakeDeath = true, Unit const* byWho = NULL) const; + bool isTargetableForAttack(bool checkFakeDeath = true, Unit const* byWho = nullptr) const; bool IsValidAttackTarget(Unit const* target) const; - bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const; + bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = nullptr) const; bool IsValidAssistTarget(Unit const* target) const; bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; @@ -1781,8 +1781,8 @@ class Unit : public WorldObject void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf = SPLINEFLAG_WALK_MODE); // pussywizard: need to just send packet, with no shitty movement/spline void MonsterMoveWithSpeed(float x, float y, float z, float speed); - //void SetFacing(float ori, WorldObject* obj = NULL); - //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); + //void SetFacing(float ori, WorldObject* obj = nullptr); + //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = nullptr); void SendMovementFlagUpdate(bool self = false); bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); } @@ -1867,7 +1867,7 @@ class Unit : public WorldObject void RemoveAllMinionsByEntry(uint32 entry); void SetCharm(Unit* target, bool apply); Unit* GetNextRandomRaidMemberOrPet(float radius); - bool SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* aurApp = NULL); + bool SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* aurApp = nullptr); void RemoveCharmedBy(Unit* charmer); void RestoreFaction(); @@ -1925,7 +1925,7 @@ class Unit : public WorldObject void RemoveOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const; + Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = nullptr) const; // m_appliedAuras container management AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; } @@ -1974,10 +1974,10 @@ class Unit : public WorldObject AuraEffect * GetAuraEffectDummy(uint32 spellid) const; inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);} - AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; + AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = nullptr) const; Aura* GetAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; - AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; + AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = nullptr) const; Aura* GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList); @@ -2007,7 +2007,7 @@ class Unit : public WorldObject int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const; - int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect* except = NULL) const; + int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect* except = nullptr) const; int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; @@ -2117,7 +2117,7 @@ class Unit : public WorldObject virtual void UpdateMaxPower(Powers power) = 0; virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0; virtual void UpdateDamagePhysical(WeaponAttackType attType); - float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim = NULL) const; + float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim = nullptr) const; float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const; void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; } virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) = 0; @@ -2142,7 +2142,7 @@ class Unit : public WorldObject // Threat related methods bool CanHaveThreatList() const; - void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); + void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr); float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); void TauntApply(Unit* victim); @@ -2190,10 +2190,10 @@ class Unit : public WorldObject void ModifyAuraState(AuraStateType flag, bool apply); uint32 BuildAuraStateUpdateForTarget(Unit* target) const; - bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const; + bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = nullptr) const; void UnsummonAllTotems(); Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo); - Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL); + Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = nullptr); int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT = false); @@ -2206,8 +2206,8 @@ class Unit : public WorldObject uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, float TotalMod = 0.0f, uint32 stack = 1); uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); - uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); - uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL); + uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = nullptr); + uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = nullptr); bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); @@ -2219,7 +2219,7 @@ class Unit : public WorldObject void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } bool IsUnderLastManaUseEffect() const; - void SetContestedPvP(Player* attackedPlayer = NULL); + void SetContestedPvP(Player* attackedPlayer = nullptr); uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const; float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const; @@ -2250,7 +2250,7 @@ class Unit : public WorldObject void SetSpeedRate(UnitMoveType mtype, float rate) { m_speed_rate[mtype] = rate; } float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const; - int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const; + int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = nullptr) const; int32 CalcSpellDuration(SpellInfo const* spellProto); int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask); void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell * spell=NULL); @@ -2351,12 +2351,12 @@ class Unit : public WorldObject bool HandleSpellClick(Unit* clicker, int8 seatId = -1); void EnterVehicle(Unit* base, int8 seatId = -1); void EnterVehicleUnattackable(Unit *base, int8 seatId = -1); - void ExitVehicle(Position const* exitPosition = NULL); + void ExitVehicle(Position const* exitPosition = nullptr); void ChangeSeat(int8 seatId, bool next = true); // Should only be called by AuraEffect::HandleAuraControlVehicle(AuraApplication const* auraApp, uint8 mode, bool apply) const; - void _ExitVehicle(Position const* exitPosition = NULL); - void _EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp = NULL); + void _ExitVehicle(Position const* exitPosition = nullptr); + void _EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp = nullptr); void BuildMovementPacket(ByteBuffer *data) const; @@ -2378,15 +2378,15 @@ class Unit : public WorldObject virtual bool isBeingLoaded() const { return false;} bool IsDuringRemoveFromWorld() const {return m_duringRemoveFromWorld;} - Pet* ToPet(){ if (IsPet()) return reinterpret_cast(this); else return NULL; } - Totem* ToTotem(){ if (IsTotem()) return reinterpret_cast(this); else return NULL; } - TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast(this); else return NULL; } - const TempSummon* ToTempSummon() const { if (IsSummon()) return reinterpret_cast(this); else return NULL; } + Pet* ToPet(){ if (IsPet()) return reinterpret_cast(this); else return nullptr; } + Totem* ToTotem(){ if (IsTotem()) return reinterpret_cast(this); else return nullptr; } + TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast(this); else return nullptr; } + const TempSummon* ToTempSummon() const { if (IsSummon()) return reinterpret_cast(this); else return nullptr; } // pussywizard: // MMaps std::map m_targetsNotAcceptable; - bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = NULL) const { std::map::const_iterator itr = m_targetsNotAcceptable.find(guid); if (itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime || (t && !itr->second.PosChanged(*this, *t)))) return true; return false; } + bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = nullptr) const { std::map::const_iterator itr = m_targetsNotAcceptable.find(guid); if (itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime || (t && !itr->second.PosChanged(*this, *t)))) return true; return false; } uint32 m_mmapNotAcceptableStartTime; // Safe mover std::set SafeUnitPointerSet; diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index c4152d6e2..c3495fe7f 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -225,7 +225,7 @@ Unit* Vehicle::GetPassenger(int8 seatId) const { SeatMap::const_iterator seat = Seats.find(seatId); if (seat == Seats.end()) - return NULL; + return nullptr; return ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid); } @@ -587,7 +587,7 @@ VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit const* passenger) if (itr->second.Passenger.Guid == passenger->GetGUID()) return itr->second.SeatInfo; - return NULL; + return nullptr; } SeatMap::iterator Vehicle::GetSeatIteratorForPassenger(Unit* passenger) diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 3b9ad1bb4..a17be8db6 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -100,10 +100,10 @@ protected: public: /// This method transforms supplied transport offsets into global coordinates - virtual void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const = 0; + virtual void CalculatePassengerPosition(float& x, float& y, float& z, float* o = nullptr) const = 0; /// This method transforms supplied global coordinates into local offsets - virtual void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const = 0; + virtual void CalculatePassengerOffset(float& x, float& y, float& z, float* o = nullptr) const = 0; protected: static void CalculatePassengerPosition(float& x, float& y, float& z, float* o, float transX, float transY, float transZ, float transO) diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index f095fd1b9..1c1fbe17a 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -37,7 +37,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const default: case GAMEEVENT_NORMAL: { - time_t currenttime = time(NULL); + time_t currenttime = time(nullptr); // Get the event information return mGameEvent[entry].start < currenttime && currenttime < mGameEvent[entry].end @@ -54,7 +54,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const // if inactive world event, check the prerequisite events case GAMEEVENT_WORLD_INACTIVE: { - time_t currenttime = time(NULL); + time_t currenttime = time(nullptr); for (std::set::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr) { if ((mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one @@ -70,7 +70,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const uint32 GameEventMgr::NextCheck(uint16 entry) const { - time_t currenttime = time(NULL); + time_t currenttime = time(nullptr); // for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly if ((mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE || mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) && mGameEvent[entry].nextstart >= currenttime) @@ -130,7 +130,7 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite) ApplyNewEvent(event_id); if (overwrite) { - mGameEvent[event_id].start = time(NULL); + mGameEvent[event_id].start = time(nullptr); if (data.end <= data.start) data.end = data.start + data.length; } @@ -178,7 +178,7 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite) if (overwrite && !serverwide_evt) { - data.start = time(NULL) - data.length * MINUTE; + data.start = time(nullptr) - data.length * MINUTE; if (data.end <= data.start) data.end = data.start + data.length; } @@ -876,7 +876,7 @@ void GameEventMgr::LoadFromDB() newEntry.entry = data->id; // check validity with event's npcflag - if (!sObjectMgr->IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag)) + if (!sObjectMgr->IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, nullptr, nullptr, event_npc_flag)) continue; vendors.push_back(newEntry); @@ -1100,7 +1100,7 @@ void GameEventMgr::StartArenaSeason() uint32 GameEventMgr::Update() // return the next event delay in ms { - time_t currenttime = time(NULL); + time_t currenttime = time(nullptr); uint32 nextEventDelay = max_ge_check_delay; // 1 day uint32 calcDelay; std::set activate, deactivate; @@ -1682,7 +1682,7 @@ bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id) // set the followup events' start time if (!mGameEvent[event_id].nextstart) { - time_t currenttime = time(NULL); + time_t currenttime = time(nullptr); mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60; } return true; @@ -1779,7 +1779,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event) bool singleDate = ((holiday->Date[0] >> 24) & 0x1F) == 31; // Events with fixed date within year have - 1 - time_t curTime = time(NULL); + time_t curTime = time(nullptr); for (int i = 0; i < MAX_HOLIDAY_DATES && holiday->Date[i]; ++i) { uint32 date = holiday->Date[i]; diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 9e633da5f..efaaa310c 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -44,7 +44,7 @@ ObjectAccessor* ObjectAccessor::instance() Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/) { Player* player = HashMapHolder::Find(guid); - return player && player->IsInWorld() ? player : NULL; + return player && player->IsInWorld() ? player : nullptr; } WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid) @@ -60,7 +60,7 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid) case HIGHGUID_PET: return GetPet(p, guid); case HIGHGUID_DYNAMICOBJECT: return GetDynamicObject(p, guid); case HIGHGUID_CORPSE: return GetCorpse(p, guid); - default: return NULL; + default: return nullptr; } } @@ -99,7 +99,7 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, u break; } - return NULL; + return nullptr; } Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, uint64 guid) @@ -115,10 +115,10 @@ GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, uint64 guid) Transport* ObjectAccessor::GetTransport(WorldObject const& u, uint64 guid) { if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT && GUID_HIPART(guid) != HIGHGUID_TRANSPORT) - return NULL; + return nullptr; GameObject* go = GetGameObject(u, guid); - return go ? go->ToTransport() : NULL; + return go ? go->ToTransport() : nullptr; } DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, uint64 guid) @@ -154,7 +154,7 @@ Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, uint64 if (IS_CRE_OR_VEH_GUID(guid)) return GetCreature(u, guid); - return NULL; + return nullptr; } Pet* ObjectAccessor::FindPet(uint64 guid) @@ -206,7 +206,7 @@ Player* ObjectAccessor::FindPlayerByName(std::string const& name, bool checkInWo if (!checkInWorld || itr->second->IsInWorld()) return itr->second; - return NULL; + return nullptr; } void ObjectAccessor::SaveAllPlayers() @@ -223,7 +223,7 @@ Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid) Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); if (iter == i_player2corpse.end()) - return NULL; + return nullptr; ASSERT(iter->second->GetType() != CORPSE_BONES); @@ -321,7 +321,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia { //in fact this function is called from several places //even when player doesn't have a corpse, not an error - return NULL; + return nullptr; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -340,7 +340,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia corpse->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); - Corpse* bones = NULL; + Corpse* bones = nullptr; // create the bones only if the map and the grid is loaded at the corpse's location // ignore bones creating option in case insignia @@ -392,7 +392,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia 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/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 505aedfef..da6f1400f 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -52,7 +52,7 @@ class HashMapHolder { ACORE_READ_GUARD(LockType, 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; } @@ -139,27 +139,27 @@ class ObjectAccessor if (T * obj = GetObjectInWorld(guid, (T*)NULL)) if (obj->GetMap() == map) return obj; - return NULL; + return nullptr; } template static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) { T* obj = HashMapHolder::Find(guid); if (!obj || obj->GetMapId() != mapid) - return NULL; + return nullptr; CellCoord p = acore::ComputeCellCoord(x, y); if (!p.IsCoordValid()) { sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); - return NULL; + return nullptr; } CellCoord q = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!q.IsCoordValid()) { sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); - return NULL; + return nullptr; } int32 dx = int32(p.x_coord) - int32(q.x_coord); @@ -168,7 +168,7 @@ class ObjectAccessor if (dx > -2 && dx < 2 && dy > -2 && dy < 2) return obj; else - return NULL; + return nullptr; } // these functions return objects only if in map of specified object diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 92e4b4de3..f90b835de 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -56,7 +56,7 @@ std::string GetScriptsTableNameByType(ScriptsType type) ScriptMapMap* GetScriptsMapByType(ScriptsType type) { - ScriptMapMap* res = NULL; + ScriptMapMap* res = nullptr; switch (type) { case SCRIPTS_SPELL: res = &sSpellScripts; break; @@ -171,7 +171,7 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang) return &lang_description[i]; } - return NULL; + return nullptr; } bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clickee) const @@ -180,7 +180,7 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke if (!playerClicker) return true; - Unit const* summoner = NULL; + Unit const* summoner = nullptr; // Check summoners for party if (clickee->IsSummon()) summoner = clickee->ToTempSummon()->GetSummoner(); @@ -228,9 +228,9 @@ ObjectMgr::ObjectMgr(): { for (uint8 i = 0; i < MAX_CLASSES; ++i) { - _playerClassInfo[i] = NULL; + _playerClassInfo[i] = nullptr; for (uint8 j = 0; j < MAX_RACES; ++j) - _playerInfo[j][i] = NULL; + _playerInfo[j][i] = nullptr; } } @@ -514,7 +514,7 @@ void ObjectMgr::LoadCreatureTemplates() if (max) { _creatureTemplateStoreFast.clear(); - _creatureTemplateStoreFast.resize(max+1, NULL); + _creatureTemplateStoreFast.resize(max+1, nullptr); for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) _creatureTemplateStoreFast[itr->first] = &(itr->second); } @@ -748,7 +748,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) sLog->outErrorDb("Creature (Entry: %u) has non-existing faction template (%u).", cInfo->Entry, cInfo->faction); // used later for scale - CreatureDisplayInfoEntry const* displayScaleEntry = NULL; + CreatureDisplayInfoEntry const* displayScaleEntry = nullptr; if (cInfo->Modelid1) { @@ -1082,7 +1082,7 @@ GameObjectAddon const* ObjectMgr::GetGameObjectAddon(uint32 lowguid) if (itr != _gameObjectAddonStore.end()) return &(itr->second); - return NULL; + return nullptr; } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -1091,7 +1091,7 @@ CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) if (itr != _creatureAddonStore.end()) return &(itr->second); - return NULL; + return nullptr; } CreatureAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry) @@ -1100,17 +1100,17 @@ CreatureAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry) if (itr != _creatureTemplateAddonStore.end()) return &(itr->second); - return NULL; + return nullptr; } EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry, int8& id) { EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry); if (itr == _equipmentInfoStore.end()) - return NULL; + return nullptr; if (itr->second.empty()) - return NULL; + return nullptr; if (id == -1) // select a random element { @@ -1126,7 +1126,7 @@ EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry, int8& id) return &itr2->second; } - return NULL; + return nullptr; } void ObjectMgr::LoadEquipmentTemplates() @@ -1214,7 +1214,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) if (itr != _creatureModelStore.end()) return &(itr->second); - return NULL; + return nullptr; } uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= NULL*/) @@ -1249,7 +1249,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display { CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID); if (!modelInfo) - return NULL; + return nullptr; // If a model for another gender exists, 50% chance to use it if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0) @@ -2601,7 +2601,7 @@ void ObjectMgr::LoadItemTemplates() else if (itemTemplate.Spells[1].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); - if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, nullptr)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; @@ -2649,7 +2649,7 @@ void ObjectMgr::LoadItemTemplates() if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); - if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, nullptr)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; @@ -2806,7 +2806,7 @@ void ObjectMgr::LoadItemTemplates() if (max) { _itemTemplateStoreFast.clear(); - _itemTemplateStoreFast.resize(max+1, NULL); + _itemTemplateStoreFast.resize(max+1, nullptr); for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) _itemTemplateStoreFast[itr->first] = &(itr->second); } @@ -2844,7 +2844,7 @@ void ObjectMgr::LoadItemTemplates() ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) { - return entry < _itemTemplateStoreFast.size() ? _itemTemplateStoreFast[entry] : NULL; + return entry < _itemTemplateStoreFast.size() ? _itemTemplateStoreFast[entry] : nullptr; } void ObjectMgr::LoadItemSetNameLocales() @@ -3113,7 +3113,7 @@ void ObjectMgr::LoadPetLevelInfo() PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id]; - if (pInfoMapEntry == NULL) + if (pInfoMapEntry == nullptr) pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)]; // data for level 1 stored in [0] array element, ... @@ -3167,7 +3167,7 @@ PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) PetLevelInfoContainer::const_iterator itr = _petInfoStore.find(creature_id); if (itr == _petInfoStore.end()) - return NULL; + return nullptr; return &itr->second[level-1]; // data for level 1 stored in [0] array element, ... } @@ -3903,7 +3903,7 @@ void ObjectMgr::LoadQuests() if (max) { _questTemplatesFast.clear(); - _questTemplatesFast.resize(max+1, NULL); + _questTemplatesFast.resize(max+1, nullptr); for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) _questTemplatesFast[itr->first] = itr->second; } @@ -4008,7 +4008,7 @@ void ObjectMgr::LoadQuests() for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter) { // skip post-loading checks for disabled quests - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, nullptr)) continue; Quest * qinfo = iter->second; @@ -5211,7 +5211,7 @@ PageText const* ObjectMgr::GetPageText(uint32 pageEntry) if (itr != _pageTextStore.end()) return &(itr->second); - return NULL; + return nullptr; } void ObjectMgr::LoadPageTextLocales() @@ -5293,7 +5293,7 @@ InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) if (itr != _instanceTemplateStore.end()) return &(itr->second); - return NULL; + return nullptr; } void ObjectMgr::LoadInstanceEncounters() @@ -5386,7 +5386,7 @@ GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const GossipTextContainer::const_iterator itr = _gossipTextStore.find(Text_ID); if (itr != _gossipTextStore.end()) return &itr->second; - return NULL; + return nullptr; } void ObjectMgr::LoadGossipText() @@ -5508,7 +5508,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) { uint32 oldMSTime = getMSTime(); - time_t curTime = time(NULL); + time_t curTime = time(nullptr); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_MAIL); stmt->setUInt32(0, curTime); @@ -5549,7 +5549,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) m->checked = fields[7].GetUInt8(); m->mailTemplateId = fields[8].GetInt16(); - Player* player = NULL; + Player* player = nullptr; if (serverUp) player = ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(m->receiver, 0, HIGHGUID_PLAYER)); @@ -6150,14 +6150,14 @@ AreaTriggerTeleport const* ObjectMgr::GetGoBackTrigger(uint32 Map) const uint32 parentId = 0; const MapEntry* mapEntry = sMapStore.LookupEntry(Map); if (!mapEntry || mapEntry->entrance_map < 0) - return NULL; + return nullptr; if (mapEntry->IsDungeon()) { const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(Map); if (!iTemplate) - return NULL; + return nullptr; parentId = iTemplate->Parent; useParentDbValue = true; @@ -6171,7 +6171,7 @@ AreaTriggerTeleport const* ObjectMgr::GetGoBackTrigger(uint32 Map) const if (atEntry && atEntry->map == Map) return &itr->second; } - return NULL; + return nullptr; } /** @@ -6189,7 +6189,7 @@ AreaTriggerTeleport const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const return &itr->second; } } - return NULL; + return nullptr; } void ObjectMgr::SetHighestGuids() @@ -8010,13 +8010,13 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const // explicit name case std::wstring wname; if (!Utf8toWStr(name, wname)) - return NULL; + return nullptr; // converting string that we try to find to lower case wstrToLower(wname); // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found - const GameTele* alt = NULL; + const GameTele* alt = nullptr; for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr) { if (itr->second.wnameLow == wname) @@ -9124,7 +9124,7 @@ GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) if (itr != _gameObjectTemplateStore.end()) return &(itr->second); - return NULL; + return nullptr; } Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const @@ -9150,7 +9150,7 @@ GameObjectTemplateAddon const* ObjectMgr::GetGameObjectTemplateAddon(uint32 entr CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry) { - return entry < _creatureTemplateStoreFast.size() ? _creatureTemplateStoreFast[entry] : NULL; + return entry < _creatureTemplateStoreFast.size() ? _creatureTemplateStoreFast[entry] : nullptr; } VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) const @@ -9167,18 +9167,18 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con VehicleAccessoryContainer::const_iterator itr = _vehicleTemplateAccessoryStore.find(veh->GetCreatureEntry()); if (itr != _vehicleTemplateAccessoryStore.end()) return &itr->second; - return NULL; + return nullptr; } PlayerInfo const* ObjectMgr::GetPlayerInfo(uint32 race, uint32 class_) const { if (race >= MAX_RACES) - return NULL; + return nullptr; if (class_ >= MAX_CLASSES) - return NULL; + return nullptr; PlayerInfo const* info = _playerInfo[race][class_]; if (!info) - return NULL; + return nullptr; return info; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 77e7c6876..0fdd03b12 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -732,8 +732,8 @@ class ObjectMgr CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; } CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); - static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = NULL); - static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = NULL); + static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr); + static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = nullptr); EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id); CreatureAddon const* GetCreatureAddon(uint32 lowguid); GameObjectAddon const* GetGameObjectAddon(uint32 lowguid); @@ -748,7 +748,7 @@ class ObjectMgr ItemSetNameContainer::iterator itr = _itemSetNameStore.find(itemId); if (itr != _itemSetNameStore.end()) return &itr->second; - return NULL; + return nullptr; } InstanceTemplate const* GetInstanceTemplate(uint32 mapId); @@ -758,7 +758,7 @@ class ObjectMgr PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const { if (class_ >= MAX_CLASSES) - return NULL; + return nullptr; return _playerClassInfo[class_]; } void GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassLevelInfo* info) const; @@ -782,7 +782,7 @@ class ObjectMgr GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id); if (itr != _gameObjectQuestItemStore.end()) return &itr->second; - return NULL; + return nullptr; } GameObjectQuestItemMap const* GetGameObjectQuestItemMap() const { return &_gameObjectQuestItemStore; } @@ -791,13 +791,13 @@ class ObjectMgr CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id); if (itr != _creatureQuestItemStore.end()) return &itr->second; - return NULL; + return nullptr; } CreatureQuestItemMap const* GetCreatureQuestItemMap() const { return &_creatureQuestItemStore; } Quest const* GetQuestTemplate(uint32 quest_id) const { - return quest_id < _questTemplatesFast.size() ? _questTemplatesFast[quest_id] : NULL; + return quest_id < _questTemplatesFast.size() ? _questTemplatesFast[quest_id] : nullptr; } QuestMap const& GetQuestTemplates() const { return _questTemplates; } @@ -822,7 +822,7 @@ class ObjectMgr AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger); if (itr != _areaTriggerStore.end()) return &itr->second; - return NULL; + return nullptr; } AreaTriggerTeleport const* GetAreaTriggerTeleport(uint32 trigger) const @@ -830,7 +830,7 @@ class ObjectMgr AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger); if (itr != _areaTriggerTeleportStore.end()) return &itr->second; - return NULL; + return nullptr; } AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const @@ -838,7 +838,7 @@ class ObjectMgr AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty)); if (itr != _accessRequirementStore.end()) return itr->second; - return NULL; + return nullptr; } AreaTriggerTeleport const* GetGoBackTrigger(uint32 Map) const; @@ -853,7 +853,7 @@ class ObjectMgr if (itr != _repRewardRateStore.end()) return &itr->second; - return NULL; + return nullptr; } ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const @@ -861,7 +861,7 @@ class ObjectMgr RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id); if (itr != _repOnKillStore.end()) return &itr->second; - return NULL; + return nullptr; } int32 GetBaseReputationOf(FactionEntry const* factionEntry, uint8 race, uint8 playerClass); @@ -872,7 +872,7 @@ class ObjectMgr if (itr != _repSpilloverTemplateStore.end()) return &itr->second; - return NULL; + return nullptr; } PointOfInterest const* GetPointOfInterest(uint32 id) const @@ -880,7 +880,7 @@ class ObjectMgr PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id); if (itr != _pointsOfInterestStore.end()) return &itr->second; - return NULL; + return nullptr; } QuestPOIVector const* GetQuestPOIVector(uint32 questId) @@ -888,7 +888,7 @@ class ObjectMgr QuestPOIContainer::const_iterator itr = _questPOIStore.find(questId); if (itr != _questPOIStore.end()) return &itr->second; - return NULL; + return nullptr; } VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const; @@ -898,7 +898,7 @@ class ObjectMgr std::unordered_map::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR32(mapId, difficulty)); if (itr != _dungeonEncounterStore.end()) return &itr->second; - return NULL; + return nullptr; } void LoadQuests(); @@ -1074,13 +1074,13 @@ class ObjectMgr { MailLevelRewardContainer::const_iterator map_itr = _mailLevelRewardStore.find(level); if (map_itr == _mailLevelRewardStore.end()) - return NULL; + return nullptr; for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr) if (set_itr->raceMask & raceMask) return &*set_itr; - return NULL; + return nullptr; } CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id) @@ -1118,7 +1118,7 @@ class ObjectMgr if (itr != _tempSummonDataStore.end()) return &itr->second; - return NULL; + return nullptr; } BroadcastText const* GetBroadcastText(uint32 id) const @@ -1131,7 +1131,7 @@ class ObjectMgr CreatureData const* GetCreatureData(uint32 guid) const { CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid); - if (itr == _creatureDataStore.end()) return NULL; + if (itr == _creatureDataStore.end()) return nullptr; return &itr->second; } CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; } @@ -1146,55 +1146,55 @@ class ObjectMgr GameObjectData const* GetGOData(uint32 guid) const { GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid); - if (itr == _gameObjectDataStore.end()) return NULL; + if (itr == _gameObjectDataStore.end()) return nullptr; return &itr->second; } CreatureLocale const* GetCreatureLocale(uint32 entry) const { CreatureLocaleContainer::const_iterator itr = _creatureLocaleStore.find(entry); - if (itr == _creatureLocaleStore.end()) return NULL; + if (itr == _creatureLocaleStore.end()) return nullptr; return &itr->second; } GameObjectLocale const* GetGameObjectLocale(uint32 entry) const { GameObjectLocaleContainer::const_iterator itr = _gameObjectLocaleStore.find(entry); - if (itr == _gameObjectLocaleStore.end()) return NULL; + if (itr == _gameObjectLocaleStore.end()) return nullptr; return &itr->second; } ItemLocale const* GetItemLocale(uint32 entry) const { ItemLocaleContainer::const_iterator itr = _itemLocaleStore.find(entry); - if (itr == _itemLocaleStore.end()) return NULL; + if (itr == _itemLocaleStore.end()) return nullptr; return &itr->second; } ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const { ItemSetNameLocaleContainer::const_iterator itr = _itemSetNameLocaleStore.find(entry); - if (itr == _itemSetNameLocaleStore.end())return NULL; + if (itr == _itemSetNameLocaleStore.end())return nullptr; return &itr->second; } PageTextLocale const* GetPageTextLocale(uint32 entry) const { PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry); - if (itr == _pageTextLocaleStore.end()) return NULL; + if (itr == _pageTextLocaleStore.end()) return nullptr; return &itr->second; } QuestLocale const* GetQuestLocale(uint32 entry) const { QuestLocaleContainer::const_iterator itr = _questLocaleStore.find(entry); - if (itr == _questLocaleStore.end()) return NULL; + if (itr == _questLocaleStore.end()) return nullptr; return &itr->second; } GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const { GossipMenuItemsLocaleContainer::const_iterator itr = _gossipMenuItemsLocaleStore.find(entry); - if (itr == _gossipMenuItemsLocaleStore.end()) return NULL; + if (itr == _gossipMenuItemsLocaleStore.end()) return nullptr; return &itr->second; } PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const { PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(poi_id); - if (itr == _pointOfInterestLocaleStore.end()) return NULL; + if (itr == _pointOfInterestLocaleStore.end()) return nullptr; return &itr->second; } QuestOfferRewardLocale const* GetQuestOfferRewardLocale(uint32 entry) const @@ -1212,7 +1212,7 @@ class ObjectMgr NpcTextLocale const* GetNpcTextLocale(uint32 entry) const { NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry); - if (itr == _npcTextLocaleStore.end()) return NULL; + if (itr == _npcTextLocaleStore.end()) return nullptr; return &itr->second; } GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; } @@ -1222,7 +1222,7 @@ class ObjectMgr { AcoreStringContainer::const_iterator itr = _acoreStringStore.find(entry); if (itr == _acoreStringStore.end()) - return NULL; + return nullptr; return &itr->second; } @@ -1258,7 +1258,7 @@ class ObjectMgr GameTele const* GetGameTele(uint32 id) const { GameTeleContainer::const_iterator itr = _gameTeleStore.find(id); - if (itr == _gameTeleStore.end()) return NULL; + if (itr == _gameTeleStore.end()) return nullptr; return &itr->second; } GameTele const* GetGameTele(std::string const& name) const; @@ -1270,7 +1270,7 @@ class ObjectMgr { CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry); if (iter == _cacheTrainerSpellStore.end()) - return NULL; + return nullptr; return &iter->second; } @@ -1279,7 +1279,7 @@ class ObjectMgr { CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry); if (iter == _cacheVendorItemStore.end()) - return NULL; + return nullptr; return &iter->second; } diff --git a/src/server/game/Grids/GridRefManager.h b/src/server/game/Grids/GridRefManager.h index aa2560444..70d5b3948 100644 --- a/src/server/game/Grids/GridRefManager.h +++ b/src/server/game/Grids/GridRefManager.h @@ -22,9 +22,9 @@ class GridRefManager : public RefManager, OBJECT> GridReference* getLast() { return (GridReference*)RefManager, OBJECT>::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); } }; #endif diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 2fcd80856..911d3f37e 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -89,7 +89,7 @@ namespace acore float i_distSq; TeamId teamId; Player const* skipped_receiver; - MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = NULL) + MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr) : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) , teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) , skipped_receiver(skipped) @@ -581,7 +581,7 @@ namespace acore { public: AnyDeadUnitSpellTargetInRangeCheck(Unit* searchObj, float range, SpellInfo const* spellInfo, SpellTargetCheckTypes check) - : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(searchObj, searchObj, spellInfo, check, NULL) + : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(searchObj, searchObj, spellInfo, check, nullptr) {} bool operator()(Player* u); bool operator()(Corpse* u); @@ -977,7 +977,7 @@ namespace acore { public: AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) - : i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range) + : i_obj(obj), i_funit(funit), _spellInfo(nullptr), i_range(range) { Unit const* check = i_funit; Unit const* owner = i_funit->GetOwner(); @@ -993,7 +993,7 @@ namespace acore if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem()) return false; - if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range)) return true; return false; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 6448f3e96..cf160fb2e 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -53,8 +53,8 @@ Loot* Roll::getLoot() Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL), - m_bfGroup(NULL), m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), -m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0), + m_bfGroup(nullptr), m_bgGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), +m_masterLooterGuid(0), m_subGroupsCounts(nullptr), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0), _difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE) { for (uint8 i = 0; i < TARGETICONCOUNT; ++i) @@ -68,8 +68,8 @@ Group::~Group() #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted."); #endif - if (m_bgGroup->GetBgRaid(TEAM_ALLIANCE) == this) m_bgGroup->SetBgRaid(TEAM_ALLIANCE, NULL); - else if (m_bgGroup->GetBgRaid(TEAM_HORDE) == this) m_bgGroup->SetBgRaid(TEAM_HORDE, NULL); + if (m_bgGroup->GetBgRaid(TEAM_ALLIANCE) == this) m_bgGroup->SetBgRaid(TEAM_ALLIANCE, nullptr); + else if (m_bgGroup->GetBgRaid(TEAM_HORDE) == this) m_bgGroup->SetBgRaid(TEAM_HORDE, nullptr); else sLog->outError("Group::~Group: battleground group is not linked to the correct battleground."); } Rolls::iterator itr; @@ -314,7 +314,7 @@ void Group::RemoveInvite(Player* player) { if (!m_invitees.empty()) m_invitees.erase(player); - player->SetGroupInvite(NULL); + player->SetGroupInvite(nullptr); } } @@ -322,7 +322,7 @@ void Group::RemoveAllInvites() { for (InvitesList::iterator itr=m_invitees.begin(); itr != m_invitees.end(); ++itr) if (*itr) - (*itr)->SetGroupInvite(NULL); + (*itr)->SetGroupInvite(nullptr); m_invitees.clear(); } @@ -334,7 +334,7 @@ Player* Group::GetInvited(uint64 guid) const if ((*itr) && (*itr)->GetGUID() == guid) return (*itr); } - return NULL; + return nullptr; } Player* Group::GetInvited(const std::string& name) const @@ -344,7 +344,7 @@ Player* Group::GetInvited(const std::string& name) const if ((*itr) && (*itr)->GetName() == name) return (*itr); } - return NULL; + return nullptr; } bool Group::AddMember(Player* player) @@ -382,7 +382,7 @@ bool Group::AddMember(Player* player) SubGroupCounterIncrease(subGroup); - player->SetGroupInvite(NULL); + player->SetGroupInvite(nullptr); if (player->GetGroup()) { if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() @@ -454,7 +454,7 @@ bool Group::AddMember(Player* player) WorldPacket groupDataPacket; // Broadcast group members' fields to player - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { if (itr->GetSource() == player) // pussywizard: no check same map, adding members is single threaded continue; @@ -522,9 +522,9 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV // Regular 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 player->UpdateForQuestWorldObjects(); @@ -727,9 +727,9 @@ void Group::Disband(bool hideDestroy /* = false */) { //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 @@ -947,7 +947,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) Roll* r = new Roll(newitemGUID, *i); //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* member = itr->GetSource(); if (!member) @@ -1031,7 +1031,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) Roll* r = new Roll(newitemGUID, *i); //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* member = itr->GetSource(); if (!member) @@ -1091,7 +1091,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); Roll* r = new Roll(newitemGUID, *i); - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* playerToRoll = itr->GetSource(); if (!playerToRoll) @@ -1165,7 +1165,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); Roll* r = new Roll(newitemGUID, *i); - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* playerToRoll = itr->GetSource(); if (!playerToRoll) @@ -1243,7 +1243,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject) WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); data << (uint8)GetMembersCount(); - 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()) @@ -1258,7 +1258,7 @@ void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject) data.put(0, real_count); - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* looter = itr->GetSource(); if (looter->IsAtGroupRewardDistance(pLootedObject)) @@ -1310,7 +1310,7 @@ bool Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling) { - CountTheRoll(rollI, NULL); + CountTheRoll(rollI, nullptr); return true; } return false; @@ -1347,7 +1347,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) { uint8 maxresul = 0; uint64 maxguid = 0; // pussywizard: start with 0 >_> - Player* player = NULL; + Player* player = nullptr; for (Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr) { @@ -1395,7 +1395,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) { item->is_blocked = false; item->rollWinnerGUID = player->GetGUID(); - player->SendEquipError(msg, NULL, NULL, roll->itemid); + player->SendEquipError(msg, nullptr, nullptr, roll->itemid); } } } @@ -1409,7 +1409,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) { uint8 maxresul = 0; uint64 maxguid = 0; // pussywizard: start with 0 - Player* player = NULL; + Player* player = nullptr; RollVote rollvote = NOT_VALID; Roll::PlayerVote::iterator itr; @@ -1463,7 +1463,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) { item->is_blocked = false; item->rollWinnerGUID = player->GetGUID(); - player->SendEquipError(msg, NULL, NULL, roll->itemid); + player->SendEquipError(msg, nullptr, nullptr, roll->itemid); } } else if (rollvote == DISENCHANT) @@ -1621,7 +1621,7 @@ void Group::UpdatePlayerOutOfRange(Player* player) player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data); Player* member; - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { member = itr->GetSource(); if (member && (!member->IsInMap(player) || !member->IsWithinDist(player, member->GetSightRange(player), false))) @@ -1631,7 +1631,7 @@ void Group::UpdatePlayerOutOfRange(Player* player) void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, uint64 ignore) { - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this)) @@ -1644,7 +1644,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* player = itr->GetSource(); if (player) @@ -1762,7 +1762,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)) @@ -1832,7 +1832,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* // check every member of the group to be able to join uint32 memberscount = 0; - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next(), ++memberscount) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next(), ++memberscount) { Player* member = itr->GetSource(); @@ -1912,7 +1912,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty) CharacterDatabase.Execute(stmt); } - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); player->SetDungeonDifficulty(difficulty); @@ -1933,7 +1933,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty) CharacterDatabase.Execute(stmt); } - for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); player->SetRaidDifficulty(difficulty); @@ -2038,7 +2038,7 @@ void Group::BroadcastGroupUpdate(void) void Group::ResetMaxEnchantingLevel() { m_maxEnchantingLevel = 0; - Player* pMember = NULL; + Player* pMember = nullptr; for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { pMember = ObjectAccessor::FindPlayer(citr->guid); @@ -2094,12 +2094,12 @@ bool Group::isRaidGroup() const bool Group::isBGGroup() const { - return m_bgGroup != NULL; + return m_bgGroup != nullptr; } bool Group::isBFGroup() const { - return m_bfGroup != NULL; + return m_bfGroup != nullptr; } bool Group::IsCreated() const diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 484e191ef..ed7b491d7 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -185,7 +185,7 @@ class Group void RemoveAllInvites(); bool AddLeaderInvite(Player* player); bool AddMember(Player* player); - bool RemoveMember(uint64 guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL); + bool RemoveMember(uint64 guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = nullptr); void ChangeLeader(uint64 guid); void SetLootMethod(LootMethod method); void SetLooterGuid(uint64 guid); @@ -256,7 +256,7 @@ class Group //void SendInit(WorldSession* session); void SendTargetIconList(WorldSession* session); void SendUpdate(); - void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL); + void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = nullptr); void UpdatePlayerOutOfRange(Player* player); // ignore: GUID of player that will be ignored void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0); @@ -299,11 +299,11 @@ class Group bool IsLfgHeroic() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_HEROIC); } // Difficulty Change - uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(NULL) ? _difficultyChangePreventionTime - time(NULL) : 0; } + uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(nullptr) ? _difficultyChangePreventionTime - time(nullptr) : 0; } DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; } void SetDifficultyChangePrevention(DifficultyPreventionChangeType type) { - _difficultyChangePreventionTime = time(NULL) + MINUTE; + _difficultyChangePreventionTime = time(nullptr) + MINUTE; _difficultyChangePreventionType = type; } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 3a4611eef..2b11f10bb 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -72,7 +72,7 @@ Group* GroupMgr::GetGroupByGUID(uint32 groupId) const if (itr != GroupStore.end()) return itr->second; - return NULL; + return nullptr; } void GroupMgr::AddGroup(Group* group) diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 0679e7cef..c60a6057b 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -193,7 +193,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data) const if (m_eventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || m_eventType == GUILD_EVENT_LOG_DEMOTE_PLAYER) data << uint8(m_newRank); // Event timestamp - data << uint32(::time(NULL) - m_timestamp); + data << uint32(::time(nullptr) - m_timestamp); } // BankEventLogEntry @@ -243,7 +243,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data) const data << uint32(m_itemOrMoney); } - data << uint32(time(NULL) - m_timestamp); + data << uint32(time(nullptr) - m_timestamp); } // RankInfo @@ -431,7 +431,7 @@ void Guild::BankTab::Delete(SQLTransaction& trans, bool removeItemsFromDB) if (removeItemsFromDB) pItem->DeleteFromDB(trans); delete pItem; - pItem = NULL; + pItem = nullptr; } } @@ -708,7 +708,7 @@ void Guild::Member::WritePacket(WorldPacket& data, bool sendOfficerNote) const << uint32(m_zoneId); if (!m_flags) - data << float(float(::time(NULL) - m_logoutTime) / DAY); + data << float(float(::time(nullptr) - m_logoutTime) / DAY); data << m_publicNote; @@ -847,16 +847,16 @@ bool Guild::PlayerMoveItemData::InitItem() if (m_pItem->IsNotEmptyBag()) { m_pPlayer->SendEquipError(EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, m_pItem); - m_pItem = NULL; + m_pItem = nullptr; } // Bound items cannot be put into bank. else if (!m_pItem->CanBeTraded()) { m_pPlayer->SendEquipError(EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, m_pItem); - m_pItem = NULL; + m_pItem = nullptr; } } - return (m_pItem != NULL); + return (m_pItem != nullptr); } void Guild::PlayerMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* /*pOther*/, uint32 splitedAmount) @@ -871,7 +871,7 @@ void Guild::PlayerMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* { m_pPlayer->MoveItemFromInventory(m_container, m_slotId, true); m_pItem->DeleteFromInventoryDB(trans); - m_pItem = NULL; + m_pItem = nullptr; } } @@ -900,7 +900,7 @@ inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* pItem, bool swa bool Guild::BankMoveItemData::InitItem() { m_pItem = m_pGuild->_GetItem(m_container, m_slotId); - return (m_pItem != NULL); + return (m_pItem != nullptr); } bool Guild::BankMoveItemData::HasStoreRights(MoveItemData* pOther) const @@ -938,7 +938,7 @@ void Guild::BankMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* pO else { m_pGuild->_RemoveItem(trans, m_container, m_slotId); - m_pItem = NULL; + m_pItem = nullptr; } // Decrease amount of player's remaining items (if item is moved to different tab or to player) if (!pOther->IsBank() || pOther->GetContainer() != m_container) @@ -948,11 +948,11 @@ void Guild::BankMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* pO Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem) { if (!pItem) - return NULL; + return nullptr; BankTab* pTab = m_pGuild->GetBankTab(m_container); if (!pTab) - return NULL; + return nullptr; Item* pLastItem = pItem; for (ItemPosCountVec::const_iterator itr = m_vec.begin(); itr != m_vec.end(); ) @@ -1013,7 +1013,7 @@ Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, if (pItem && pTab->SetItem(trans, slotId, pItem)) return pItem; - return NULL; + return nullptr; } // Tries to reserve space for source item. @@ -1053,10 +1053,10 @@ void Guild::BankMoveItemData::CanStoreItemInTab(Item* pItem, uint8 skipSlotId, b Item* pItemDest = m_pGuild->_GetItem(m_container, slotId); if (pItemDest == pItem) - pItemDest = NULL; + pItemDest = nullptr; // If merge skip empty, if not merge skip non-empty - if ((pItemDest != NULL) != merge) + if ((pItemDest != nullptr) != merge) continue; _ReserveSpace(slotId, pItem, pItemDest, count); @@ -1084,7 +1084,7 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap) Item* pItemDest = m_pGuild->_GetItem(m_container, m_slotId); // Ignore swapped item (this slot will be empty after move) if ((pItemDest == pItem) || swap) - pItemDest = NULL; + pItemDest = nullptr; if (!_ReserveSpace(m_slotId, pItem, pItemDest, count)) return EQUIP_ERR_ITEM_CANT_STACK; @@ -1117,30 +1117,30 @@ Guild::Guild(): m_createdDate(0), m_accountsNumber(0), m_bankMoney(0), - m_eventLog(NULL) + m_eventLog(nullptr) { memset(&m_bankEventLog, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(LogHolder*)); } Guild::~Guild() { - SQLTransaction temp(NULL); + SQLTransaction temp(nullptr); _DeleteBankItems(temp); // Cleanup delete m_eventLog; - m_eventLog = NULL; + m_eventLog = nullptr; for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId) { delete m_bankEventLog[tabId]; - m_bankEventLog[tabId] = NULL; + m_bankEventLog[tabId] = nullptr; } for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { delete itr->second; - itr->second = NULL; + itr->second = nullptr; } } @@ -2264,7 +2264,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) sWorld->UpdateGlobalPlayerGuild(lowguid, m_id); } - SQLTransaction trans(NULL); + SQLTransaction trans(nullptr); member->SaveToDB(trans); _UpdateAccountsNumber(); @@ -2286,8 +2286,8 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can // or when he is removed from guild by gm command if (m_leaderGuid == guid && !isDisbanding) { - Member* oldLeader = NULL; - Member* newLeader = NULL; + Member* oldLeader = nullptr; + Member* newLeader = nullptr; for (Guild::Members::iterator i = m_members.begin(); i != m_members.end(); ++i) { if (i->first == lowguid) @@ -2386,7 +2386,7 @@ void Guild::SetBankTabText(uint8 tabId, std::string const& text) if (BankTab* pTab = GetBankTab(tabId)) { pTab->SetText(text); - pTab->SendText(this, NULL); + pTab->SendText(this, nullptr); } } @@ -2487,7 +2487,7 @@ void Guild::_DeleteBankItems(SQLTransaction& trans, bool removeItemsFromDB) { m_bankTabs[tabId]->Delete(trans, removeItemsFromDB); delete m_bankTabs[tabId]; - m_bankTabs[tabId] = NULL; + m_bankTabs[tabId] = nullptr; } m_bankTabs.clear(); } @@ -2670,13 +2670,13 @@ inline Item* Guild::_GetItem(uint8 tabId, uint8 slotId) const { if (const BankTab* tab = GetBankTab(tabId)) return tab->GetItem(slotId); - return NULL; + return nullptr; } inline void Guild::_RemoveItem(SQLTransaction& trans, uint8 tabId, uint8 slotId) { if (BankTab* pTab = GetBankTab(tabId)) - pTab->SetItem(trans, slotId, NULL); + pTab->SetItem(trans, slotId, nullptr); } void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAmount) @@ -2717,7 +2717,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm } else // 6. No split { - // 6.1. Try to merge items in destination (pDest->GetItem() == NULL) + // 6.1. Try to merge items in destination (pDest->GetItem() == nullptr) if (!_DoItemsMove(pSrc, pDest, false)) // Item could not be merged { // 6.2. Try to swap items @@ -2732,7 +2732,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm if (!pDest->HasWithdrawRights(pSrc)) return; // Player has no rights to withdraw item from destination (opposite direction) - // 6.2.3. Swap items (pDest->GetItem() != NULL) + // 6.2.3. Swap items (pDest->GetItem() != nullptr) _DoItemsMove(pSrc, pDest, true); } } @@ -2743,7 +2743,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm bool Guild::_DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError, uint32 splitedAmount) { Item* pDestItem = pDest->GetItem(); - bool swap = (pDestItem != NULL); + bool swap = (pDestItem != nullptr); Item* pSrcItem = pSrc->GetItem(splitedAmount); // 1. Can store source item in destination @@ -2832,7 +2832,7 @@ void Guild::_SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) cons void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const { - _SendBankList(NULL, tabId, false, &slots); + _SendBankList(nullptr, tabId, false, &slots); } void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1, const char* param2, const char* param3) const diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 67f4e0581..f51dc6a89 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -281,7 +281,7 @@ public: // pussywizard: public class Member m_level(0), m_class(0), m_flags(GUILDMEMBER_STATUS_NONE), - m_logoutTime(::time(NULL)), + m_logoutTime(::time(nullptr)), m_accountId(0), m_rankId(rankId) { @@ -320,7 +320,7 @@ public: // pussywizard: public class Member void ChangeRank(uint8 newRank); - inline void UpdateLogoutTime() { m_logoutTime = ::time(NULL); } + inline void UpdateLogoutTime() { m_logoutTime = ::time(nullptr); } inline bool IsRank(uint8 rankId) const { return m_rankId == rankId; } inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; } inline bool IsSamePlayer(uint64 guid) const { return m_guid == guid; } @@ -354,12 +354,12 @@ public: // pussywizard: public class Member inline const Member* GetMember(uint64 guid) const { Members::const_iterator itr = m_members.find(GUID_LOPART(guid)); - return itr != m_members.end() ? itr->second : NULL; + return itr != m_members.end() ? itr->second : nullptr; } inline Member* GetMember(uint64 guid) { Members::iterator itr = m_members.find(GUID_LOPART(guid)); - return itr != m_members.end() ? itr->second : NULL; + return itr != m_members.end() ? itr->second : nullptr; } inline Member* GetMember(std::string const& name) { @@ -367,7 +367,7 @@ public: // pussywizard: public class Member if (itr->second->GetName() == name) return itr->second; - return NULL; + return nullptr; } private: @@ -375,7 +375,7 @@ private: class LogEntry { public: - LogEntry(uint32 guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(NULL)) { } + LogEntry(uint32 guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(nullptr)) { } LogEntry(uint32 guildId, uint32 guid, time_t timestamp) : m_guildId(guildId), m_guid(guid), m_timestamp(timestamp) { } virtual ~LogEntry() { } @@ -548,7 +548,7 @@ private: void SetText(std::string const& text); void SendText(const Guild* guild, WorldSession* session) const; - inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; } + inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : nullptr; } bool SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem); private: @@ -566,7 +566,7 @@ private: { public: MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player), - m_container(container), m_slotId(slotId), m_pItem(NULL), m_pClonedItem(NULL) { } + m_container(container), m_slotId(slotId), m_pItem(nullptr), m_pClonedItem(nullptr) { } virtual ~MoveItemData() { } virtual bool IsBank() const = 0; @@ -726,7 +726,7 @@ public: void MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank); template - void BroadcastWorker(Do& _do, Player* except = NULL) + void BroadcastWorker(Do& _do, Player* except = nullptr) { for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if (Player* player = itr->second->FindPlayer()) @@ -776,8 +776,8 @@ protected: private: inline uint8 _GetRanksSize() const { return uint8(m_ranks.size()); } - inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } - inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } + inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : nullptr; } + inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : nullptr; } inline bool _HasRankRight(Player* player, uint32 right) const { if (player) @@ -789,8 +789,8 @@ private: inline uint8 _GetLowestRankId() const { return uint8(m_ranks.size() - 1); } inline uint8 _GetPurchasedTabsSize() const { return uint8(m_bankTabs.size()); } - inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; } - inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; } + inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : nullptr; } + inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : nullptr; } inline void _DeleteMemberFromDB(uint32 lowguid) const { @@ -839,8 +839,8 @@ private: void _SendBankMoneyUpdate(WorldSession* session) const; void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const; void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const; - void _SendBankList(WorldSession* session = NULL, uint8 tabId = 0, bool sendFullSlots = false, SlotIds *slots = NULL) const; + void _SendBankList(WorldSession* session = NULL, uint8 tabId = 0, bool sendFullSlots = false, SlotIds *slots = nullptr) const; - void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const; + void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = nullptr) const; }; #endif diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index a59b3b5c9..b44a4a4d8 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -49,7 +49,7 @@ Guild* GuildMgr::GetGuildById(uint32 guildId) const if (itr != GuildStore.end()) return itr->second; - return NULL; + return nullptr; } Guild* GuildMgr::GetGuildByName(const std::string& guildName) const @@ -63,7 +63,7 @@ Guild* GuildMgr::GetGuildByName(const std::string& guildName) const if (search == gname) return itr->second; } - return NULL; + return nullptr; } std::string GuildMgr::GetGuildNameById(uint32 guildId) const @@ -80,7 +80,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const if (itr->second->GetLeaderGUID() == guid) return itr->second; - return NULL; + return nullptr; } void GuildMgr::LoadGuilds() diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index c50b71c79..757c515b0 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -80,7 +80,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData) uint32 arenaTeamId; // arena team id std::string invitedName; - Player* player = NULL; + Player* player = nullptr; recvData >> arenaTeamId >> invitedName; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index d8f6fabca..091c98bc6 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -278,7 +278,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData) AH->bidder = 0; AH->bid = 0; AH->buyout = buyout; - AH->expire_time = time(NULL) + auctionTime; + AH->expire_time = time(nullptr) + auctionTime; AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; @@ -320,7 +320,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData) AH->bidder = 0; AH->bid = 0; AH->buyout = buyout; - AH->expire_time = time(NULL) + auctionTime; + AH->expire_time = time(nullptr) + auctionTime; AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 58bc0504e..949f88c9e 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -77,7 +77,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) return; // chosen battleground type is disabled - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, nullptr)) { ChatHandler(this).PSendSysMessage(LANG_BG_DISABLED); return; @@ -196,7 +196,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) std::set leaderQueueTypeIds; for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) @@ -239,7 +239,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) } WorldPacket data; - 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) @@ -277,8 +277,8 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa return; uint32 flagCarrierCount = 0; - Player* allianceFlagCarrier = NULL; - Player* hordeFlagCarrier = NULL; + Player* allianceFlagCarrier = nullptr; + Player* hordeFlagCarrier = nullptr; if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE)) { @@ -609,7 +609,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) return; // arenas disabled - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, nullptr)) { ChatHandler(this).PSendSysMessage(LANG_ARENA_DISABLED); return; @@ -695,7 +695,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) std::set leaderQueueTypeIds; for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) @@ -755,7 +755,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) } WorldPacket data; - 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) diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 532ea7f31..b497a3994 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -41,7 +41,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) uint64 guid = _player->GetGUID(); sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); - time_t currTime = time(NULL); + time_t currTime = time(nullptr); WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance @@ -243,7 +243,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L))) + if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L))) { recvData.rfinish(); sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_PASSED); @@ -326,7 +326,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) catch (ByteBufferException const&) { delete calendarEvent; - calendarEvent = NULL; + calendarEvent = nullptr; throw; } @@ -376,7 +376,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L))) + if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L))) { recvData.rfinish(); return; @@ -433,7 +433,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (time_t(eventTime) < (time(NULL) - time_t(86400L))) + if (time_t(eventTime) < (time(nullptr) - time_t(86400L))) { recvData.rfinish(); sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_PASSED); @@ -617,7 +617,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) } CalendarInviteStatus status = tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP; - CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(NULL), status, CALENDAR_RANK_PLAYER, ""); + CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(nullptr), status, CALENDAR_RANK_PLAYER, ""); sCalendarMgr->AddInvite(calendarEvent, invite); sCalendarMgr->SendCalendarClearPendingAction(guid); } @@ -649,7 +649,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId)) { invite->SetStatus(CalendarInviteStatus(status)); - invite->SetStatusTime(time(NULL)); + invite->SetStatusTime(time(nullptr)); sCalendarMgr->UpdateInvite(invite); sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite); @@ -713,7 +713,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) { invite->SetStatus((CalendarInviteStatus)status); // not sure if we should set response time when moderator changes invite status - //invite->SetStatusTime(time(NULL)); + //invite->SetStatusTime(time(nullptr)); sCalendarMgr->UpdateInvite(invite); sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite); @@ -813,7 +813,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData) void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) { sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); - time_t currTime = time(NULL); + time_t currTime = time(nullptr); WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8); if (add) @@ -831,7 +831,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save, bool isExtended) { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); time_t resetTime = isExtended ? save->GetExtendedResetTime() : save->GetResetTime(); time_t resetTimeOp = isExtended ? save->GetResetTime() : save->GetExtendedResetTime(); WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 171ee44af..9d7125d39 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -109,7 +109,7 @@ bool LoginQueryHolder::Initialize() stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT); stmt->setUInt32(0, lowGuid); - stmt->setUInt64(1, uint64(time(NULL))); + stmt->setUInt64(1, uint64(time(nullptr))); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE); @@ -478,7 +478,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } _charCreateCallback.NextStage(); - HandleCharCreateCallback(PreparedQueryResult(NULL), createInfo); // Will jump to case 3 + HandleCharCreateCallback(PreparedQueryResult(nullptr), createInfo); // Will jump to case 3 } break; case 3: @@ -755,7 +755,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData) { - if (PlayerLoading() || GetPlayer() != NULL) + if (PlayerLoading() || GetPlayer() != nullptr) { sLog->outError("Player tries to login again, AccountId = %d", GetAccountId()); KickPlayer("Player tries to login again"); @@ -848,7 +848,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData) return; } - sess->SetPlayer(NULL); + sess->SetPlayer(nullptr); SetPlayer(p); p->SetSession(this); delete p->PlayerTalkClass; @@ -882,7 +882,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) // "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder)) { - SetPlayer(NULL); + SetPlayer(nullptr); KickPlayer("HandlePlayerLoginFromDB"); // disconnect client, player no set to session and it will not deleted or saved at kick delete pCurrChar; // delete it manually delete holder; // delete all unprocessed queries @@ -926,7 +926,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) if (uint32 guildId = Player::GetGuildIdFromStorage(pCurrChar->GetGUIDLow())) { Guild* guild = sGuildMgr->GetGuildById(guildId); - Guild::Member const* member = guild ? guild->GetMember(pCurrChar->GetGUID()) : NULL; + Guild::Member const* member = guild ? guild->GetMember(pCurrChar->GetGUID()) : nullptr; if (member) { pCurrChar->SetInGuild(guildId); @@ -1017,7 +1017,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) if (mapDiff->resetTime) if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) { - uint32 timeleft = uint32(timeReset - time(NULL)); + uint32 timeleft = uint32(timeReset - time(nullptr)); pCurrChar->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true); } @@ -1026,7 +1026,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) if (!t->IsInMap(pCurrChar)) { t->RemovePassenger(pCurrChar); - pCurrChar->m_transport = NULL; + pCurrChar->m_transport = nullptr; pCurrChar->m_movementInfo.transport.Reset(); pCurrChar->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -1186,7 +1186,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) if ((isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId()) || (!isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId())) { Player * rf = itr->second->GetPlayer(); - if (rf != NULL) + if (rf != nullptr) { pCurrChar->SendUpdateToPlayer(rf); rf->SendUpdateToPlayer(pCurrChar); @@ -1309,7 +1309,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar) if (mapDiff->resetTime) if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) { - uint32 timeleft = uint32(timeReset - time(NULL)); + uint32 timeleft = uint32(timeReset - time(nullptr)); GetPlayer()->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true); } @@ -1976,7 +1976,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) if (_player->IsInCombat() && i != EQUIPMENT_SLOT_MAINHAND && i != EQUIPMENT_SLOT_OFFHAND && i != EQUIPMENT_SLOT_RANGED) continue; - Item* item = NULL; + Item* item = nullptr; if (itemGuid > 0) item = _player->GetItemByGuid(itemGuid); @@ -1989,7 +1989,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) if (uItem->IsEquipped()) { msg = _player->CanUnequipItem(dstpos, true); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, uItem, NULL); + _player->SendEquipError(msg, uItem, nullptr); continue; } } @@ -2004,7 +2004,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) _player->StoreItem(sDest, uItem, true); } else - _player->SendEquipError(msg, uItem, NULL); + _player->SendEquipError(msg, uItem, nullptr); continue; } @@ -2018,7 +2018,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) uint16 _candidatePos; msg = _player->CanEquipItem(NULL_SLOT, _candidatePos, item, true); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, item, NULL); + _player->SendEquipError(msg, item, nullptr); continue; } } diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 9d30328f0..2daeeb9ee 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -294,7 +294,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) if (!_player->CanSpeak()) { - std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); + std::string timeStr = secsToTimeString(m_muteTime - time(nullptr)); SendNotification(GetAcoreString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); return; } @@ -692,7 +692,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData) if (!GetPlayer()->CanSpeak()) { - std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); + std::string timeStr = secsToTimeString(m_muteTime - time(nullptr)); SendNotification(GetAcoreString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); return; } diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index f0b40ab32..288fa5bc4 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -30,7 +30,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) if (!pEnemy) { // stop attack state at client - SendAttackStop(NULL); + SendAttackStop(nullptr); return; } diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 806d96dae..24b124594 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -35,7 +35,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); #endif - time_t now = time(NULL); + time_t now = time(nullptr); player->duel->startTimer = now; plTarget->duel->startTimer = now; diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 8863d3673..6fb61eaa9 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -546,7 +546,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData) // Player <-> Bank // Allow to work with inventory only if (!Player::IsInventoryPos(playerBag, playerSlotId) && !(playerBag == NULL_BAG && playerSlotId == NULL_SLOT)) - GetPlayer()->SendEquipError(EQUIP_ERR_NONE, NULL); + GetPlayer()->SendEquipError(EQUIP_ERR_NONE, nullptr); else guild->SwapItemsWithInventory(GetPlayer(), toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount); } diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 12094dc5e..bde1340f5 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -36,13 +36,13 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData) if (!_player->IsValidPos(srcbag, srcslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, 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, NULL, nullptr); return; } @@ -63,13 +63,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData) 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, NULL, 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, NULL, nullptr); return; } @@ -127,13 +127,13 @@ void WorldSession::HandleSwapItem(WorldPacket & recvData) if (!_player->IsValidPos(srcbag, srcslot, true)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, 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, NULL, nullptr); return; } @@ -168,7 +168,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData) 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; } @@ -191,7 +191,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData) msg = _player->CanUnequipItem(dest, !pSrcItem->IsBag()); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pDstItem, NULL); + _player->SendEquipError(msg, pDstItem, nullptr); return; } @@ -265,7 +265,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData) 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; } } @@ -273,13 +273,13 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData) Item* pItem = _player->GetItemByPos(bag, slot); if (!pItem) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } if (pItem->GetTemplate()->Flags & ITEM_FLAG_NO_USER_DESTROY) { - _player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, nullptr); return; } @@ -615,13 +615,13 @@ void WorldSession::HandleReadItem(WorldPacket & recvData) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDetail("STORAGE: Unable to read item"); #endif - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); } data << pItem->GetGUID(); SendPacket(&data); } else - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); } void WorldSession::HandleSellItemOpcode(WorldPacket & recvData) @@ -800,7 +800,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recvData) _player->StoreItem(dest, pItem, true); } else - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } else @@ -1005,7 +1005,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData) 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, NULL, nullptr); return; } @@ -1017,7 +1017,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData) InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src)); if (msg != EQUIP_ERR_OK) { - _player->SendEquipError(msg, pItem, NULL); + _player->SendEquipError(msg, pItem, nullptr); return; } } @@ -1026,7 +1026,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData) 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; } @@ -1034,7 +1034,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData) if (dest.size() == 1 && dest[0].pos == src) { // just remove grey item state - _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + _player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); return; } @@ -1122,13 +1122,13 @@ 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; } if (dest.size() == 1 && dest[0].pos == pItem->GetPos()) { - _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + _player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); return; } @@ -1166,7 +1166,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; } @@ -1180,7 +1180,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; } @@ -1194,7 +1194,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData) { if (!_player->IsAlive()) { - _player->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, nullptr); return; } @@ -1209,7 +1209,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData) { if (!_player->GetItemCount(item)) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } @@ -1284,13 +1284,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) 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; } if (!(gift->GetTemplate()->Flags & ITEM_FLAG_IS_WRAPPER)) // cheating: non-wrapper wrapper { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr); return; } @@ -1298,57 +1298,57 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) if (!item) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr); return; } // xinef: do not allow to wrap removed items, just in case if (item->GetState() == ITEM_REMOVED) { - _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr); return; } if (item == gift) // not possable with pacjket 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->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_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->GetTemplate()->MaxCount>0) { - _player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL); + _player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, nullptr); return; } @@ -1419,11 +1419,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) Item* Gems[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) - Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : NULL; + Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : nullptr; GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage - GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : NULL; + GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : nullptr; // Find first prismatic socket int32 firstPrismatic = 0; @@ -1484,7 +1484,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { if (iGemProto->ItemId == Gems[j]->GetEntry()) { - _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr); return; } } @@ -1494,7 +1494,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { if (iGemProto->ItemId == enchantEntry->GemID) { - _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr); return; } } @@ -1529,7 +1529,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount) { - _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL); + _player->SendEquipError(EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, nullptr); return; } } @@ -1540,7 +1540,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { if (InventoryResult res = _player->CanEquipUniqueItem(Gems[i], slot, std::max(limit_newcount, 0))) { - _player->SendEquipError(res, itemTarget, NULL); + _player->SendEquipError(res, itemTarget, nullptr); return; } } diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index ac0c80258..e7621c48d 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -199,7 +199,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* { data << uint32(*it); // Dungeon Entry (id + type) lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level); - Quest const* quest = NULL; + Quest const* quest = nullptr; bool done = false; if (reward) { @@ -259,7 +259,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* // Get the locked dungeons of the other party members lfg::LfgLockPartyMap lockMap; - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* plrg = itr->GetSource(); if (!plrg) @@ -548,7 +548,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) lfg::LfgAnswer playerVote = boot.votes.find(guid)->second; uint8 votesNum = 0; uint8 agreeNum = 0; - uint32 secsleft = boot.cancelTime - time(NULL); + uint32 secsleft = boot.cancelTime - time(nullptr); for (lfg::LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it) { if (it->second != lfg::LFG_ANSWER_PENDING) diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 14c091814..32066cba5 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -32,7 +32,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) #endif Player* player = GetPlayer(); uint64 lguid = player->GetLootGUID(); - Loot* loot = NULL; + Loot* loot = nullptr; uint8 lootSlot = 0; recvData >> lootSlot; @@ -42,7 +42,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) GameObject* go = player->GetMap()->GetGameObject(lguid); // xinef: cheating protection //if (player->GetGroup() && player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGUID() != player->GetGroup()->GetMasterLooterGuid()) - // go = NULL; + // go = nullptr; // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player, INTERACTION_DISTANCE))) @@ -108,7 +108,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/) if (!guid) return; - Loot* loot = NULL; + Loot* loot = nullptr; bool shareMoney = true; switch (GUID_HIPART(guid)) @@ -171,7 +171,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/) 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* member = itr->GetSource(); if (!member) @@ -392,7 +392,7 @@ void WorldSession::DoLootRelease(uint64 lguid) if (Group* group = player->GetGroup()) { - 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); @@ -442,7 +442,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) return; } - Loot* loot = NULL; + Loot* loot = nullptr; if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID())) { @@ -487,7 +487,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) else _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); - target->SendEquipError(msg, NULL, NULL, item.itemid); + target->SendEquipError(msg, nullptr, nullptr, item.itemid); return; } diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 0bb0a9087..06b6868a6 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -383,7 +383,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recvData) Player* player = _player; Mail* m = player->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)) { player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR); return; @@ -448,7 +448,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData) Player* player = _player; Mail* m = player->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)) { player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -548,7 +548,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData) Player* player = _player; Mail* m = player->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)) { player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR); return; @@ -594,7 +594,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData) WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size data << uint32(0); // real mail's count data << uint8(0); // mail's count - time_t cur_time = time(NULL); + time_t cur_time = time(nullptr); for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr) { @@ -652,7 +652,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData) data << uint32((*itr)->stationery); // stationery (Stationery.dbc) data << uint32((*itr)->money); // Gold data << uint32((*itr)->checked); // flags - data << float(float((*itr)->expire_time-time(NULL))/DAY); // Time + data << float(float((*itr)->expire_time-time(nullptr))/DAY); // Time data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc) data << subject; // Subject string - once 00, when mail type = 3, max 256 data << body; // message? max 8000 @@ -716,7 +716,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recvData) Player* player = _player; Mail* m = player->GetMail(mailId); - if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL) || (m->checked & MAIL_CHECK_MASK_COPIED)) + if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || (m->checked & MAIL_CHECK_MASK_COPIED)) { player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR); return; @@ -784,7 +784,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/) data << uint32(0); // count uint32 count = 0; - time_t now = time(NULL); + time_t now = time(nullptr); std::set sentSenders; for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index c4997c985..f4acd35d4 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -80,7 +80,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) #endif //this is spirit release confirm? - GetPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true); GetPlayer()->BuildPlayerRepop(); GetPlayer()->RepopAtGraveyard(); } @@ -101,9 +101,9 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId)) recv_data >> code; - Creature* unit = NULL; - GameObject* go = NULL; - Item* item = NULL; + Creature* unit = nullptr; + GameObject* go = nullptr; + Item* item = nullptr; if (IS_CRE_OR_VEH_GUID(guid)) { unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); @@ -218,7 +218,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); - time_t now = time(NULL); + time_t now = time(nullptr); if (now < timeWhoCommandAllowed) return; timeWhoCommandAllowed = now + 3; @@ -472,7 +472,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - LogoutRequest(time(NULL)); + LogoutRequest(time(nullptr)); } void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/) @@ -830,7 +830,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) return; // prevent resurrect before 30-sec delay after body release not finished - if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(time(NULL))) + if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(time(nullptr))) return; if (!corpse->IsWithinDistInMap(_player, CORPSE_RECLAIM_RADIUS, true)) @@ -1568,7 +1568,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) { if (group->IsLeader(_player->GetGUID())) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupGuy = itr->GetSource(); if (!groupGuy) @@ -1576,13 +1576,13 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) if (!groupGuy->IsInWorld()) { - _player->SendDungeonDifficulty(group != NULL); + _player->SendDungeonDifficulty(group != nullptr); return; } if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsNonRaidDungeon()) { - _player->SendDungeonDifficulty(group != NULL); + _player->SendDungeonDifficulty(group != nullptr); return; } } @@ -1595,7 +1595,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) { if (_player->FindMap() && _player->FindMap()->IsDungeon()) { - _player->SendDungeonDifficulty(group != NULL); + _player->SendDungeonDifficulty(group != nullptr); return; } Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, false); @@ -1625,7 +1625,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) { std::set foundMaps; std::set foundMapsPtr; - Map* currMap = NULL; + Map* currMap = nullptr; if (uint32 preventionTime = group->GetDifficultyChangePreventionTime()) { @@ -1640,11 +1640,11 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) break; } - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupGuy = itr->GetSource(); if (!groupGuy) @@ -1652,7 +1652,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (!groupGuy->IsInWorld()) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } @@ -1664,7 +1664,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) foundMapsPtr.insert(groupGuy->GetMap()); if (foundMaps.size() > 1 || foundMapsPtr.size() > 1) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } @@ -1672,19 +1672,19 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false)) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } } else if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsRaid()) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } } - Map* homeMap571 = sMapMgr->CreateMap(571, NULL); - Map* homeMap0 = sMapMgr->CreateMap(0, NULL); + Map* homeMap571 = sMapMgr->CreateMap(571, nullptr); + Map* homeMap0 = sMapMgr->CreateMap(0, nullptr); ASSERT(homeMap0 && homeMap571); std::map playerTeleport; @@ -1697,7 +1697,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || (!p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } playerTeleport[p]; @@ -1717,7 +1717,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) bool anyoneInside = false; playerTeleport.clear(); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupGuy = itr->GetSource(); if (!groupGuy) @@ -1757,7 +1757,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) { if (_player->FindMap() && _player->FindMap()->IsDungeon()) { - _player->SendRaidDifficulty(group != NULL); + _player->SendRaidDifficulty(group != nullptr); return; } Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, true); @@ -1863,7 +1863,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/) #endif WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4); - data << uint32(time(NULL)); + data << uint32(time(nullptr)); SendPacket(&data); } @@ -1996,7 +1996,7 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) recvPacket >> moveStop; Unit* caster = ObjectAccessor::GetUnit(*_player, guid); - Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL; + Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr; if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc()) { recvPacket.rfinish(); diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index d4f063f1a..78557ce51 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -107,7 +107,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if (!t->IsInMap(_player)) { t->RemovePassenger(_player); - _player->m_transport = NULL; + _player->m_transport = nullptr; _player->m_movementInfo.transport.Reset(); _player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } @@ -152,7 +152,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() _player->SetIsSpectator(false); GetPlayer()->SetPendingSpectatorForBG(0); - timeWhoCommandAllowed = time(NULL) + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update + timeWhoCommandAllowed = time(nullptr) + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update if (uint32 inviteInstanceId = _player->GetPendingSpectatorInviteInstanceId()) { @@ -193,7 +193,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if (mapDiff->resetTime) if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff)) { - uint32 timeleft = uint32(timeReset - time(NULL)); + uint32 timeleft = uint32(timeReset - time(nullptr)); GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true); } allowMount = mInstance->AllowMount; @@ -389,7 +389,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) if (!foundNewTransport) { - plrMover->m_transport = NULL; + plrMover->m_transport = nullptr; movementInfo.transport.Reset(); } } @@ -401,7 +401,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave { plrMover->m_transport->RemovePassenger(plrMover); - plrMover->m_transport = NULL; + plrMover->m_transport = nullptr; movementInfo.transport.Reset(); } diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index f634aed5c..b61f97a81 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -447,7 +447,7 @@ void WorldSession::SendSpiritResurrect() _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard - GraveyardStruct const* corpseGrave = NULL; + GraveyardStruct const* corpseGrave = nullptr; Corpse* corpse = _player->GetCorpse(); if (corpse) corpseGrave = sGraveyard->GetClosestGraveyard(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeamId()); diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index a15ff9bef..126a3a52d 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -51,7 +51,7 @@ bool LoadPetFromDBQueryHolder::Initialize() SetSize(MAX_PET_LOAD_QUERY); bool res = true; - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_AURA); stmt->setUInt32(0, m_petNumber); @@ -128,7 +128,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, Map* map = owner->GetMap(); uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET); Pet* pet = new Pet(owner, pet_type); - LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(NULL) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana); + LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(nullptr) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana); if (!pet->Create(guid, map, owner->GetPhaseMask(), petentry, pet_number) || !holder->Initialize()) { delete pet; @@ -200,7 +200,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, break; } - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped here pet->SetCreatorGUID(owner->GetGUID()); owner->SetMinion(pet, true); @@ -411,7 +411,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData) if (!pet->IsAlive()) { // xinef: allow dissmis dead pets - SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : NULL; + SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : nullptr; if ((flag != ACT_COMMAND || spellid != COMMAND_ABANDON) && (!spell || !spell->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD))) return; } @@ -661,7 +661,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid case ACT_PASSIVE: // 0x01 case ACT_ENABLED: // 0xC1 spell { - Unit* unit_target = NULL; + Unit* unit_target = nullptr; // do not cast unknown spells SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); @@ -849,7 +849,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid pet->AttackStop(); } else - victim = NULL; + victim = nullptr; if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature() && pet->ToCreature()->IsAIEnabled) { @@ -1143,13 +1143,13 @@ void WorldSession::HandlePetRename(WorldPacket & recvData) PetNameInvalidReason res = ObjectMgr::CheckPetName(name); if (res != PET_NAME_SUCCESS) { - SendPetNameInvalid(res, name, NULL); + SendPetNameInvalid(res, name, nullptr); return; } if (sObjectMgr->IsReservedName(name)) { - SendPetNameInvalid(PET_NAME_RESERVED, name, NULL); + SendPetNameInvalid(PET_NAME_RESERVED, name, nullptr); return; } @@ -1204,7 +1204,7 @@ void WorldSession::HandlePetRename(WorldPacket & recvData) CharacterDatabase.CommitTransaction(trans); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped } void WorldSession::HandlePetAbandon(WorldPacket & recvData) diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 959721ff1..cf32e25b2 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -181,7 +181,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData) 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/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 91c33b8f1..20c786309 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -43,7 +43,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) // pussywizard: optimization /*Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - if (DeclinedName const* names = (player ? player->GetDeclinedNames() : NULL)) + if (DeclinedName const* names = (player ? player->GetDeclinedNames() : nullptr)) { data << uint8(1); // Name is declined for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) @@ -74,8 +74,8 @@ void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/) void WorldSession::SendQueryTimeResponse() { WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4); - data << uint32(time(NULL)); - data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(NULL)); + data << uint32(time(nullptr)); + data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(nullptr)); SendPacket(&data); } diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index a63284250..c77d63681 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -168,7 +168,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData) { if (Group* group = _player->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* itrPlayer = itr->GetSource(); if (!itrPlayer || itrPlayer == _player || !itrPlayer->IsAtGroupRewardDistance(_player) || itrPlayer->HasPendingBind()) // xinef: check range @@ -478,7 +478,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) return; if (_player->CanAddQuest(quest, true)) - _player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running + _player->AddQuestAndCheckCompletion(quest, nullptr); // NULL, this prevent DB script from duplicate running _player->SetDivider(0); } @@ -556,7 +556,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) { if (Group* group = _player->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 49a2f539d..4fa22c252 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -68,20 +68,20 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (glyphIndex >= MAX_GLYPH_SLOT_INDEX) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot); if (!pItem) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } if (pItem->GetGUID() != itemGUID) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } @@ -92,35 +92,35 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } // some item classes can be used only in equipped state if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped()) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr); return; } InventoryResult msg = pUser->CanUseItem(pItem); if (msg != EQUIP_ERR_OK) { - pUser->SendEquipError(msg, pItem, NULL); + pUser->SendEquipError(msg, pItem, nullptr); return; } // only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB) if (proto->Class == ITEM_CLASS_CONSUMABLE && !(proto->Flags & ITEM_FLAG_IGNORE_DEFAULT_ARENA_RESTRICTIONS) && pUser->InArena()) { - pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr); return; } // don't allow items banned in arena if (proto->Flags & ITEM_FLAG_NOT_USEABLE_IN_ARENA && pUser->InArena()) { - pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr); return; } @@ -132,7 +132,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) { if (!spellInfo->CanBeUsedInCombat()) { - pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL); + pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, nullptr); return; } } @@ -177,7 +177,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) // xinef: additional check, client outputs message on its own if (!pUser->IsAlive()) { - pUser->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, nullptr); return; } @@ -192,21 +192,21 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) Item* item = pUser->GetItemByPos(bagIndex, slot); if (!item) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } ItemTemplate const* proto = item->GetTemplate(); if (!proto) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr); return; } // Verify that the bag is an actual bag or wrapped item that can be used "normally" if (!(proto->Flags & ITEM_FLAG_HAS_LOOT) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED)) { - pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); + pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId); return; @@ -220,7 +220,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr); sLog->outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); return; } @@ -228,7 +228,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) // was not unlocked yet if (item->IsLocked()) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr); return; } } diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 9308c319e..b4a2854bf 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -116,7 +116,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR; if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) { - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetMessage(message); ticket->SaveToDB(trans); @@ -141,7 +141,7 @@ void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/) sWorld->SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName().c_str(), ticket->GetId()); sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID()); - sTicketMgr->SendTicket(this, NULL); + sTicketMgr->SendTicket(this, nullptr); } } @@ -157,7 +157,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/) sTicketMgr->SendTicket(this, ticket); } else - sTicketMgr->SendTicket(this, NULL); + sTicketMgr->SendTicket(this, nullptr); } void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/) @@ -237,7 +237,7 @@ void WorldSession::HandleReportLag(WorldPacket& recv_data) stmt->setFloat (4, y); stmt->setFloat (5, z); stmt->setUInt32(6, GetLatency()); - stmt->setUInt32(7, time(NULL)); + stmt->setUInt32(7, time(nullptr)); CharacterDatabase.Execute(stmt); } @@ -259,6 +259,6 @@ void WorldSession::HandleGMResponseResolve(WorldPacket& /*recvPacket*/) SendPacket(&data2); sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID()); - sTicketMgr->SendTicket(this, NULL); + sTicketMgr->SendTicket(this, nullptr); } } diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index c9659a438..da1b3f38b 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -255,8 +255,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 for propertly undo at problems (it already set in to client) @@ -280,14 +280,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (_player->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - his_trade->GetMoney()) { - _player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); + _player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, nullptr); my_trade->SetAccepted(false, true); return; } if (trader->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - my_trade->GetMoney()) { - trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); + trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, nullptr); his_trade->SetAccepted(false, true); return; } @@ -331,10 +331,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) @@ -486,9 +486,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 (SaveInventoryAndGoldToDB() not have own transaction guards) SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -718,5 +718,5 @@ void WorldSession::HandleClearTradeItemOpcode(WorldPacket& recvPacket) if (tradeSlot >= TRADE_SLOT_COUNT) return; - my_trade->SetItem(TradeSlots(tradeSlot), NULL); + my_trade->SetItem(TradeSlots(tradeSlot), nullptr); } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index ca06d7832..e4b9d94d9 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -60,19 +60,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance if (!entry) { sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); - return NULL; + return nullptr; } if (instanceId == 0) { sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); - return NULL; + return nullptr; } if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); - return NULL; + return nullptr; } time_t resetTime, extendedResetTime; @@ -83,7 +83,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance } else { - resetTime = time(NULL) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup + resetTime = time(nullptr) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup extendedResetTime = 0; } InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, extendedResetTime); @@ -97,7 +97,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance InstanceSave* InstanceSaveManager::GetInstanceSave(uint32 InstanceId) { InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(InstanceId); - return itr != m_instanceSaveById.end() ? itr->second : NULL; + return itr != m_instanceSaveById.end() ? itr->second : nullptr; } bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(uint32 InstanceId, bool skipMapCheck) @@ -245,7 +245,7 @@ void InstanceSaveManager::LoadInstances() void InstanceSaveManager::LoadResetTimes() { - time_t now = time(NULL); + time_t now = time(nullptr); time_t today = (now / DAY) * DAY; // load the global respawn times for raid/heroic instances @@ -410,7 +410,7 @@ void InstanceSaveManager::ScheduleReset(time_t time, InstResetEvent event) void InstanceSaveManager::Update() { - time_t now = time(NULL); + time_t now = time(nullptr); time_t t; bool resetOccurred = false; @@ -509,7 +509,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b if (!mapEntry->Instanceable()) return; - time_t now = time(NULL); + time_t now = time(nullptr); if (!warn) { @@ -573,7 +573,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b else { InstanceSave* save = GetInstanceSave(map2->GetInstanceId()); - map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : NULL)); + map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : nullptr)); } } } @@ -696,20 +696,20 @@ InstancePlayerBind* InstanceSaveManager::PlayerGetBoundInstance(uint32 guidLow, MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty_fixed); if (!mapDiff) - return NULL; + return nullptr; - BoundInstancesMapWrapper* w = NULL; + BoundInstancesMapWrapper* w = nullptr; PlayerBindStorage::const_iterator itr = playerBindStorage.find(guidLow); if (itr != playerBindStorage.end()) w = itr->second; else - return NULL; + return nullptr; BoundInstancesMap::iterator itr2 = w->m[difficulty_fixed].find(mapid); if (itr2 != w->m[difficulty_fixed].end()) return &itr2->second; else - return NULL; + return nullptr; } bool InstanceSaveManager::PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty) @@ -737,7 +737,7 @@ void InstanceSaveManager::PlayerCreateBoundInstancesMaps(uint32 guidLow) InstanceSave* InstanceSaveManager::PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty) { InstancePlayerBind* pBind = PlayerGetBoundInstance(guidLow, mapid, difficulty); - return (pBind ? pBind->save : NULL); + return (pBind ? pBind->save : nullptr); } uint32 InstanceSaveManager::PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty) diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index de7c426f0..a57daed61 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -30,7 +30,7 @@ struct InstancePlayerBind InstanceSave* save; bool perm : 1; bool extended : 1; - InstancePlayerBind() : save(NULL), perm(false), extended(false) {} + InstancePlayerBind() : save(nullptr), perm(false), extended(false) {} }; typedef std::unordered_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; @@ -163,16 +163,16 @@ class InstanceSaveManager InstanceSave* GetInstanceSave(uint32 InstanceId); - InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = NULL); - void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = NULL); - void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = NULL); + InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = nullptr); + void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = nullptr); + void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = nullptr); InstancePlayerBind* PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); bool PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); BoundInstancesMap const& PlayerGetBoundInstances(uint32 guidLow, Difficulty difficulty); void PlayerCreateBoundInstancesMaps(uint32 guidLow); InstanceSave* PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty); uint32 PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty); - void CopyBinds(uint32 from, uint32 to, Player* toPlr = NULL); + void CopyBinds(uint32 from, uint32 to, Player* toPlr = nullptr); void UnbindAllFor(InstanceSave* save); protected: diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 197f1e56e..d9cc209c5 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -100,7 +100,7 @@ void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state) if (!minion->IsAlive()) minion->Respawn(); else if (!minion->GetVictim()) - minion->AI()->DoZoneInCombat(NULL, 100.0f); + minion->AI()->DoZoneInCombat(nullptr, 100.0f); break; default: break; @@ -233,7 +233,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) std::string InstanceScript::LoadBossState(const char * data) { if (!data) - return NULL; + return nullptr; std::istringstream loadStream(data); uint32 buff; uint32 bossId = 0; diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 70dde15d4..5d2c535ad 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -155,8 +155,8 @@ class InstanceScript : public ZoneScript //Handle open / close objects //use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts - //use HandleGameObject(GUID, boolen, NULL); in any other script - void HandleGameObject(uint64 guid, bool open, GameObject* go = NULL); + //use HandleGameObject(GUID, boolen, nullptr); in any other script + void HandleGameObject(uint64 guid, bool open, GameObject* go = nullptr); //change active state of doors or buttons void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); @@ -171,7 +171,7 @@ class InstanceScript : public ZoneScript void DoSendNotifyToInstance(char const* format, ...); // Update Achievement Criteria for all players in instance - void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL); + void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr); // Start/Stop Timed Achievement Criteria for all players in instance void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); @@ -189,7 +189,7 @@ class InstanceScript : public ZoneScript virtual bool SetBossState(uint32 id, EncounterState state); EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; } static std::string GetBossStateName(uint8 state); - BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; } + BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : nullptr; } BossInfo const* GetBossInfo(uint32 id) const { return &bosses[id]; } // Achievement criteria additional requirements check @@ -197,7 +197,7 @@ class InstanceScript : public ZoneScript virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0); // Checks boss requirements (one boss required to kill other) - virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = NULL) const { return true; } + virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = nullptr) const { return true; } void SetCompletedEncountersMask(uint32 newMask, bool save); @@ -238,7 +238,7 @@ AI* GetInstanceAI(T* obj, char const* scriptName) if (instance->GetScriptId() == sObjectMgr->GetScriptId(scriptName)) return new AI(obj); - return NULL; + return nullptr; }; template @@ -248,7 +248,7 @@ AI* GetInstanceAI(T* obj) if (instance->GetInstanceScript()) return new AI(obj); - return NULL; + return nullptr; }; #endif diff --git a/src/server/game/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index f64edb309..64744b539 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.cpp @@ -72,7 +72,7 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/) } SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; StoredLootItemList& itemList = lootItemStore[loot->containerId]; diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 8b1a833df..db671973a 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -232,7 +232,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; } @@ -242,7 +242,7 @@ LootTemplate* LootStore::GetLootForConditionFill(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; } @@ -481,7 +481,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo { roundRobinPlayer = lootOwner->GetGUID(); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* player = itr->GetSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter if (player->IsInMap(lootOwner)) // pussywizard: multithreading crashfix FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner)); @@ -522,7 +522,7 @@ void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting) // Process currency items uint32 max_slot = GetMaxSlotInLootFor(player); - LootItem const* item = NULL; + LootItem const* item = nullptr; uint32 itemsSize = uint32(items.size()); for (uint32 i = 0; i < max_slot; ++i) { @@ -554,7 +554,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) if (ql->empty()) { delete ql; - return NULL; + return nullptr; } PlayerFFAItems[player->GetGUIDLow()] = ql; @@ -564,7 +564,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { if (items.size() == MAX_NR_LOOT_ITEMS) - return NULL; + return nullptr; QuestItemList* ql = new QuestItemList(); @@ -592,7 +592,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) if (ql->empty()) { delete ql; - return NULL; + return nullptr; } PlayerQuestItems[player->GetGUIDLow()] = ql; @@ -624,7 +624,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres if (ql->empty()) { delete ql; - return NULL; + return nullptr; } PlayerNonQuestNonFFAConditionalItems[player->GetGUIDLow()] = ql; @@ -713,7 +713,7 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem) { - LootItem* item = NULL; + LootItem* item = nullptr; bool is_looted = true; if (lootSlot >= items.size()) { @@ -726,7 +726,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qite *qitem = qitem2; item = &quest_items[qitem2->index]; if (item->follow_loot_rules && !item->AllowedForPlayer(player)) // pussywizard: such items (follow_loot_rules) are added to every player, but not everyone is allowed, check it here - return NULL; + return nullptr; is_looted = qitem2->is_looted; } } @@ -771,7 +771,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qite } if (is_looted) - return NULL; + return nullptr; return item; } @@ -1143,7 +1143,7 @@ LootStoreItem const* LootTemplate::LootGroup::Roll(Loot& loot, Player const *pla if (!possibleLoot.empty()) // If nothing selected yet - an item is taken from equal-chanced part return acore::Containers::SelectRandomContainerElement(possibleLoot); - return NULL; // Empty drop from the group + return nullptr; // Empty drop from the group } // True if group includes at least 1 quest drop entry @@ -1277,7 +1277,7 @@ void LootTemplate::AddEntry(LootStoreItem* item) if (item->groupid > 0 && item->reference == 0) // Group { if (item->groupid >= Groups.size()) - Groups.resize(item->groupid, NULL); // Adds new group the the loot template if needed + Groups.resize(item->groupid, nullptr); // Adds new group the the loot template if needed if (!Groups[item->groupid - 1]) Groups[item->groupid - 1] = new LootGroup(); diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index d402d89aa..e80ccaf4b 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -202,7 +202,7 @@ class LootStore void ResetConditions(); void Verify() const; - 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 ReportNonExistingId(uint32 lootId) const; void ReportNonExistingId(uint32 lootId, const char* ownerType, uint32 ownerId) const; @@ -284,9 +284,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); } }; //===================================================== @@ -362,7 +362,7 @@ struct Loot // Inserts the item into the loot (called by LootTemplate processors) void AddItem(LootStoreItem const & item); - LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL); + LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = nullptr); uint32 GetMaxSlotInLootFor(Player* player) const; bool hasItemFor(Player* player) const; bool hasOverThresholdItem() const; diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 973a98f6f..a8d1ebbd3 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -184,7 +184,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, uint32 mailId = sObjectMgr->GenerateMailID(); - time_t deliver_time = time(NULL) + deliver_delay; + time_t deliver_time = time(nullptr) + deliver_delay; //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour uint32 expire_delay; @@ -280,13 +280,13 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, } else if (!m_items.empty()) { - SQLTransaction temp = SQLTransaction(NULL); + SQLTransaction temp = SQLTransaction(nullptr); deleteIncludedItems(temp); } } else if (!m_items.empty()) { - SQLTransaction temp = SQLTransaction(NULL); + SQLTransaction temp = SQLTransaction(nullptr); deleteIncludedItems(temp); } } diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h index 074109935..fe075e3c7 100644 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -91,7 +91,7 @@ class MailSender class MailReceiver { public: // Constructors - explicit MailReceiver(uint32 receiver_lowguid) : m_receiver(NULL), m_receiver_lowguid(receiver_lowguid) {} + explicit MailReceiver(uint32 receiver_lowguid) : m_receiver(nullptr), m_receiver_lowguid(receiver_lowguid) {} MailReceiver(Player* receiver); MailReceiver(Player* receiver, uint32 receiver_lowguid); public: // Accessors diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 8e8323b55..520cedef2 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -229,7 +229,7 @@ _transportsUpdateIter(_transports.end()), i_scriptLock(false), _defaultLight(Get { //z code GridMaps[idx][j] =NULL; - setNGrid(NULL, idx, j); + setNGrid(nullptr, idx, j); } } @@ -323,7 +323,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); #endif NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(ngrid != NULL); + ASSERT(ngrid != nullptr); GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY()); @@ -360,7 +360,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) //TC_LOG_DEBUG(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(ngrid != NULL); + ASSERT(ngrid != nullptr); GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY()); @@ -440,7 +440,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - ASSERT(grid != NULL); + ASSERT(grid != nullptr); if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY())) { //if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY())) @@ -1184,7 +1184,7 @@ bool Map::UnloadGrid(NGridType& ngrid) ASSERT(i_objectsToRemove.empty()); delete &ngrid; - setNGrid(NULL, x, y); + setNGrid(nullptr, x, y); int gx = (MAX_NUMBER_OF_GRIDS - 1) - x; int gy = (MAX_NUMBER_OF_GRIDS - 1) - y; @@ -1201,7 +1201,7 @@ bool Map::UnloadGrid(NGridType& ngrid) MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId(), gx, gy); } - GridMaps[gx][gy] = NULL; + GridMaps[gx][gy] = nullptr; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId()); @@ -1941,7 +1941,7 @@ Transport* Map::GetTransportForPos(uint32 phase, float x, float y, float z, Worl return staticTrans->ToTransport(); } - return NULL; + return nullptr; } float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const @@ -2536,7 +2536,7 @@ template void Map::RemoveFromMap(DynamicObject*, bool); InstanceMap::InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent) : Map(id, InstanceId, SpawnMode, _parent), m_resetAfterUnload(false), m_unloadWhenEmpty(false), - instance_script(NULL), i_script_id(0) + instance_script(nullptr), i_script_id(0) { //lets initialize visibility distance for dungeons InstanceMap::InitVisibilityDistance(); @@ -2555,7 +2555,7 @@ InstanceMap::InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _pa InstanceMap::~InstanceMap() { delete instance_script; - instance_script = NULL; + instance_script = nullptr; sInstanceSaveMgr->DeleteInstanceSaveIfNeeded(GetInstanceId(), true); } @@ -2706,7 +2706,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // increase current instances (hourly limit) // xinef: specific instances are still limited if (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance()) - player->AddInstanceEnterTime(GetInstanceId(), time(NULL)); + player->AddInstanceEnterTime(GetInstanceId(), time(nullptr)); if (!playerBind->perm && !mapSave->CanReset() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())) { @@ -2759,7 +2759,7 @@ void InstanceMap::AfterPlayerUnlinkFromMap() void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask) { - if (instance_script != NULL) + if (instance_script != nullptr) return; #ifdef ELUNA bool isElunaAI = false; @@ -2921,7 +2921,7 @@ uint32 InstanceMap::GetMaxResetDelay() const /* ******* Battleground Instance Maps ******* */ BattlegroundMap::BattlegroundMap(uint32 id, uint32 InstanceId, Map* _parent, uint8 spawnMode) - : Map(id, InstanceId, spawnMode, _parent), m_bg(NULL) + : Map(id, InstanceId, spawnMode, _parent), m_bg(nullptr) { //lets initialize visibility distance for BG/Arenas BattlegroundMap::InitVisibilityDistance(); @@ -2932,8 +2932,8 @@ BattlegroundMap::~BattlegroundMap() if (m_bg) { //unlink to prevent crash, always unlink all pointer reference before destruction - m_bg->SetBgMap(NULL); - m_bg = NULL; + m_bg->SetBgMap(nullptr); + m_bg = nullptr; } } @@ -3016,10 +3016,10 @@ GameObject* Map::GetGameObject(uint64 guid) Transport* Map::GetTransport(uint64 guid) { if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT && GUID_HIPART(guid) != HIGHGUID_TRANSPORT) - return NULL; + return nullptr; GameObject* go = GetGameObject(guid); - return go ? go->ToTransport() : NULL; + return go ? go->ToTransport() : nullptr; } DynamicObject* Map::GetDynamicObject(uint64 guid) @@ -3052,7 +3052,7 @@ void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t& respawnTime) return; } - time_t now = time(NULL); + time_t now = time(nullptr); if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) respawnTime = now+YEAR; @@ -3086,7 +3086,7 @@ void Map::SaveGORespawnTime(uint32 dbGuid, time_t& respawnTime) return; } - time_t now = time(NULL); + time_t now = time(nullptr); if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) respawnTime = now+YEAR; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 78aa93e69..682bbcce8 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -271,7 +271,7 @@ class Map : public GridRefManager { friend class MapReference; public: - Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = NULL); + Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = nullptr); virtual ~Map(); MapEntry const* GetEntry() const { return i_mapEntry; } @@ -353,7 +353,7 @@ class Map : public GridRefManager // can return INVALID_HEIGHT if under z+2 z coord not found height float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; float GetMinHeight(float x, float y) const; - Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = NULL); + Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr); ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const; @@ -451,7 +451,7 @@ class Map : public GridRefManager TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true); - void SummonCreatureGroup(uint8 group, std::list* list = NULL); + void SummonCreatureGroup(uint8 group, std::list* list = nullptr); Player* GetPlayer(uint64 guid); Creature* GetCreature(uint64 guid); GameObject* GetGameObject(uint64 guid); @@ -460,14 +460,14 @@ class Map : public GridRefManager Pet* GetPet(uint64 guid); Corpse* GetCorpse(uint64 guid); - MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast(this); else return NULL; } - const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return NULL; } + MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast(this); else return nullptr; } + const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return nullptr; } - InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast(this); else return NULL; } - const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; } + InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast(this); else return nullptr; } + const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return nullptr; } - BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast(this); else return NULL; } - const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast(this); return NULL; } + BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast(this); else return nullptr; } + const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast(this); return nullptr; } float GetWaterOrGroundLevel(uint32 phasemask,float x, float y, float z, float* ground = NULL, bool swim = false, float maxSearchDist = 50.0f) const; float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; @@ -680,7 +680,7 @@ class InstanceMap : public Map void AfterPlayerUnlinkFromMap(); void Update(const uint32, const uint32, bool thread = true); void CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask); - bool Reset(uint8 method, std::list* globalSkipList = NULL); + bool Reset(uint8 method, std::list* globalSkipList = nullptr); uint32 GetScriptId() { return i_script_id; } InstanceScript* GetInstanceScript() { return instance_script; } void PermBindAllPlayers(); diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 720981bb5..a7bae131d 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -105,9 +105,9 @@ void MapInstanced::UnloadAll() Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) { if (GetId() != mapId || !player) - return NULL; + return nullptr; - Map* map = NULL; + Map* map = nullptr; if (IsBattlegroundOrArena()) { @@ -115,7 +115,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) // the instance id is set in battlegroundid uint32 newInstanceId = player->GetBattlegroundId(); if (!newInstanceId) - return NULL; + return nullptr; map = sMapMgr->FindMap(mapId, newInstanceId); if (!map) @@ -126,7 +126,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) else { player->TeleportToEntryPoint(); - return NULL; + return nullptr; } } } @@ -146,7 +146,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) else if (IsSharedDifficultyMap(mapId) && !map->HavePlayers() && map->GetDifficulty() != realdiff) { if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db - return NULL; + return nullptr; if (!map->AllTransportsEmpty()) map->AllTransportsRemovePassengers(); // pussywizard: gameobjects / summons (assert(passengers.empty) fail in ~transport) diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 2cbd657e1..02e8b334f 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -67,12 +67,12 @@ Map* MapManager::CreateBaseMap(uint32 id) { Map* map = FindBaseMap(id); - if (map == NULL) + if (map == nullptr) { ACORE_GUARD(ACE_Thread_Mutex, Lock); map = FindBaseMap(id); - if (map == NULL) // pussywizard: check again after acquiring mutex + if (map == nullptr) // pussywizard: check again after acquiring mutex { MapEntry const* entry = sMapStore.LookupEntry(id); ASSERT(entry); @@ -97,7 +97,7 @@ Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const { Map* map = FindBaseMap(mapId); if (map && map->Instanceable()) - return NULL; + return nullptr; return map; } @@ -115,10 +115,10 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const { Map* map = FindBaseMap(mapid); if (!map) - return NULL; + return nullptr; if (!map->Instanceable()) - return instanceId == 0 ? map : NULL; + return instanceId == 0 ? map : nullptr; return ((MapInstanced*)map)->FindInstanceMap(instanceId); } diff --git a/src/server/game/Maps/MapRefManager.h b/src/server/game/Maps/MapRefManager.h index 3c114e969..48ae818bf 100644 --- a/src/server/game/Maps/MapRefManager.h +++ b/src/server/game/Maps/MapRefManager.h @@ -23,11 +23,11 @@ class MapRefManager : public RefManager 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/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 6dde69bee..4f95b8c3c 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -55,7 +55,7 @@ void TransportMgr::LoadTransportTemplates() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry); - if (goInfo == NULL) + if (goInfo == nullptr) { sLog->outError("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); continue; @@ -354,14 +354,14 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ entry = instance->GetGameObjectEntry(0, entry); if (!entry) - return NULL; + return nullptr; } TransportTemplate const* tInfo = GetTransportTemplate(entry); if (!tInfo) { sLog->outError("Transport %u will not be loaded, `transport_template` missing", entry); - return NULL; + return nullptr; } // create transport... @@ -380,7 +380,7 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ if (!trans->CreateMoTrans(guidLow, entry, mapId, x, y, z, o, 255)) { delete trans; - return NULL; + return nullptr; } if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId)) @@ -389,12 +389,12 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ { sLog->outError("Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId); delete trans; - return NULL; + return nullptr; } } // use preset map for instances (need to know which instance) - trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, NULL)); + trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, nullptr)); if (map && map->IsDungeon()) trans->m_zoneScript = map->ToInstanceMap()->GetInstanceScript(); diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h index d3139bf2a..211771177 100644 --- a/src/server/game/Maps/TransportMgr.h +++ b/src/server/game/Maps/TransportMgr.h @@ -30,7 +30,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), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0) + Teleport(false), ArriveTime(0), DepartureTime(0), Spline(nullptr), NextDistFromPrev(0.0f), NextArriveTime(0) { } @@ -98,7 +98,7 @@ public: void LoadTransportTemplates(); // Creates a transport using given GameObject template entry - MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = NULL); + MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = nullptr); // Spawns all continent transports, used at core startup void SpawnContinentTransports(); @@ -111,7 +111,7 @@ public: TransportTemplates::const_iterator itr = _transportTemplates.find(entry); if (itr != _transportTemplates.end()) return &itr->second; - return NULL; + return nullptr; } TransportAnimation const* GetTransportAnimInfo(uint32 entry) const @@ -120,7 +120,7 @@ public: if (itr != _transportAnimations.end()) return &itr->second; - return NULL; + return nullptr; } // Generates and precaches a path for transport to avoid generation each time transport instance is created diff --git a/src/server/game/Misc/GameGraveyard.cpp b/src/server/game/Misc/GameGraveyard.cpp index 1655e2ffd..346015124 100644 --- a/src/server/game/Misc/GameGraveyard.cpp +++ b/src/server/game/Misc/GameGraveyard.cpp @@ -63,7 +63,7 @@ GraveyardStruct const* Graveyard::GetGraveyard(uint32 ID) const if (itr != _graveyardStore.end()) return &itr->second; - return NULL; + return nullptr; } GraveyardStruct const* Graveyard::GetDefaultGraveyard(TeamId teamId) @@ -111,15 +111,15 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z, // at corpse map bool foundNear = false; float distNear = 10000; - GraveyardStruct const* entryNear = NULL; + GraveyardStruct const* entryNear = nullptr; // at entrance map for corpse map bool foundEntr = false; float distEntr = 10000; - GraveyardStruct const* entryEntr = NULL; + GraveyardStruct const* entryEntr = nullptr; // some where other - GraveyardStruct const* entryFar = NULL; + GraveyardStruct const* entryFar = nullptr; MapEntry const* mapEntry = sMapStore.LookupEntry(MapId); @@ -210,7 +210,7 @@ GraveyardData const* Graveyard::FindGraveyardData(uint32 id, uint32 zoneId) return &data; } - return NULL; + return nullptr; } bool Graveyard::AddGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, bool persist /*= true*/) @@ -359,13 +359,13 @@ GraveyardStruct const* Graveyard::GetGraveyard(const std::string& name) const // explicit name case std::wstring wname; if (!Utf8toWStr(name, wname)) - return NULL; + return nullptr; // converting string that we try to find to lower case wstrToLower(wname); // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found - const GraveyardStruct* alt = NULL; + const GraveyardStruct* alt = nullptr; for (GraveyardContainer::const_iterator itr = _graveyardStore.begin(); itr != _graveyardStore.end(); ++itr) { if (itr->second.wnameLow == wname) diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index b3096f677..b966861dd 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -104,7 +104,7 @@ void MotionMaster::UpdateMotion(uint32 diff) } delete _expList; - _expList = NULL; + _expList = nullptr; if (empty()) Initialize(); @@ -192,7 +192,7 @@ void MotionMaster::DirectExpireSlot(MovementSlot slot, bool reset) MovementGenerator *curr = Impl[slot]; // pussywizard: clear slot AND decrease top immediately to avoid crashes when referencing null top in DirectDelete - Impl[slot] = NULL; + Impl[slot] = nullptr; while (!empty() && !top()) --_top; @@ -535,7 +535,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC) { _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); _owner->m_movementInfo.SetFallTime(0); - _owner->ToPlayer()->SetFallInformation(time(NULL), _owner->GetPositionZ()); + _owner->ToPlayer()->SetFallInformation(time(nullptr), _owner->GetPositionZ()); } else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard { @@ -716,7 +716,7 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot) bool delayed = (_top == slot && (_cleanFlag & MMCF_UPDATE)); // pussywizard: clear slot AND decrease top immediately to avoid crashes when referencing null top in DirectDelete - Impl[slot] = NULL; + Impl[slot] = nullptr; while (!empty() && !top()) --_top; diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 95b97c12e..0899c89b6 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -80,7 +80,7 @@ class MotionMaster //: private std::stack if (empty()) return; - Impl[_top] = NULL; + Impl[_top] = nullptr; while (!empty() && !top()) --_top; } @@ -94,11 +94,11 @@ class MotionMaster //: private std::stack void InitTop(); public: - explicit MotionMaster(Unit* unit) : _expList(NULL), _top(-1), _owner(unit), _cleanFlag(MMCF_NONE) + explicit MotionMaster(Unit* unit) : _expList(nullptr), _top(-1), _owner(unit), _cleanFlag(MMCF_NONE) { for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) { - Impl[i] = NULL; + Impl[i] = nullptr; _needInit[i] = true; } } @@ -183,7 +183,7 @@ class MotionMaster //: private std::stack void MoveJumpTo(float angle, float speedXY, float speedZ); void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = 0) { MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id); }; - void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0, Unit const* target = NULL); + void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0, Unit const* target = nullptr); void MoveFall(uint32 id = 0, bool addFlagForNPC = false); void MoveSeekAssistance(float x, float y, float z); diff --git a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h index 0c9cdd493..be8a24181 100644 --- a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h @@ -11,7 +11,7 @@ template class EscortMovementGenerator : public MovementGeneratorMedium< T, EscortMovementGenerator > { public: - EscortMovementGenerator(Movement::PointsArray* _path = NULL) : i_recalculateSpeed(false) + EscortMovementGenerator(Movement::PointsArray* _path = nullptr) : i_recalculateSpeed(false) { if (_path) m_precomputedPath = *_path; diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp index 3ff05c690..2a2a8dc8c 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp @@ -29,8 +29,8 @@ PathGenerator::PathGenerator(const Unit* owner) : _polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false), _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), - _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), - _navMeshQuery(NULL) + _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(nullptr), + _navMeshQuery(nullptr) { memset(_pathPolyRefs, 0, sizeof(_pathPolyRefs)); @@ -227,8 +227,8 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con } if (sourceCanSwim) { - if ((startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) || - (endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL))) + if ((startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr)) || + (endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr))) { _type = PATHFIND_NOPATH; return; @@ -253,7 +253,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con } if (sourceCanSwim) { - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr)) { if (distToStartPoly > MAX_FIXABLE_Z_ERROR) { @@ -264,7 +264,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (farFromEndPoly) { - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr)) { BuildShortcut(); _type = PATHFIND_NOPATH; @@ -272,7 +272,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con } } } - else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr)) { if (farFromEndPoly) { @@ -308,7 +308,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); return; } - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, nullptr)) { if (!sourceCanWalk) { @@ -327,7 +327,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con } // if both points are in water - if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) + if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, nullptr)) { BuildShortcut(); _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); @@ -340,7 +340,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (startPoly != endPoly || !endInWaterFar) { float closestPoint[VERTEX_SIZE]; - if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, NULL))) + if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, nullptr))) { dtVcopy(endPoint, closestPoint); SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1])); @@ -417,7 +417,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con // we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data float suffixEndPoint[VERTEX_SIZE]; - if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL))) + if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, nullptr))) { // we can hit offmesh connection as last poly - closestPointOnPoly() don't like that // try to recover by using prev polyref @@ -528,7 +528,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con for (; i < size; ++i) if (_pathPoints[i].z >= _sourceUnit->GetPositionZ()+0.1f) break; - if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, NULL)) + if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, nullptr)) for (uint32 j=0; jGetPositionZ(); } @@ -785,7 +785,7 @@ bool PathGenerator::HaveTile(const G3D::Vector3& p) const if (tx < 0 || ty < 0) return false; - return (_navMesh->getTileAt(tx, ty, 0) != NULL); + return (_navMesh->getTileAt(tx, ty, 0) != nullptr); } uint32 PathGenerator::FixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath, dtPolyRef const* visited, uint32 nvisited) diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.h b/src/server/game/Movement/MovementGenerators/PathGenerator.h index 4c884fe20..d23cc04f7 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.h @@ -132,7 +132,7 @@ class PathGenerator float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const; bool InRangeYZX(float const* v1, float const* v2, float r, float h) const; - dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = NULL) const; + dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = nullptr) const; dtPolyRef GetPolyByLocation(float* Point, float* Distance) const; bool HaveTile(G3D::Vector3 const& p) const; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index 52e280c8f..03d60e0b2 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h @@ -18,7 +18,7 @@ template class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator > { public: - RandomMovementGenerator(float wanderDistance = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(wanderDistance), _pathGenerator(NULL), _currentPoint(RANDOM_POINTS_NUMBER) + RandomMovementGenerator(float wanderDistance = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(wanderDistance), _pathGenerator(nullptr), _currentPoint(RANDOM_POINTS_NUMBER) { _initialPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); _destinationPoints.reserve(RANDOM_POINTS_NUMBER); diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index 2a8bb1255..268287f6e 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -29,7 +29,7 @@ class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, { protected: TargetedMovementGeneratorMedium(Unit* target, float offset, float angle) : - TargetedMovementGeneratorBase(target), i_path(NULL), lastPathingFailMSTime(0), + TargetedMovementGeneratorBase(target), i_path(nullptr), lastPathingFailMSTime(0), i_recheckDistance(0), i_recheckDistanceForced(2500), i_offset(offset), i_angle(angle), i_recalculateTravel(false), i_targetReached(false) { diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 5e0815926..895ddaf59 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -72,7 +72,7 @@ void WaypointMovementGenerator::OnArrived(Creature* creature) sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); #endif creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL); + creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr); } // Inform script @@ -114,7 +114,7 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) creature->SetHomePosition(x, y, z, o); else { - if (Transport* trans = (creature->GetTransport() ? creature->GetTransport()->ToMotionTransport() : NULL)) + if (Transport* trans = (creature->GetTransport() ? creature->GetTransport()->ToMotionTransport() : nullptr)) { o -= trans->GetOrientation(); creature->SetTransportHomePosition(x, y, z, o); @@ -317,7 +317,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player) // this prevent cheating with landing point at lags // when client side flight end early in comparison server side player->StopMoving(); - player->SetFallInformation(time(NULL), player->GetPositionZ()); + player->SetFallInformation(time(nullptr), player->GetPositionZ()); } player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); @@ -409,7 +409,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) if (i_currentNode >= i_path.size() - 1) { player->CleanupAfterTaxiFlight(); - player->SetFallInformation(time(NULL), player->GetPositionZ()); + player->SetFallInformation(time(nullptr), player->GetPositionZ()); if (player->pvpInfo.IsHostile) player->CastSpell(player, 2479, true); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 17bdbb64a..b2db09262 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -46,7 +46,7 @@ class WaypointMovementGenerator : public MovementGeneratorMedium< Crea public: WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : PathMovementBase((WaypointPath const*)NULL), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {} - ~WaypointMovementGenerator() { i_path = NULL; } + ~WaypointMovementGenerator() { i_path = nullptr; } void DoInitialize(Creature*); void DoFinalize(Creature*); void DoReset(Creature*); diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index 423925f7f..cfd31cf29 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.cpp @@ -169,7 +169,7 @@ namespace Movement { 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/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 8e7a1fafc..373b0fee0 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -19,7 +19,7 @@ #include "CellImpl.h" OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp): - m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), + m_capturePointGUID(0), m_capturePoint(nullptr), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp) { } @@ -434,7 +434,7 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { if (Group* group = killer->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupGuy = itr->GetSource(); @@ -619,5 +619,5 @@ void OutdoorPvP::OnGameObjectRemove(GameObject* go) return; if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow())) - cp->m_capturePoint = NULL; + cp->m_capturePoint = nullptr; } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index 4de0f6406..10fdb839f 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -234,7 +234,7 @@ class OutdoorPvP : public ZoneScript virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); - void TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2 = 0, Player* sameMapPlr = NULL); + void TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2 = 0, Player* sameMapPlr = nullptr); protected: @@ -267,14 +267,14 @@ class OutdoorPvP : public ZoneScript OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid); if (itr != m_capturePoints.end()) return itr->second; - return NULL; + return nullptr; } void RegisterZone(uint32 zoneid); bool HasPlayer(Player const* player) const; - void TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr = NULL); + void TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr = nullptr); }; #endif /*OUTDOOR_PVP_H_*/ diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 34845fd0e..0ac25ca96 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -55,7 +55,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() typeId = fields[0].GetUInt8(); - if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, nullptr)) continue; if (typeId >= MAX_OUTDOORPVP_TYPES) @@ -151,7 +151,7 @@ OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid) if (itr == m_OutdoorPvPMap.end()) { // no handle for this zone, return - return NULL; + return nullptr; } return itr->second; } @@ -184,7 +184,7 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId) if (itr != m_OutdoorPvPMap.end()) return itr->second; else - return NULL; + return nullptr; } bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid) diff --git a/src/server/game/Petitions/PetitionMgr.cpp b/src/server/game/Petitions/PetitionMgr.cpp index 029c8ead6..6bec181b0 100644 --- a/src/server/game/Petitions/PetitionMgr.cpp +++ b/src/server/game/Petitions/PetitionMgr.cpp @@ -114,7 +114,7 @@ Petition const* PetitionMgr::GetPetition(uint32 petitionId) const PetitionContainer::const_iterator itr = PetitionStore.find(petitionId); if (itr != PetitionStore.end()) return &itr->second; - return NULL; + return nullptr; } Petition const* PetitionMgr::GetPetitionByOwnerWithType(uint32 ownerGuid, uint8 type) const @@ -123,7 +123,7 @@ Petition const* PetitionMgr::GetPetitionByOwnerWithType(uint32 ownerGuid, uint8 if (itr->second.ownerGuid == ownerGuid && itr->second.petitionType == type) return &itr->second; - return NULL; + return nullptr; } void PetitionMgr::AddSignature(uint32 petitionId, uint32 accountId, uint32 playerGuid) @@ -137,7 +137,7 @@ Signatures const* PetitionMgr::GetSignature(uint32 petitionId) const SignatureContainer::const_iterator itr = SignatureStore.find(petitionId); if (itr != SignatureStore.end()) return &itr->second; - return NULL; + return nullptr; } void PetitionMgr::RemoveSignaturesByPlayer(uint32 playerGuid) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index d9e5adefa..4ec41073a 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -166,7 +166,7 @@ PoolObject* PoolGroup::RollOne(ActivePoolData& spawns, uint32 triggerFrom) return &EqualChanced[index]; } - return NULL; + return nullptr; } // Main method to despawn a creature or gameobject in a pool diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index c7672f255..718b2669f 100644 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -74,13 +74,13 @@ class ReputationMgr FactionState const* GetState(FactionEntry const* factionEntry) const { - return factionEntry->CanHaveReputation() ? GetState(factionEntry->reputationListID) : NULL; + return factionEntry->CanHaveReputation() ? GetState(factionEntry->reputationListID) : nullptr; } FactionState const* GetState(RepListID id) const { FactionStateList::const_iterator repItr = _factions.find (id); - return repItr != _factions.end() ? &repItr->second : NULL; + return repItr != _factions.end() ? &repItr->second : nullptr; } bool IsAtWar(uint32 faction_id) const; @@ -100,7 +100,7 @@ class ReputationMgr ReputationRank const* GetForcedRankIfAny(FactionTemplateEntry const* factionTemplateEntry) const { ForcedReactions::const_iterator forceItr = _forcedReactions.find(factionTemplateEntry->faction); - return forceItr != _forcedReactions.end() ? &forceItr->second : NULL; + return forceItr != _forcedReactions.end() ? &forceItr->second : nullptr; } public: // modifiers diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index fbc109167..25369c7a7 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -89,7 +89,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou // Helpers for ScriptProcess method. inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const { - Player* player = NULL; + Player* player = nullptr; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else @@ -111,7 +111,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse) const { - Creature* creature = NULL; + Creature* creature = nullptr; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else @@ -144,7 +144,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Unit* unit = NULL; + Unit* unit = nullptr; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else if (!obj->isType(TYPEMASK_UNIT)) @@ -162,7 +162,7 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Player* player = NULL; + Player* player = nullptr; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else @@ -177,7 +177,7 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Creature* creature = NULL; + Creature* creature = nullptr; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else @@ -192,7 +192,7 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - WorldObject* pWorldObject = NULL; + WorldObject* pWorldObject = nullptr; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); @@ -257,7 +257,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script inline GameObject* Map::_FindGameObject(WorldObject* searchObject, uint32 guid) const { - GameObject* gameobject = NULL; + GameObject* gameobject = nullptr; CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY())); Cell cell(p); @@ -284,7 +284,7 @@ void Map::ScriptsProcess() { ScriptAction const& step = iter->second; - Object* source = NULL; + Object* source = nullptr; if (step.sourceGUID) { switch (GUID_HIPART(step.sourceGUID)) @@ -313,7 +313,7 @@ void Map::ScriptsProcess() case HIGHGUID_MO_TRANSPORT: { GameObject* go = GetGameObject(step.sourceGUID); - source = go ? go->ToTransport() : NULL; + source = go ? go->ToTransport() : nullptr; break; } default: @@ -323,7 +323,7 @@ void Map::ScriptsProcess() } } - WorldObject* target = NULL; + WorldObject* target = nullptr; if (step.targetGUID) { switch (GUID_HIPART(step.targetGUID)) @@ -348,7 +348,7 @@ void Map::ScriptsProcess() case HIGHGUID_MO_TRANSPORT: { GameObject* go = GetGameObject(step.targetGUID); - target = go ? go->ToTransport() : NULL; + target = go ? go->ToTransport() : nullptr; break; } default: @@ -705,30 +705,30 @@ void Map::ScriptsProcess() break; } - Unit* uSource = NULL; - Unit* uTarget = NULL; + Unit* uSource = nullptr; + Unit* uTarget = nullptr; // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s switch (step.script->CastSpell.Flags) { case SF_CASTSPELL_SOURCE_TO_TARGET: // source -> target - uSource = source ? source->ToUnit() : NULL; - uTarget = target ? target->ToUnit() : NULL; + uSource = source ? source->ToUnit() : nullptr; + uTarget = target ? target->ToUnit() : nullptr; break; case SF_CASTSPELL_SOURCE_TO_SOURCE: // source -> source - uSource = source ? source->ToUnit() : NULL; + uSource = source ? source->ToUnit() : nullptr; uTarget = uSource; break; case SF_CASTSPELL_TARGET_TO_TARGET: // target -> target - uSource = target ? target->ToUnit() : NULL; + uSource = target ? target->ToUnit() : nullptr; uTarget = uSource; break; case SF_CASTSPELL_TARGET_TO_SOURCE: // target -> source - uSource = target ? target->ToUnit() : NULL; - uTarget = source ? source->ToUnit() : NULL; + uSource = target ? target->ToUnit() : nullptr; + uTarget = source ? source->ToUnit() : nullptr; break; case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry - uSource = source ? source->ToUnit() : NULL; - uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL; + uSource = source ? source->ToUnit() : nullptr; + uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : nullptr; break; } @@ -756,7 +756,7 @@ void Map::ScriptsProcess() if (WorldObject* object = _GetScriptWorldObject(source, true, step.script)) { // PlaySound.Flags bitmask: 0/1=anyone/target - Player* player = NULL; + Player* player = nullptr; if (step.script->PlaySound.Flags & SF_PLAYSOUND_TARGET_PLAYER) { // Target must be Player. @@ -785,7 +785,7 @@ void Map::ScriptsProcess() pReceiver->SendNewItem(item, step.script->CreateItem.Amount, false, true); } else - pReceiver->SendEquipError(msg, NULL, NULL, step.script->CreateItem.ItemEntry); + pReceiver->SendEquipError(msg, nullptr, nullptr, step.script->CreateItem.ItemEntry); } break; @@ -819,7 +819,7 @@ void Map::ScriptsProcess() break; } - Creature* cTarget = NULL; + Creature* cTarget = nullptr; WorldObject* wSource = dynamic_cast (source); if (wSource) //using grid searcher { @@ -854,7 +854,7 @@ void Map::ScriptsProcess() } // Insert script into schedule but do not start it - ScriptsStart(*datamap, step.script->CallScript.ScriptID, cTarget, NULL); + ScriptsStart(*datamap, step.script->CallScript.ScriptID, cTarget, nullptr); break; } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 5a678504f..bef6946a0 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -661,7 +661,7 @@ InstanceScript* ScriptMgr::CreateInstanceScript(InstanceMap* map) { ASSERT(map); - GET_SCRIPT_RET(InstanceMapScript, map->GetScriptId(), tmpscript, NULL); + GET_SCRIPT_RET(InstanceMapScript, map->GetScriptId(), tmpscript, nullptr); return tmpscript->GetInstanceScript(map); } @@ -867,7 +867,7 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature) return luaAI; #endif - GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, NULL); + GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, nullptr); return tmpscript->GetAI(creature); } @@ -1012,7 +1012,7 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go) sEluna->OnSpawn(go); #endif - GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL); + GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, nullptr); return tmpscript->GetAI(go); } @@ -1032,14 +1032,14 @@ Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/) { // TODO: Implement script-side battlegrounds. ABORT(); - return NULL; + return nullptr; } OutdoorPvP* ScriptMgr::CreateOutdoorPvP(OutdoorPvPData const* data) { ASSERT(data); - GET_SCRIPT_RET(OutdoorPvPScript, data->ScriptId, tmpscript, NULL); + GET_SCRIPT_RET(OutdoorPvPScript, data->ScriptId, tmpscript, nullptr); return tmpscript->GetOutdoorPvP(); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 0ecd85003..ffcaa8633 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -196,10 +196,10 @@ class SpellScriptLoader : public ScriptObject bool IsDatabaseBound() const { return true; } // Should return a fully valid SpellScript pointer. - virtual SpellScript* GetSpellScript() const { return NULL; } + virtual SpellScript* GetSpellScript() const { return nullptr; } // Should return a fully valid AuraScript pointer. - virtual AuraScript* GetAuraScript() const { return NULL; } + virtual AuraScript* GetAuraScript() const { return nullptr; } }; class ServerScript : public ScriptObject @@ -385,7 +385,7 @@ class InstanceMapScript : public ScriptObject, public MapScript } // Gets an InstanceScript object for this instance. - virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return NULL; } + virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return nullptr; } }; class BattlegroundMapScript : public ScriptObject, public MapScript @@ -544,7 +544,7 @@ class CreatureScript : public ScriptObject, public UpdatableScript virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; } // Called when a CreatureAI object is needed for the creature. - virtual CreatureAI* GetAI(Creature* /*creature*/) const { return NULL; } + virtual CreatureAI* GetAI(Creature* /*creature*/) const { return nullptr; } }; class GameObjectScript : public ScriptObject, public UpdatableScript @@ -588,7 +588,7 @@ class GameObjectScript : public ScriptObject, public UpdatableScript virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { } // Called when a GameObjectAI object is needed for the gameobject. - virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; } + virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return nullptr; } }; class AreaTriggerScript : public ScriptObject @@ -1694,7 +1694,7 @@ class ScriptRegistry if (it != ScriptPointerList.end()) return it->second; - return NULL; + return nullptr; } private: diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index 6b421f7e1..7931df7d9 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -9,7 +9,7 @@ #include "ByteBuffer.h" #include "WorldPacket.h" -PacketLog::PacketLog() : _file(NULL) +PacketLog::PacketLog() : _file(nullptr) { Initialize(); } @@ -19,7 +19,7 @@ PacketLog::~PacketLog() if (_file) fclose(_file); - _file = NULL; + _file = nullptr; } PacketLog* PacketLog::instance() @@ -46,7 +46,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) ByteBuffer data(4+4+4+1+packet.size()); data << int32(packet.GetOpcode()); data << int32(packet.size()); - data << uint32(time(NULL)); + data << uint32(time(nullptr)); data << uint8(direction); for (uint32 i = 0; i < packet.size(); i++) diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index e5aea9635..c3b3713ca 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -27,7 +27,7 @@ class PacketLog static PacketLog* instance(); void Initialize(); - bool CanLogPacket() const { return (_file != NULL); } + bool CanLogPacket() const { return (_file != nullptr); } void LogPacket(WorldPacket const& packet, Direction direction); private: diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 105affc5b..65c919201 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -93,7 +93,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 _lastAuctionListOwnerItemsMSTime(0), AntiDOS(this), m_GUIDLow(0), - _player(NULL), + _player(nullptr), m_Socket(sock), _security(sec), _skipQueue(skipQueue), @@ -119,7 +119,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 { memset(m_Tutorials, 0, sizeof(m_Tutorials)); - _warden = NULL; + _warden = nullptr; _offlineTime = 0; _kicked = false; _shouldSetOfflineInDB = true; @@ -149,17 +149,17 @@ WorldSession::~WorldSession() { m_Socket->CloseSocket("WorldSession destructor"); m_Socket->RemoveReference(); - m_Socket = NULL; + m_Socket = nullptr; } if (_warden) { delete _warden; - _warden = NULL; + _warden = nullptr; } ///- empty incoming packet queue - WorldPacket* packet = NULL; + WorldPacket* packet = nullptr; while (_recvQueue.next(packet)) delete packet; @@ -200,13 +200,13 @@ void WorldSession::SendPacket(WorldPacket const* packet) static uint64 sendPacketCount = 0; static uint64 sendPacketBytes = 0; - static time_t firstTime = time(NULL); + static time_t firstTime = time(nullptr); static time_t lastTime = firstTime; // next 60 secs start time static uint64 sendLastPacketCount = 0; static uint64 sendLastPacketBytes = 0; - time_t cur_time = time(NULL); + time_t cur_time = time(nullptr); if ((cur_time - lastTime) < 60) { @@ -264,10 +264,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) HandleTeleportTimeout(updater.ProcessLogout()); uint32 _startMSTime = getMSTime(); - WorldPacket* packet = NULL; - WorldPacket* movementPacket = NULL; + WorldPacket* packet = nullptr; + WorldPacket* movementPacket = nullptr; bool deletePacket = true; - WorldPacket* firstDelayedPacket = NULL; + WorldPacket* firstDelayedPacket = nullptr; uint32 processedPackets = 0; time_t currentTime = time(nullptr); @@ -309,7 +309,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { HandleMovementOpcodes(*movementPacket); delete movementPacket; - movementPacket = NULL; + movementPacket = nullptr; } sScriptMgr->OnPacketReceive(this, *packet); #ifdef ELUNA @@ -325,7 +325,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (movementPacket) { delete movementPacket; - movementPacket = NULL; + movementPacket = nullptr; } sScriptMgr->OnPacketReceive(this, *packet); #ifdef ELUNA @@ -390,7 +390,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (updater.ProcessLogout()) { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); if (ShouldLogOut(currTime) && !m_playerLoading) LogoutPlayer(true); @@ -400,7 +400,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (m_Socket && m_Socket->IsClosed()) { m_Socket->RemoveReference(); - m_Socket = NULL; + m_Socket = nullptr; } if (!m_Socket) @@ -415,7 +415,7 @@ bool WorldSession::HandleSocketClosed() if (m_Socket && m_Socket->IsClosed() && !IsKicked() && GetPlayer() && !PlayerLogout() && GetPlayer()->m_taxi.empty() && GetPlayer()->IsInWorld() && !World::IsStopped()) { m_Socket->RemoveReference(); - m_Socket = NULL; + m_Socket = nullptr; GetPlayer()->TradeCancel(false); return true; } @@ -427,7 +427,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions) // pussywizard: handle teleport ack timeout if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported()) { - time_t currTime = time(NULL); + time_t currTime = time(nullptr); if (updateInSessions) // session update from World::UpdateSessions { if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar() + sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime) @@ -520,7 +520,7 @@ void WorldSession::LogoutPlayer(bool save) guild->HandleMemberLogout(this); ///- Remove pet - _player->RemovePet(NULL, PET_SAVE_AS_CURRENT); + _player->RemovePet(nullptr, PET_SAVE_AS_CURRENT); // pussywizard: on logout remove auras that are removed at map change (before saving to db) // there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses @@ -596,7 +596,7 @@ void WorldSession::LogoutPlayer(bool save) _map->AfterPlayerUnlinkFromMap(); } - SetPlayer(NULL); // pointer already deleted + SetPlayer(nullptr); // pointer already deleted //! Send the 'logout complete' packet to the client //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle @@ -775,7 +775,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c void WorldSession::SendAccountDataTimes(uint32 mask) { WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK - data << uint32(time(NULL)); // unix time of something + data << uint32(time(nullptr)); // unix time of something data << uint8(1); data << uint32(mask); // type mask for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index d8528e8be..05564465e 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -136,7 +136,7 @@ void WorldSocket::CloseSocket(std::string const& reason) { ACE_GUARD (LockType, Guard, m_SessionLock); - m_Session = NULL; + m_Session = nullptr; } } @@ -435,7 +435,7 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) { 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); @@ -466,7 +466,7 @@ int WorldSocket::Update(void) int WorldSocket::handle_input_header(void) { - ACE_ASSERT (m_RecvWPct == NULL); + ACE_ASSERT (m_RecvWPct == nullptr); ACE_ASSERT (m_Header.length() == sizeof(ClientPktHeader)); @@ -479,7 +479,7 @@ int WorldSocket::handle_input_header(void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { - Player* _player = m_Session ? m_Session->GetPlayer() : NULL; + Player* _player = m_Session ? m_Session->GetPlayer() : nullptr; sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "", header.size, header.cmd); errno = EINVAL; @@ -510,13 +510,13 @@ int WorldSocket::handle_input_payload(void) ACE_ASSERT (m_RecvPct.space() == 0); ACE_ASSERT (m_Header.space() == 0); - ACE_ASSERT (m_RecvWPct != NULL); + ACE_ASSERT (m_RecvWPct != nullptr); const int ret = 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(); @@ -699,7 +699,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) { ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - if (m_Session != NULL) + if (m_Session != nullptr) { // Our Idle timer will reset on any non PING opcodes. // Catches people idling on the login screen and any lingering ingame connections. @@ -849,7 +849,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) //! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now. if (mutetime < 0) { - mutetime = time(NULL) + llabs(mutetime); + mutetime = time(nullptr) + llabs(mutetime); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN); @@ -941,7 +941,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/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0e4326502..0fd10aee4 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -370,7 +370,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster): m_base(base), m_spellInfo(base->GetSpellInfo()), m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_critChance(0), -m_oldAmount(0), m_isAuraEnabled(true), m_channelData(NULL), m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), +m_oldAmount(0), m_isAuraEnabled(true), m_channelData(nullptr), m_spellmod(nullptr), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), m_canBeRecalculated(true), m_isPeriodic(false) { CalculatePeriodic(caster, true, false); @@ -386,7 +386,7 @@ m_canBeRecalculated(true), m_isPeriodic(false) // Xinef: channel data structure if (caster) if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - m_channelData = new ChannelTargetData(caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : NULL); + m_channelData = new ChannelTargetData(caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : nullptr); } AuraEffect::~AuraEffect() @@ -440,7 +440,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) { int32 amount; // default amount calculation - amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL); + amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr); // check item enchant aura cast if (!amount && caster) @@ -579,7 +579,7 @@ void AuraEffect::CalculatePeriodicData() } if (GetCaster()) - SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : NULL))); + SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : nullptr))); } void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) @@ -620,7 +620,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) if (m_amplitude <= 0) m_amplitude = 1000; - Player* modOwner = caster ? caster->GetSpellModOwner() : NULL; + Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr; // Apply casting time mods if (m_amplitude) @@ -1033,7 +1033,7 @@ float AuraEffect::CalcPeriodicCritChance(Unit const* caster, Unit const* target) { if ((*itr)->IsAffectedOnSpell(GetSpellInfo())) { - critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true); + critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true); break; } } @@ -1043,7 +1043,7 @@ float AuraEffect::CalcPeriodicCritChance(Unit const* caster, Unit const* target) // Rupture - since 3.3.3 can crit case SPELLFAMILY_ROGUE: if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000) - critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true); + critChance = modOwner->SpellDoneCritChance(nullptr, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true); break; } } @@ -1356,7 +1356,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const { int32 HotWMod = (*i)->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power. - target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this, target->GetGUID()); + target->CastCustomSpell(target, HotWSpellId, &HotWMod, nullptr, nullptr, true, NULL, this, target->GetGUID()); break; } } @@ -1386,7 +1386,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48420, &bp, NULL, NULL, true); + target->CastCustomSpell(target, 48420, &bp, nullptr, nullptr, true); } break; case FORM_DIREBEAR: @@ -1395,13 +1395,13 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48418, &bp, NULL, NULL, true); + target->CastCustomSpell(target, 48418, &bp, nullptr, nullptr, true); } // Survival of the Fittest if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, 0)) { int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); - target->CastCustomSpell(target, 62069, &bp, NULL, NULL, true, 0, this, target->GetGUID()); + target->CastCustomSpell(target, 62069, &bp, nullptr, nullptr, true, 0, this, target->GetGUID()); } break; case FORM_MOONKIN: @@ -1409,7 +1409,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48421, &bp, NULL, NULL, true); + target->CastCustomSpell(target, 48421, &bp, nullptr, nullptr, true); } break; // Master Shapeshifter - Tree of Life @@ -1417,7 +1417,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48422, &bp, NULL, NULL, true); + target->CastCustomSpell(target, 48422, &bp, nullptr, nullptr, true); } break; } @@ -1441,7 +1441,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const } const Unit::AuraEffectList& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); - AuraEffect* newAura = NULL; + AuraEffect* newAura = nullptr; // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr) { @@ -1906,7 +1906,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo { int32 basePoints = int32(std::min(oldPower, FurorChance)); target->SetPower(POWER_ENERGY, 0); - target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this); + target->CastCustomSpell(target, 17099, &basePoints, nullptr, nullptr, true, NULL, this); break; } case FORM_BEAR: @@ -2864,7 +2864,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode // start fall from current height if (!apply && target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->SetFallInformation(time(NULL), target->GetPositionZ()); + target->ToPlayer()->SetFallInformation(time(nullptr), target->GetPositionZ()); } void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -5081,7 +5081,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if( aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE ) return; - Player* player = NULL; + Player* player = nullptr; acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f); acore::PlayerSearcher searcher(target, player, checker); target->VisitNearbyWorldObject(10.0f, searcher); @@ -5137,7 +5137,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId); for (uint32 i = 0; i < spell->StackAmount; ++i) - caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID()); + caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID()); break; } target->RemoveAurasDueToSpell(spellId); @@ -5151,7 +5151,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool { SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId); for (uint32 i = 0; i < spell->StackAmount; ++i) - caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID()); + caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID()); break; } target->RemoveAurasDueToSpell(spellId); @@ -5315,7 +5315,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod if (msg != EQUIP_ERR_OK) { count-=noSpaceForCount; - plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType); + plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellInfo()->Effects[m_effIndex].ItemType); if (count == 0) return; } @@ -5323,7 +5323,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true); if (!newitem) { - plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } plCaster->SendNewItem(newitem, count, true, true); @@ -5477,7 +5477,7 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo return; // If amount avalible cast with basepoints (Crypt Fever for example) if (GetAmount()) - caster->CastCustomSpell(target, triggeredSpellId, &m_amount, NULL, NULL, true, NULL, this); + caster->CastCustomSpell(target, triggeredSpellId, &m_amount, nullptr, nullptr, true, NULL, this); else caster->CastSpell(target, triggeredSpellId, true, NULL, this); } @@ -5730,7 +5730,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) uint32 auraId = auraSpellInfo->Id; // specific code for cases with no trigger spell provided in field - if (triggeredSpellInfo == NULL) + if (triggeredSpellInfo == nullptr) { switch (auraSpellInfo->SpellFamilyName) { @@ -5904,7 +5904,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) { // Mana Tide case 16191: - target->CastCustomSpell(target, triggerSpellId, &m_amount, NULL, NULL, true, NULL, this); + target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, NULL, this); return; // Poison (Grobbulus) case 28158: @@ -5933,14 +5933,14 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 69508: { if (caster) - caster->CastSpell(target, triggerSpellId, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(target, triggerSpellId, true, nullptr, nullptr, caster->GetGUID()); return; } // Trial of the Crusader, Jaraxxus, Spinning Pain Spike case 66283: { const int32 dmg = target->GetMaxHealth()/2; - target->CastCustomSpell(target, 66316, &dmg, NULL, NULL, true); + target->CastCustomSpell(target, 66316, &dmg, nullptr, nullptr, true); return; } // Violet Hold, Moragg, Ray of Suffering, Ray of Pain @@ -5992,7 +5992,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 56654: case 58882: int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f); - target->CastCustomSpell(target, triggerSpellId, &amount, NULL, NULL, true); + target->CastCustomSpell(target, triggerSpellId, &amount, nullptr, nullptr, true); return; } } @@ -6394,7 +6394,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864) { uint32 tickNumber = GetTickNumber()-1; - int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL); + int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, nullptr); float drop = 2.0f; @@ -6534,7 +6534,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con if (manaFeedVal > 0) { int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal); - caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this); + caster->CastCustomSpell(caster, 32554, &feedAmount, nullptr, nullptr, true, NULL, this); } } } @@ -6691,7 +6691,7 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); #endif - triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, NULL, NULL, true, NULL, this); + triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, NULL, this); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -6800,7 +6800,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius)) { - target->CastCustomSpell(triggerTarget, GetId(), &value, NULL, NULL, true, NULL, this, GetCasterGUID()); + target->CastCustomSpell(triggerTarget, GetId(), &value, nullptr, nullptr, true, NULL, this, GetCasterGUID()); if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID())) aura->SetCharges(jumps); } @@ -6810,5 +6810,5 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); #endif - target->CastCustomSpell(target, triggerSpellId, &value, NULL, NULL, true, NULL, this, GetCasterGUID()); + target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, NULL, this, GetCasterGUID()); } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 40034f9ed..e7e1246a9 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -177,8 +177,8 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) SpellGroupStackFlags sFlag = sSpellMgr->GetGroupStackFlags(groupId); if (!aurEff->IsPeriodic() && (sFlag & SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE)) { - AuraApplication* strongestApp = apply ? this : NULL; - AuraEffect* strongestEff = apply ? aurEff : NULL; + AuraApplication* strongestApp = apply ? this : nullptr; + AuraEffect* strongestEff = apply ? aurEff : nullptr; int32 amount = apply ? abs(aurEff->GetAmount()) : 0; Unit* target = GetTarget(); Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType(aurEff->GetAuraType()); @@ -322,13 +322,13 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas *refresh = false; uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner); if (!effMask) - return NULL; + return nullptr; if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, periodicReset)) { // we've here aura, which script triggered removal after modding stack amount // check the state here, so we won't create new Aura object if (foundAura->IsRemoved()) - return NULL; + return nullptr; if (refresh) *refresh = true; @@ -346,7 +346,7 @@ Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject ASSERT(tryEffMask <= MAX_EFFECT_MASK); uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner); if (!effMask) - return NULL; + return nullptr; return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID); } @@ -373,9 +373,9 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld()) // owner not in world so don't allow to own not self casted single target auras if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget()) - return NULL; + return nullptr; - Aura* aura = NULL; + Aura* aura = nullptr; switch (owner->GetTypeId()) { case TYPEID_UNIT: @@ -387,17 +387,17 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne break; default: ABORT(); - return NULL; + return nullptr; } // aura can be removed in Unit::_AddAura call if (aura->IsRemoved()) - return NULL; + return nullptr; return aura; } Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) : m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()), -m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(NULL)), +m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(nullptr)), m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0), m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false) @@ -418,7 +418,7 @@ AuraScript* Aura::GetScriptByName(std::string const& scriptName) const for (std::list::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr) if ((*itr)->_GetScriptName()->compare(scriptName) == 0) return *itr; - return NULL; + return nullptr; } void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount) @@ -429,7 +429,7 @@ void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount) if (effMask & (uint8(1) << i)) m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster); else - m_effects[i] = NULL; + m_effects[i] = nullptr; } } @@ -486,7 +486,7 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp { if (m_spellInfo->IsCooldownStartedOnEvent()) { - Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL; + Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : nullptr; caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true); } } @@ -728,8 +728,8 @@ void Aura::UpdateOwner(uint32 diff, WorldObject* owner) Unit* caster = GetCaster(); // Apply spellmods for channeled auras // used for example when triggered spell of spell:10 is modded - Spell* modSpell = NULL; - Player* modOwner = NULL; + Spell* modSpell = nullptr; + Player* modOwner = nullptr; if (caster) { modOwner = caster->GetSpellModOwner(); @@ -808,7 +808,7 @@ void Aura::Update(uint32 diff, Unit* caster) int32 Aura::CalcMaxDuration(Unit* caster) const { - Player* modOwner = NULL; + Player* modOwner = nullptr; int32 maxDuration; if (caster) @@ -1252,7 +1252,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (*itr < 0) target->RemoveAurasDueToSpell(-(*itr)); else if (removeMode != AURA_REMOVE_BY_DEATH) - target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID()); + target->CastSpell(target, *itr, true, nullptr, nullptr, GetCasterGUID()); } } if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA)) @@ -1382,7 +1382,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT); int32 basepoints0 = damage; - caster->CastCustomSpell(target, 64801, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); + caster->CastCustomSpell(target, 64801, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0)); } } break; @@ -1400,8 +1400,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePct(basepoints0, 15)); - caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); - caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); + caster->CastCustomSpell(target, 63675, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0)); + caster->CastCustomSpell(caster, 75999, &heal, nullptr, nullptr, true, NULL, GetEffect(0)); } } // Power Word: Shield @@ -1412,7 +1412,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b { // instantly heal m_amount% of the absorb-value int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100; - caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, NULL, NULL, true, 0, GetEffect(0)); + caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, 0, GetEffect(0)); } } break; @@ -1433,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (GetCasterGUID() == target->GetGUID()) break; - AuraEffect* aurEff = NULL; + AuraEffect* aurEff = nullptr; // Ebon Plaguebringer / Crypt Fever Unit::AuraEffectList const& TalentAuras = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (Unit::AuraEffectList::const_iterator itr = TalentAuras.begin(); itr != TalentAuras.end(); ++itr) @@ -1589,7 +1589,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1)) { int32 basepoints0 = aurEff->GetAmount() * caster->GetCreateMana() / 100; - caster->CastCustomSpell(caster, 64103, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); + caster->CastCustomSpell(caster, 64103, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0)); } } // Power word: shield @@ -1622,7 +1622,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b multiplier += 0.5f; int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier)); - caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true); + caster->CastCustomSpell(caster, 47755, &basepoints0, nullptr, nullptr, true); } // effect on aura target if (AuraEffect const* aurEff = aura->GetEffect(1)) @@ -1636,7 +1636,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case POWER_MANA: { int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2)); - caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true); + caster->CastCustomSpell(target, 63654, &basepoints0, nullptr, nullptr, true); break; } case POWER_RAGE: triggeredSpellId = 63653; break; @@ -1837,7 +1837,7 @@ bool Aura::IsAuraStronger(Aura const* newAura) const if (!thisEffect) continue; - AuraEffect* newEffect = NULL; + AuraEffect* newEffect = nullptr; for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j) { newEffect = newAura->GetEffect(j); @@ -1988,7 +1988,7 @@ bool Aura::CanStackWith(Aura const* existingAura, bool remove) const if (VehicleAura1 && VehicleAura2) { - Vehicle* veh = NULL; + Vehicle* veh = nullptr; if (GetOwner()->ToUnit()) veh = GetOwner()->ToUnit()->GetVehicleKit(); @@ -2027,7 +2027,7 @@ bool Aura::IsProcOnCooldown() const { /*if (m_procCooldown) { - if (m_procCooldown > time(NULL)) + if (m_procCooldown > time(nullptr)) return true; }*/ return false; @@ -2035,7 +2035,7 @@ bool Aura::IsProcOnCooldown() const void Aura::AddProcCooldown(uint32 /*msec*/) { - //m_procCooldown = time(NULL) + msec; + //m_procCooldown = time(nullptr) + msec; } void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo) @@ -2111,7 +2111,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI if (eventInfo.GetDamageInfo()) { WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType(); - Item* item = NULL; + Item* item = nullptr; if (attType == BASE_ATTACK) item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); else if (attType == OFF_ATTACK) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 1de1ad7d2..3de920165 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -171,8 +171,8 @@ class Aura // Helpers for targets ApplicationMap const & GetApplicationMap() {return m_applications;} void GetApplicationList(std::list & applicationList) const; - const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } - AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } + const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; } + AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; } bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); } void SetNeedClientUpdateForTargets() const; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f02098936..32ae9349f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -105,8 +105,8 @@ void SpellDestination::RelocateOffset(Position const& offset) SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget() { - m_objectTarget = NULL; - m_itemTarget = NULL; + m_objectTarget = nullptr; + m_itemTarget = nullptr; m_objectTargetGUID = 0; m_itemTargetGUID = 0; @@ -230,7 +230,7 @@ Unit* SpellCastTargets::GetUnitTarget() const { if (m_objectTarget) return m_objectTarget->ToUnit(); - return NULL; + return nullptr; } void SpellCastTargets::SetUnitTarget(Unit* target) @@ -260,7 +260,7 @@ GameObject* SpellCastTargets::GetGOTarget() const { if (m_objectTarget) return m_objectTarget->ToGameObject(); - return NULL; + return nullptr; } @@ -289,7 +289,7 @@ Corpse* SpellCastTargets::GetCorpseTarget() const { if (m_objectTarget) return m_objectTarget->ToCorpse(); - return NULL; + return nullptr; } void SpellCastTargets::SetCorpseTarget(Corpse* target) @@ -314,7 +314,7 @@ uint64 SpellCastTargets::GetObjectTargetGUID() const void SpellCastTargets::RemoveObjectTarget() { - m_objectTarget = NULL; + m_objectTarget = nullptr; m_objectTargetGUID = 0LL; m_targetMask &= ~(TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK); } @@ -457,7 +457,7 @@ void SpellCastTargets::SetDstChannel(SpellDestination const& spellDest) WorldObject* SpellCastTargets::GetObjectTargetChannel(Unit* caster) const { - return m_objectTargetGUIDChannel ? ((m_objectTargetGUIDChannel == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUIDChannel)) : NULL; + return m_objectTargetGUIDChannel ? ((m_objectTargetGUIDChannel == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUIDChannel)) : nullptr; } bool SpellCastTargets::HasDstChannel() const @@ -472,9 +472,9 @@ SpellDestination const* SpellCastTargets::GetDstChannel() const void SpellCastTargets::Update(Unit* caster) { - m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : NULL; + m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : nullptr; - m_itemTarget = NULL; + m_itemTarget = nullptr; if (caster->GetTypeId() == TYPEID_PLAYER) { Player* player = caster->ToPlayer(); @@ -548,7 +548,7 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO { m_customError = SPELL_CUSTOM_ERROR_NONE; m_skipCheck = skipCheck; - m_selfContainer = NULL; + m_selfContainer = nullptr; m_referencedFromCurrentSpell = false; m_executedCurrently = false; m_needComboPoints = m_spellInfo->NeedsComboPoints(); @@ -599,7 +599,7 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO { m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID); if (m_originalCaster && !m_originalCaster->IsInWorld()) - m_originalCaster = NULL; + m_originalCaster = nullptr; } m_spellState = SPELL_STATE_NULL; @@ -607,13 +607,13 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO if (info->HasAttribute(SPELL_ATTR4_CAN_CAST_WHILE_CASTING)) _triggeredCastFlags = TriggerCastFlags(uint32(_triggeredCastFlags) | TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_CAST_DIRECTLY); - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; - unitTarget = NULL; - itemTarget = NULL; - gameObjTarget = NULL; - destTarget = NULL; + unitTarget = nullptr; + itemTarget = nullptr; + gameObjTarget = nullptr; + destTarget = nullptr; damage = 0; effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH; m_diminishLevel = DIMINISHING_LEVEL_1; @@ -623,13 +623,13 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO m_procAttacker = 0; m_procVictim = 0; m_procEx = 0; - focusObject = NULL; + focusObject = nullptr; m_cast_count = 0; m_glyphIndex = 0; m_preCastSpell = 0; - m_triggeredByAuraSpell = NULL; - m_spellAura = NULL; - m_pathFinder = NULL; // pussywizard + m_triggeredByAuraSpell = nullptr; + m_spellAura = nullptr; + m_pathFinder = nullptr; // pussywizard _scriptsLoaded = false; //Auto Shot & Shoot (wand) @@ -678,7 +678,7 @@ Spell::~Spell() // Clean the reference to avoid later crash. // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case. sLog->outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); - *m_selfContainer = NULL; + *m_selfContainer = nullptr; } delete m_spellValue; @@ -709,7 +709,7 @@ void Spell::InitExplicitTargets(SpellCastTargets const& targets) // try to select correct unit target if not provided by client or by serverside cast if (neededTargets & (TARGET_FLAG_UNIT_MASK)) { - Unit* unit = NULL; + Unit* unit = nullptr; // try to use player selection as a target if (Player* playerCaster = m_caster->ToPlayer()) { @@ -777,7 +777,7 @@ void Spell::SelectExplicitTargets() redirect = m_caster->GetMeleeHitRedirectTarget(target, m_spellInfo); break; default: - redirect = NULL; + redirect = nullptr; break; } if (redirect && (redirect != target)) @@ -1214,7 +1214,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask) { - Unit* referer = NULL; + Unit* referer = nullptr; switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_SRC: @@ -1245,7 +1245,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge if (!referer) return; - Position const* center = NULL; + Position const* center = nullptr; switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_SRC: @@ -1698,7 +1698,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - WorldObject* target = NULL; + WorldObject* target = nullptr; bool checkIfValid = true; switch (targetType.GetTarget()) @@ -1994,7 +1994,7 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) if (!targetMask) return; - WorldObject* target = NULL; + WorldObject* target = nullptr; switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType()) { @@ -2117,10 +2117,10 @@ void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* refere WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList) { - WorldObject* target = NULL; + WorldObject* target = nullptr; uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList); if (!containerTypeMask) - return NULL; + return nullptr; acore::WorldObjectSpellNearbyTargetCheck check(range, m_caster, m_spellInfo, selectionType, condList); acore::WorldObjectLastSearcher searcher(m_caster, target, check, containerTypeMask); SearchTargets > (searcher, containerTypeMask, m_caster, m_caster, range); @@ -2577,7 +2577,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) // can't use default call because of threading, do stuff as fast as possible for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (farMask & (1 << i)) - HandleEffects(effectUnit, NULL, NULL, i, SPELL_EFFECT_HANDLE_HIT_TARGET); + HandleEffects(effectUnit, nullptr, nullptr, i, SPELL_EFFECT_HANDLE_HIT_TARGET); return; } @@ -2608,12 +2608,12 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) m_damage = target->damage; m_healing = -target->damage; - m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied + m_spellAura = nullptr; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied //Spells with this flag cannot trigger if effect is casted on self bool canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE2); bool reflectedSpell = missInfo == SPELL_MISS_REFLECT; - Unit* spellHitTarget = NULL; + Unit* spellHitTarget = nullptr; if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target spellHitTarget = unitTarget; @@ -2637,7 +2637,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (missInfo2 != SPELL_MISS_MISS) m_caster->SendSpellMiss(spellHitTarget, m_spellInfo->Id, missInfo2); m_damage = 0; - spellHitTarget = NULL; + spellHitTarget = nullptr; // Xinef: if missInfo2 is MISS_EVADE, override base missinfo data if (missInfo2 == SPELL_MISS_EVADE) @@ -2717,7 +2717,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (crit) { procEx |= PROC_EX_CRITICAL_HIT; - addhealth = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, addhealth, NULL); + addhealth = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, addhealth, nullptr); } else procEx |= PROC_EX_NORMAL_HIT; @@ -3118,11 +3118,11 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA } if (effectMask & (1 << effectNumber)) - HandleEffects(unit, NULL, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + HandleEffects(unit, nullptr, nullptr, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); } if( sanct_effect >= 0 && (effectMask & (1<AI()->SpellHit(m_caster, m_spellInfo); @@ -3242,7 +3242,7 @@ void Spell::DoAllEffectOnTarget(ItemTargetInfo* target) for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) if (effectMask & (1 << effectNumber)) - HandleEffects(NULL, target->item, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + HandleEffects(nullptr, target->item, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); CallScriptOnHitHandlers(); @@ -3271,7 +3271,7 @@ bool Spell::UpdateChanneledTargetList() for(int i = EFFECT_0; i <= EFFECT_2; ++i) if (channelAuraMask & (1<Effects[i].RadiusEntry) { - range = m_spellInfo->Effects[i].CalcRadius(NULL, NULL); + range = m_spellInfo->Effects[i].CalcRadius(nullptr, nullptr); break; } @@ -3600,7 +3600,7 @@ void Spell::cancel(bool bySelf) SetReferencedFromCurrent(false); if (m_selfContainer && *m_selfContainer == this) - *m_selfContainer = NULL; + *m_selfContainer = nullptr; m_caster->RemoveDynObject(m_spellInfo->Id); if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet @@ -3615,7 +3615,7 @@ void Spell::cancel(bool bySelf) void Spell::cast(bool skipCheck) { Player* modOwner = m_caster->GetSpellModOwner(); - Spell* lastMod = NULL; + Spell* lastMod = nullptr; if (modOwner) { lastMod = modOwner->m_spellModTakingSpell; @@ -3995,7 +3995,7 @@ uint64 Spell::handle_delayed(uint64 t_offset) void Spell::_handle_immediate_phase() { - m_spellAura = NULL; + m_spellAura = nullptr; // initialize Diminishing Returns Data m_diminishLevel = DIMINISHING_LEVEL_1; m_diminishGroup = DIMINISHING_NONE; @@ -4013,7 +4013,7 @@ void Spell::_handle_immediate_phase() continue; // call effect handlers to handle destination hit - HandleEffects(NULL, NULL, NULL, j, SPELL_EFFECT_HANDLE_HIT); + HandleEffects(nullptr, nullptr, nullptr, j, SPELL_EFFECT_HANDLE_HIT); } // process items @@ -4757,7 +4757,7 @@ void Spell::SendLogExecute() data.append(*m_effectExecuteData[i]); delete m_effectExecuteData[i]; - m_effectExecuteData[i] = NULL; + m_effectExecuteData[i] = nullptr; } m_caster->SendMessageToSet(&data, true); } @@ -4963,9 +4963,9 @@ void Spell::TakeCastItem() // prevent crash at access to deleted m_targets.GetItemTarget if (m_CastItem == m_targets.GetItemTarget()) - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; } } @@ -5184,7 +5184,7 @@ void Spell::TakeReagents() if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : NULL; + ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : nullptr; // do not take reagents for these item casts if (castItemTemplate && castItemTemplate->Flags & ITEM_FLAG_NO_REAGENT_COST) @@ -5216,13 +5216,13 @@ void Spell::TakeReagents() } } - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; } // if GetItemTarget is also spell reagent if (m_targets.GetItemTargetEntry() == itemid) - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); p_caster->DestroyItemCount(itemid, itemcount, true); } @@ -5292,7 +5292,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT #endif // we do not need DamageMultiplier here. - damage = CalculateSpellDamage(i, NULL); + damage = CalculateSpellDamage(i, nullptr); bool preventDefault = CallScriptEffectHandlers((SpellEffIndex)i, mode); @@ -5439,7 +5439,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (instanceScript->IsEncounterInProgress()) { if (Group* group = m_caster->ToPlayer()->GetGroup()) - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) if (member->IsInMap(m_caster)) if (Unit* victim = member->GetVictim()) @@ -5599,7 +5599,7 @@ SpellCastResult Spell::CheckCast(bool strict) m_caster->GetZoneAndAreaId(zone, area); SpellCastResult locRes= m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area, - m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : NULL); + m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : nullptr); if (locRes != SPELL_CAST_OK) return locRes; } @@ -5926,7 +5926,7 @@ SpellCastResult Spell::CheckCast(bool strict) || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget())) return SPELL_FAILED_BAD_TARGETS; - Item* pTempItem = NULL; + Item* pTempItem = nullptr; if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM) { if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData()) @@ -5946,7 +5946,7 @@ SpellCastResult Spell::CheckCast(bool strict) { if (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetEntry() == 179697) { - if (!m_caster->ToPlayer()->CanUseBattlegroundObject(NULL)) + if (!m_caster->ToPlayer()->CanUseBattlegroundObject(nullptr)) return SPELL_FAILED_TRY_AGAIN; } else if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners, or Gurubashi chest @@ -6036,7 +6036,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK && strict) if (Pet* pet = m_caster->ToPlayer()->GetPet()) - pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player) + pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player) break; } case SPELL_EFFECT_SUMMON_PLAYER: @@ -6051,7 +6051,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; // Xinef: Implement summon pending error - if (target->GetSummonExpireTimer() > time(NULL)) + if (target->GetSummonExpireTimer() > time(nullptr)) return SPELL_FAILED_SUMMON_PENDING; // check if our map is dungeon @@ -6091,7 +6091,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; // Xinef: Implement summon pending error - if (target->GetSummonExpireTimer() > time(NULL)) + if (target->GetSummonExpireTimer() > time(nullptr)) return SPELL_FAILED_SUMMON_PENDING; break; @@ -6887,7 +6887,7 @@ SpellCastResult Spell::CheckItems() // TODO: Needs review if (pProto && !(pProto->ItemLimitCategory)) { - p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType); + p_caster->SendEquipError(msg, nullptr, nullptr, m_spellInfo->Effects[i].ItemType); return SPELL_FAILED_DONT_REPORT; } else @@ -6896,7 +6896,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_TOO_MANY_OF_ITEM; else if (!(target->ToPlayer()->HasItemCount(m_spellInfo->Effects[i].ItemType))) { - p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType); + p_caster->SendEquipError(msg, nullptr, nullptr, m_spellInfo->Effects[i].ItemType); return SPELL_FAILED_DONT_REPORT; } else @@ -6921,7 +6921,7 @@ SpellCastResult Spell::CheckItems() InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1); if (msg != EQUIP_ERR_OK) { - p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType); + p_caster->SendEquipError(msg, nullptr, nullptr, m_spellInfo->Effects[i].ItemType); return SPELL_FAILED_DONT_REPORT; } } @@ -7225,7 +7225,7 @@ SpellCastResult Spell::CheckSpellFocus() CellCoord p(acore::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); - GameObject* ok = NULL; + GameObject* ok = nullptr; acore::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus); acore::GameObjectSearcher checker(m_caster, ok, go_check); @@ -7338,7 +7338,7 @@ bool Spell::UpdatePointers() { m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID); if (m_originalCaster && !m_originalCaster->IsInWorld()) - m_originalCaster = NULL; + m_originalCaster = nullptr; } if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER) @@ -7349,7 +7349,7 @@ bool Spell::UpdatePointers() return false; } else - m_CastItem = NULL; + m_CastItem = nullptr; m_targets.Update(m_caster); @@ -7358,7 +7358,7 @@ bool Spell::UpdatePointers() return true; // cache last transport - WorldObject* transport = NULL; + WorldObject* transport = nullptr; // update effect destinations (in case of moved transport dest target) for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) @@ -7502,7 +7502,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const default: // normal case // Get GO cast coordinates if original caster -> GO - WorldObject* caster = NULL; + WorldObject* caster = nullptr; if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) @@ -7681,7 +7681,7 @@ void Spell::HandleLaunchPhase() if (!m_spellInfo->Effects[i].IsEffect()) continue; - HandleEffects(NULL, NULL, NULL, i, SPELL_EFFECT_HANDLE_LAUNCH); + HandleEffects(nullptr, nullptr, nullptr, i, SPELL_EFFECT_HANDLE_LAUNCH); } float multiplier[MAX_SPELL_EFFECTS]; @@ -7738,7 +7738,7 @@ void Spell::HandleLaunchPhase() void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, bool firstTarget) { - Unit* unit = NULL; + Unit* unit = nullptr; // In case spell hit target, do all effect on that target if (targetInfo.missCondition == SPELL_MISS_NONE) unit = m_caster->GetGUID() == targetInfo.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, targetInfo.targetGUID); @@ -7756,7 +7756,7 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, m_damage = 0; m_healing = 0; - HandleEffects(unit, NULL, NULL, i, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); + HandleEffects(unit, nullptr, nullptr, i, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); if (m_damage > 0) { @@ -7822,11 +7822,11 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, int32 basepoints = 0; m_damage = 0; - HandleEffects(target, NULL, NULL, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); + HandleEffects(target, nullptr, nullptr, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); basepoints = (targetInfo.crit ? Unit::SpellCriticalDamageBonus(m_caster, m_spellInfo, m_damage, target) : m_damage); m_damage = mdmg; - m_caster->CastCustomSpell(target, 26654, &basepoints, NULL, NULL, true); + m_caster->CastCustomSpell(target, 26654, &basepoints, nullptr, nullptr, true); if (m_spellInfo->Id != 44949) aur->DropCharge(); @@ -8273,7 +8273,7 @@ void Spell::PrepareTriggersExecutedOnHit() // this possibly needs fixing int32 auraBaseAmount = (*i)->GetBaseAmount(); // proc chance is stored in effect amount - int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); + int32 chance = m_caster->CalculateSpellDamage(nullptr, auraSpellInfo, auraSpellIdx, &auraBaseAmount); // build trigger and add to the list HitTriggerSpell spellTriggerInfo; spellTriggerInfo.triggeredSpell = spellInfo; @@ -8389,9 +8389,9 @@ WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* ref _targetSelectionType(selectionType), _condList(condList) { if (condList) - _condSrcInfo = new ConditionSourceInfo(NULL, caster); + _condSrcInfo = new ConditionSourceInfo(nullptr, caster); else - _condSrcInfo = NULL; + _condSrcInfo = nullptr; } WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck() diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 020e6a78c..9523511b2 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -393,11 +393,11 @@ class Spell uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList); template void SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius); - WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = NULL); + WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = nullptr); void SearchAreaTargets(std::list& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList); void SearchChainTargets(std::list& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, SpellTargetSelectionCategories selectCategory, ConditionList* condList, bool isChainHeal); - void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL); + void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = nullptr); void cancel(bool bySelf = false); void update(uint32 difftime); void cast(bool skipCheck = false); @@ -691,7 +691,7 @@ class Spell int32 chance; }; - bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura = NULL) const; + bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura = nullptr) const; void PrepareTriggersExecutedOnHit(); typedef std::list HitTriggerSpellList; HitTriggerSpellList m_hitTriggerSpells; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4f8992a19..f40f3996c 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -410,7 +410,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Conflagrate - consumes Immolate or Shadowflame else if (m_spellInfo->TargetAuraState == AURA_STATE_CONFLAGRATE) { - AuraEffect const* aura = NULL; // found req. aura for damage calculation + AuraEffect const* aura = nullptr; // found req. aura for damage calculation Unit::AuraEffectList const &mPeriodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE); for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) @@ -463,7 +463,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (AuraEffect* aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 214, 0)) { int32 bp0 = aurEff->GetId() == 54037 ? 4 : 8; - m_caster->CastCustomSpell(m_caster, 54425, &bp0, NULL, NULL, true); + m_caster->CastCustomSpell(m_caster, 54425, &bp0, nullptr, nullptr, true); } } } @@ -706,7 +706,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) case 17731: case 69294: { - if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(NULL) ) + if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(nullptr) ) return; gameObjTarget->SetRespawnTime(10); @@ -963,7 +963,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); // original caster guid only for GO cast - m_caster->CastSpell(targets, spellInfo, &values, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, m_originalCasterGUID); + m_caster->CastSpell(targets, spellInfo, &values, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, m_originalCasterGUID); } void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) @@ -1018,7 +1018,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); // original caster guid only for GO cast - m_caster->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK, NULL, NULL, m_originalCasterGUID); + m_caster->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK, nullptr, nullptr, m_originalCasterGUID); } void Spell::EffectForceCast(SpellEffIndex effIndex) @@ -1050,7 +1050,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) break; case 52463: // Hide In Mine Car case 52349: // Overtake - unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); + unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, nullptr, nullptr, true, nullptr, nullptr, m_originalCasterGUID); return; case 72378: // Blood Nova case 73058: // Blood Nova @@ -1405,7 +1405,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - WorldObject* target = NULL; + WorldObject* target = nullptr; // call events for object target if present if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -1524,8 +1524,8 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) { Unit::AuraEffectList const& RejorRegr = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); // find most short by duration - AuraEffect* forcedTargetAura = NULL; - AuraEffect* targetAura = NULL; + AuraEffect* forcedTargetAura = nullptr; + AuraEffect* targetAura = nullptr; for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID @@ -1668,7 +1668,7 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(newitemid); if (!pProto) { - player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } @@ -1750,7 +1750,7 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) else { // if not created by another reason from full inventory or unique items amount limitation - player->SendEquipError(msg, NULL, NULL, newitemid); + player->SendEquipError(msg, nullptr, nullptr, newitemid); return; } } @@ -1763,7 +1763,7 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) // was it successful? return error if not if (!pItem) { - player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } @@ -2243,9 +2243,9 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) // prevent crash at access and unexpected charges counting with item update queue corrupt if (m_CastItem == m_targets.GetItemTarget()) - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; player->StoreItem(dest, pNewItem, true); @@ -2263,9 +2263,9 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) // prevent crash at access and unexpected charges counting with item update queue corrupt if (m_CastItem == m_targets.GetItemTarget()) - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; player->BankItem(dest, pNewItem, true); @@ -2286,9 +2286,9 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) // prevent crash at access and unexpected charges counting with item update queue corrupt if (m_CastItem == m_targets.GetItemTarget()) - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); - m_CastItem = NULL; + m_CastItem = nullptr; m_castItemGUID = 0; player->EquipItem(dest, pNewItem, true); @@ -2346,7 +2346,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (Player* modOwner = m_originalCaster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); - TempSummon* summon = NULL; + TempSummon* summon = nullptr; // determine how many units should be summoned uint32 numSummons; @@ -2657,11 +2657,11 @@ void Spell::EffectDispel(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->GetCategory() == SPELLCATEGORY_DEVOUR_MAGIC) { int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue(); - m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true); + m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, nullptr, nullptr, true); // Glyph of Felhunter if (Unit* owner = m_caster->GetOwner()) if (owner->GetAura(56249)) - owner->CastCustomSpell(owner, 19658, &heal_amount, NULL, NULL, true); + owner->CastCustomSpell(owner, 19658, &heal_amount, nullptr, nullptr, true); } } @@ -2799,7 +2799,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) // not scale value for item based reward (/10 value expected) if (m_CastItem) { - unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage/10, false); + unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage/10, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); #endif @@ -2810,7 +2810,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) if (damage <= 50) { uint32 honor_reward = acore::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage)); - unitTarget->ToPlayer()->RewardHonor(NULL, 1, honor_reward, false); + unitTarget->ToPlayer()->RewardHonor(nullptr, 1, honor_reward, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); #endif @@ -2818,7 +2818,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) else { //maybe we have correct honor_gain in damage already - unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage, false); + unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); #endif @@ -2859,7 +2859,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) // and add a scroll DoCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType); itemTarget=NULL; - m_targets.SetItemTarget(NULL); + m_targets.SetItemTarget(nullptr); } else { @@ -3757,7 +3757,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) else { delete linkedGO; - linkedGO = NULL; + linkedGO = nullptr; return; } } @@ -3789,7 +3789,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) uint32 spell_id = roll_chance_i(20) ? 8854 : 8855; - m_caster->CastSpell(m_caster, spell_id, true, NULL); + m_caster->CastSpell(m_caster, spell_id, true, nullptr); return; } // Brittle Armor - need remove one 24575 Brittle Armor aura @@ -3886,7 +3886,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) uint8 bag = 19; uint8 slot = 0; - Item* item = NULL; + Item* item = nullptr; while (bag) // 256 = 0 due to var type { @@ -3930,7 +3930,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (m_caster->getGender() > 0) gender = "her"; sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName().c_str(), gender, gender, urand(1, 10), urand(1, 10)); - m_caster->MonsterTextEmote(buf, NULL); + m_caster->MonsterTextEmote(buf, nullptr); break; } // Roll 'dem Bones - Worn Troll Dice @@ -3941,7 +3941,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) if (m_caster->getGender() > 0) gender = "her"; sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName().c_str(), gender, urand(1, 6), urand(1, 6)); - m_caster->MonsterTextEmote(buf, NULL); + m_caster->MonsterTextEmote(buf, nullptr); break; } // Death Knight Initiate Visual @@ -4069,7 +4069,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) // proc a spellcast if (Aura* chargesAura = m_caster->GetAura(59907)) { - m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, m_caster->ToTempSummon()->GetSummonerGUID()); + m_caster->CastSpell(unitTarget, spell_heal, true, nullptr, nullptr, m_caster->ToTempSummon()->GetSummonerGUID()); if (chargesAura->ModCharges(-1)) m_caster->ToTempSummon()->UnSummon(); } @@ -4098,14 +4098,14 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) Creature* totem = unitTarget->GetMap()->GetCreature(unitTarget->m_SummonSlot[slot]); if (totem && totem->IsTotem()) { - m_caster->CastCustomSpell(totem, 55277, &basepoints0, NULL, NULL, true); + m_caster->CastCustomSpell(totem, 55277, &basepoints0, nullptr, nullptr, true); } } // Glyph of Stoneclaw Totem if (AuraEffect* aur=unitTarget->GetAuraEffect(63298, 0)) { basepoints0 *= aur->GetAmount(); - m_caster->CastCustomSpell(unitTarget, 55277, &basepoints0, NULL, NULL, true); + m_caster->CastCustomSpell(unitTarget, 55277, &basepoints0, nullptr, nullptr, true); } break; } @@ -4610,7 +4610,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex) player->DestroyItemCount(foodItem, count, true); // TODO: fix crash when a spell has two effects, both pointed at the same item target - m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, NULL, NULL, true); + m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, nullptr, nullptr, true); } void Spell::EffectDismissPet(SpellEffIndex effIndex) @@ -4961,7 +4961,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) // charge changes fall time if( m_caster->GetTypeId() == TYPEID_PLAYER ) - m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ()); + m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ()); if (m_pathFinder) { @@ -5082,7 +5082,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex) // xinef: changes fall time if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ()); + m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ()); } void Spell::EffectQuestClear(SpellEffIndex effIndex) @@ -5268,7 +5268,7 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/) } ApplyPct(mana, damage); if (mana) - m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true); + m_caster->CastCustomSpell(m_caster, 39104, &mana, nullptr, nullptr, true); } void Spell::EffectDurabilityDamage(SpellEffIndex effIndex) @@ -5471,7 +5471,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) else { delete linkedGO; - linkedGO = NULL; + linkedGO = nullptr; return; } } @@ -5968,7 +5968,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; Map* map = caster->GetMap(); - TempSummon* summon = NULL; + TempSummon* summon = nullptr; for (uint32 count = 0; count < numGuardians; ++count) { @@ -6184,7 +6184,7 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/) ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item_id); if (!pProto) { - player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr); return; } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 962be7044..e0ccc24ed 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -329,12 +329,12 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* Mechanic = Mechanics(spellEntry->EffectMechanic[effIndex]); TargetA = SpellImplicitTargetInfo(spellEntry->EffectImplicitTargetA[effIndex]); TargetB = SpellImplicitTargetInfo(spellEntry->EffectImplicitTargetB[effIndex]); - RadiusEntry = spellEntry->EffectRadiusIndex[effIndex] ? sSpellRadiusStore.LookupEntry(spellEntry->EffectRadiusIndex[effIndex]) : NULL; + RadiusEntry = spellEntry->EffectRadiusIndex[effIndex] ? sSpellRadiusStore.LookupEntry(spellEntry->EffectRadiusIndex[effIndex]) : nullptr; ChainTarget = spellEntry->EffectChainTarget[effIndex]; ItemType = spellEntry->EffectItemType[effIndex]; TriggerSpell = spellEntry->EffectTriggerSpell[effIndex]; SpellClassMask = spellEntry->EffectSpellClassMask[effIndex]; - ImplicitTargetConditions = NULL; + ImplicitTargetConditions = nullptr; } bool SpellEffectInfo::IsEffect() const @@ -509,7 +509,7 @@ int32 SpellEffectInfo::CalcBaseValue(int32 value) const float SpellEffectInfo::CalcValueMultiplier(Unit* caster, Spell* spell) const { float multiplier = ValueMultiplier; - if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL)) + if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr)) modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell); return multiplier; } @@ -517,14 +517,14 @@ float SpellEffectInfo::CalcValueMultiplier(Unit* caster, Spell* spell) const float SpellEffectInfo::CalcDamageMultiplier(Unit* caster, Spell* spell) const { float multiplier = DamageMultiplier; - if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL)) + if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr)) modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplier, spell); return multiplier; } bool SpellEffectInfo::HasRadius() const { - return RadiusEntry != NULL; + return RadiusEntry != nullptr; } float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const @@ -756,7 +756,7 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] = SpellInfo::SpellInfo(SpellEntry const* spellEntry) { Id = spellEntry->Id; - CategoryEntry = spellEntry->Category ? sSpellCategoryStore.LookupEntry(spellEntry->Category) : NULL; + CategoryEntry = spellEntry->Category ? sSpellCategoryStore.LookupEntry(spellEntry->Category) : nullptr; Dispel = spellEntry->Dispel; Mechanic = spellEntry->Mechanic; Attributes = spellEntry->Attributes; @@ -782,7 +782,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) TargetAuraSpell = spellEntry->targetAuraSpell; ExcludeCasterAuraSpell = spellEntry->excludeCasterAuraSpell; ExcludeTargetAuraSpell = spellEntry->excludeTargetAuraSpell; - CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : NULL; + CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : nullptr; RecoveryTime = spellEntry->RecoveryTime; CategoryRecoveryTime = spellEntry->CategoryRecoveryTime; StartRecoveryCategory = spellEntry->StartRecoveryCategory; @@ -796,7 +796,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) MaxLevel = spellEntry->maxLevel; BaseLevel = spellEntry->baseLevel; SpellLevel = spellEntry->spellLevel; - DurationEntry = spellEntry->DurationIndex ? sSpellDurationStore.LookupEntry(spellEntry->DurationIndex) : NULL; + DurationEntry = spellEntry->DurationIndex ? sSpellDurationStore.LookupEntry(spellEntry->DurationIndex) : nullptr; PowerType = spellEntry->powerType; ManaCost = spellEntry->manaCost; ManaCostPerlevel = spellEntry->manaCostPerlevel; @@ -804,7 +804,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) ManaPerSecondPerLevel = spellEntry->manaPerSecondPerLevel; ManaCostPercentage = spellEntry->ManaCostPercentage; RuneCostID = spellEntry->runeCostID; - RangeEntry = spellEntry->rangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->rangeIndex) : NULL; + RangeEntry = spellEntry->rangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->rangeIndex) : nullptr; Speed = spellEntry->speed; StackAmount = spellEntry->StackAmount; for (uint8 i = 0; i < 2; ++i) @@ -837,7 +837,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) Effects[i] = SpellEffectInfo(spellEntry, this, i); ExplicitTargetMask = _GetExplicitTargetMask(); - ChainEntry = NULL; + ChainEntry = nullptr; // Mine _isStackableWithRanks = false; @@ -1404,7 +1404,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const return SPELL_CAST_OK; bool actAsShifted = false; - SpellShapeshiftEntry const* shapeInfo = NULL; + SpellShapeshiftEntry const* shapeInfo = nullptr; if (form > 0) { shapeInfo = sSpellShapeshiftStore.LookupEntry(form); @@ -2420,7 +2420,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S bool SpellInfo::IsRanked() const { - return ChainEntry != NULL; + return ChainEntry != nullptr; } uint8 SpellInfo::GetRank() const @@ -2439,19 +2439,19 @@ SpellInfo const* SpellInfo::GetFirstRankSpell() const SpellInfo const* SpellInfo::GetLastRankSpell() const { if (!ChainEntry) - return NULL; + return nullptr; return ChainEntry->last; } SpellInfo const* SpellInfo::GetNextRankSpell() const { if (!ChainEntry) - return NULL; + return nullptr; return ChainEntry->next; } SpellInfo const* SpellInfo::GetPrevRankSpell() const { if (!ChainEntry) - return NULL; + return nullptr; return ChainEntry->prev; } @@ -2478,7 +2478,7 @@ SpellInfo const* SpellInfo::GetAuraRankForLevel(uint8 level) const if (!needRankSelection) return this; - for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != NULL; nextSpellInfo = nextSpellInfo->GetPrevRankSpell()) + for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell()) { // if found appropriate level if (uint32(level + 10) >= nextSpellInfo->SpellLevel) @@ -2488,7 +2488,7 @@ SpellInfo const* SpellInfo::GetAuraRankForLevel(uint8 level) const } // not found - return NULL; + return nullptr; } bool SpellInfo::IsRankOf(SpellInfo const* spellInfo) const @@ -2804,7 +2804,7 @@ void SpellInfo::_UnloadImplicitTargetConditionLists() for (uint8 j = i; j < MAX_SPELL_EFFECTS; ++j) { if (Effects[j].ImplicitTargetConditions == cur) - Effects[j].ImplicitTargetConditions = NULL; + Effects[j].ImplicitTargetConditions = nullptr; } delete cur; } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index e0afefd46..589cc228d 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -254,10 +254,10 @@ public: flag96 SpellClassMask; std::list* ImplicitTargetConditions; - SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0), + SpellEffectInfo() : _spellInfo(nullptr), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0), RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0), - BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTarget(0), - ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {} + BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(nullptr), ChainTarget(0), + ItemType(0), TriggerSpell(0), ImplicitTargetConditions(nullptr) {} SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex); bool IsEffect() const; @@ -270,13 +270,13 @@ public: bool IsFarDestTargetEffect() const; bool IsUnitOwnedAuraEffect() const; - int32 CalcValue(Unit const* caster = NULL, int32 const* basePoints = NULL, Unit const* target = NULL) const; + int32 CalcValue(Unit const* caster = NULL, int32 const* basePoints = NULL, Unit const* target = nullptr) const; int32 CalcBaseValue(int32 value) const; - float CalcValueMultiplier(Unit* caster, Spell* spell = NULL) const; - float CalcDamageMultiplier(Unit* caster, Spell* spell = NULL) const; + float CalcValueMultiplier(Unit* caster, Spell* spell = nullptr) const; + float CalcDamageMultiplier(Unit* caster, Spell* spell = nullptr) const; bool HasRadius() const; - float CalcRadius(Unit* caster = NULL, Spell* = NULL) const; + float CalcRadius(Unit* caster = NULL, Spell* = nullptr) const; uint32 GetProvidedTargetMask() const; uint32 GetMissingTargetMask(bool srcSet = false, bool destSet = false, uint32 mask = 0) const; @@ -453,9 +453,9 @@ public: bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const* spellInfo) const; SpellCastResult CheckShapeshift(uint32 form) const; - SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL) const; + SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = nullptr) const; SpellCastResult CheckTarget(Unit const* caster, WorldObject const* target, bool implicit = true) const; - SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const; + SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = nullptr) const; bool CheckTargetCreatureType(Unit const* target) const; // xinef: aura stacking @@ -477,17 +477,17 @@ public: SpellSpecificType GetSpellSpecific() const; float GetMinRange(bool positive = false) const; - float GetMaxRange(bool positive = false, Unit* caster = NULL, Spell* spell = NULL) const; + float GetMaxRange(bool positive = false, Unit* caster = NULL, Spell* spell = nullptr) const; int32 GetDuration() const; int32 GetMaxDuration() const; uint32 GetMaxTicks() const; - uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const; + uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = nullptr) const; uint32 GetRecoveryTime() const; - int32 CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, Spell* spell = NULL) const; + int32 CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, Spell* spell = nullptr) const; bool IsRanked() const; uint8 GetRank() const; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 47b42ad80..bab5bf996 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -548,7 +548,7 @@ SpellChainNode const* SpellMgr::GetSpellChainNode(uint32 spell_id) const { SpellChainMap::const_iterator itr = mSpellChains.find(spell_id); if (itr == mSpellChains.end()) - return NULL; + return nullptr; return &itr->second; } @@ -639,7 +639,7 @@ SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const if (itr != mSpellLearnSkills.end()) return &itr->second; else - return NULL; + return nullptr; } SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const @@ -647,7 +647,7 @@ SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, Spe SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(std::make_pair(spell_id, effIndex)); if (itr != mSpellTargetPositions.end()) return &itr->second; - return NULL; + return nullptr; } SpellGroupStackFlags SpellMgr::GetGroupStackFlags(uint32 groupid) const @@ -723,7 +723,7 @@ SpellProcEventEntry const* SpellMgr::GetSpellProcEvent(uint32 spellId) const SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId); if (itr != mSpellProcEventMap.end()) return &itr->second; - return NULL; + return nullptr; } bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellInfo const* procSpell, uint32 procFlags, uint32 procExtra, bool active) const @@ -788,7 +788,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell procEvent_procEx = spellProcEvent->procEx; // For melee triggers - if (procSpell == NULL) + if (procSpell == nullptr) { // Check (if set) for school (melee attack have Normal school) if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0) @@ -859,7 +859,7 @@ SpellProcEntry const* SpellMgr::GetSpellProcEntry(uint32 spellId) const SpellProcMap::const_iterator itr = mSpellProcMap.find(spellId); if (itr != mSpellProcMap.end()) return &itr->second; - return NULL; + return nullptr; } bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const @@ -940,7 +940,7 @@ SpellBonusEntry const* SpellMgr::GetSpellBonusData(uint32 spellId) const if (itr2 != mSpellBonusMap.end()) return &itr2->second; } - return NULL; + return nullptr; } SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const @@ -955,7 +955,7 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const if (itr != mSpellThreatMap.end()) return &itr->second; } - return NULL; + return nullptr; } float SpellMgr::GetSpellMixologyBonus(uint32 spellId) const @@ -978,7 +978,7 @@ PetAura const* SpellMgr::GetPetAura(uint32 spell_id, uint8 eff) const if (itr != mSpellPetAuraMap.end()) return &itr->second; else - return NULL; + return nullptr; } SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) const @@ -986,7 +986,7 @@ SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) c SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId); if (itr != mSpellEnchantProcEventMap.end()) return &itr->second; - return NULL; + return nullptr; } bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const @@ -997,7 +997,7 @@ bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const const std::vector* SpellMgr::GetSpellLinked(int32 spell_id) const { SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id); - return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL; + return itr != mSpellLinkedMap.end() ? &(itr->second) : nullptr; } PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) const @@ -1006,7 +1006,7 @@ PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) con if (itr != mPetLevelupSpellMap.end()) return &itr->second; else - return NULL; + return nullptr; } PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const @@ -1014,7 +1014,7 @@ PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id); if (itr != mPetDefaultSpellsMap.end()) return &itr->second; - return NULL; + return nullptr; } SpellAreaMapBounds SpellMgr::GetSpellAreaMapBounds(uint32 spell_id) const @@ -1186,7 +1186,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 void SpellMgr::UnloadSpellInfoChains() { for (SpellChainMap::iterator itr = mSpellChains.begin(); itr != mSpellChains.end(); ++itr) - mSpellInfoMap[itr->first]->ChainEntry = NULL; + mSpellInfoMap[itr->first]->ChainEntry = nullptr; mSpellChains.clear(); } @@ -1202,7 +1202,7 @@ void SpellMgr::LoadSpellTalentRanks() if (!talentInfo) continue; - SpellInfo const* lastSpell = NULL; + SpellInfo const* lastSpell = nullptr; for (uint8 rank = MAX_TALENT_RANK - 1; rank > 0; --rank) { if (talentInfo->RankID[rank]) @@ -1222,7 +1222,7 @@ void SpellMgr::LoadSpellTalentRanks() continue; } - SpellInfo const* prevSpell = NULL; + SpellInfo const* prevSpell = nullptr; for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { uint32 spellId = talentInfo->RankID[rank]; @@ -1242,7 +1242,7 @@ void SpellMgr::LoadSpellTalentRanks() node.rank = rank + 1; node.prev = prevSpell; - node.next = node.rank < MAX_TALENT_RANK ? GetSpellInfo(talentInfo->RankID[node.rank]) : NULL; + node.next = node.rank < MAX_TALENT_RANK ? GetSpellInfo(talentInfo->RankID[node.rank]) : nullptr; mSpellChains[spellId] = node; mSpellInfoMap[spellId]->ChainEntry = &mSpellChains[spellId]; @@ -1351,7 +1351,7 @@ void SpellMgr::LoadSpellRanks() ++itr; if (itr == rankChain.end()) { - mSpellChains[addedSpell].next = NULL; + mSpellChains[addedSpell].next = nullptr; break; } else @@ -2329,7 +2329,7 @@ bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpells return false; // remove duplicates with levelupSpells if any - if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : NULL) + if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : nullptr) { for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { @@ -2658,7 +2658,7 @@ void SpellMgr::LoadSpellInfoStore() uint32 oldMSTime = getMSTime(); UnloadSpellInfoStore(); - mSpellInfoMap.resize(sSpellStore.GetNumRows(), NULL); + mSpellInfoMap.resize(sSpellStore.GetNumRows(), nullptr); for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { @@ -2693,7 +2693,7 @@ void SpellMgr::LoadSpellSpecificAndAuraState() { uint32 oldMSTime = getMSTime(); - SpellInfo* spellInfo = NULL; + SpellInfo* spellInfo = nullptr; for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { spellInfo = mSpellInfoMap[i]; @@ -2785,7 +2785,7 @@ void SpellMgr::LoadSpellCustomAttr() mTalentSpellAdditionalSet.insert(learnSpell->Id); } - SpellInfo* spellInfo = NULL; + SpellInfo* spellInfo = nullptr; for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { spellInfo = mSpellInfoMap[i]; @@ -3268,7 +3268,7 @@ void SpellMgr::LoadDbcDataCorrections() { uint32 oldMSTime = getMSTime(); - SpellEntry* spellInfo = NULL; + SpellEntry* spellInfo = nullptr; for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { spellInfo = (SpellEntry*)sSpellStore.LookupEntry(i); diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index faf342b21..c02f6ce19 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -685,7 +685,7 @@ class SpellMgr SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const; // SpellInfo object management - SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : NULL; } + SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; } uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); } // Talent Additional Set diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 62ae37f4d..a855a087f 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -385,7 +385,7 @@ WorldLocation const* SpellScript::GetExplTargetDest() { if (m_spell->m_targets.HasDst()) return m_spell->m_targets.GetDstPos(); - return NULL; + return nullptr; } void SpellScript::SetExplTargetDest(WorldLocation& loc) @@ -418,7 +418,7 @@ Unit* SpellScript::GetHitUnit() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } return m_spell->unitTarget; } @@ -428,12 +428,12 @@ Creature* SpellScript::GetHitCreature() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } if (m_spell->unitTarget) return m_spell->unitTarget->ToCreature(); else - return NULL; + return nullptr; } Player* SpellScript::GetHitPlayer() @@ -441,12 +441,12 @@ Player* SpellScript::GetHitPlayer() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } if (m_spell->unitTarget) return m_spell->unitTarget->ToPlayer(); else - return NULL; + return nullptr; } Item* SpellScript::GetHitItem() @@ -454,7 +454,7 @@ Item* SpellScript::GetHitItem() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } return m_spell->itemTarget; } @@ -464,7 +464,7 @@ GameObject* SpellScript::GetHitGObj() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } return m_spell->gameObjTarget; } @@ -474,7 +474,7 @@ WorldLocation* SpellScript::GetHitDest() if (!IsInEffectHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } return m_spell->destTarget; } @@ -524,12 +524,12 @@ Aura* SpellScript::GetHitAura() if (!IsInTargetHook()) { sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); - return NULL; + return nullptr; } if (!m_spell->m_spellAura) - return NULL; + return nullptr; if (m_spell->m_spellAura->IsRemoved()) - return NULL; + return nullptr; return m_spell->m_spellAura; } @@ -894,7 +894,7 @@ void AuraScript::EffectProcHandler::Call(AuraScript* auraScript, AuraEffect cons bool AuraScript::_Load(Aura* aura) { m_aura = aura; - _PrepareScriptCall((AuraScriptHookType)SPELL_SCRIPT_STATE_LOADING, NULL); + _PrepareScriptCall((AuraScriptHookType)SPELL_SCRIPT_STATE_LOADING, nullptr); bool load = Load(); _FinishScriptCall(); return load; @@ -1141,7 +1141,7 @@ Unit* AuraScript::GetTarget() const sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); } - return NULL; + return nullptr; } AuraApplication const* AuraScript::GetTargetApplication() const diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 1ed69f077..76e51dfd8 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -49,7 +49,7 @@ class _SpellScript virtual bool _Validate(SpellInfo const* entry); public: - _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {} + _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(nullptr), m_scriptSpellId(0) {} virtual ~_SpellScript() {} virtual void _Register(); virtual void _Unload(); @@ -619,11 +619,11 @@ class AuraScript : public _SpellScript #define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: - AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false) + AuraScript() : _SpellScript(), m_aura(nullptr), m_auraApplication(nullptr), m_defaultActionPrevented(false) {} bool _Validate(SpellInfo const* entry); bool _Load(Aura* aura); - void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL); + void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = nullptr); void _FinishScriptCall(); bool _IsDefaultActionPrevented(); private: @@ -847,7 +847,7 @@ class AuraScript : public _SpellScript bool HasEffectType(AuraType type) const; // AuraScript interface - functions which are redirecting to AuraApplication class - // Do not call these in hooks in which AuraApplication is not avalible, otherwise result will differ from expected (the functions will return NULL) + // Do not call these in hooks in which AuraApplication is not avalible, otherwise result will differ from expected (the functions will return nullptr) // returns currently processed target of an aura // Return value does not need to be NULL-checked, the only situation this will (always) diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 23650a60d..ed0f81015 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -86,7 +86,7 @@ class CreatureTextMgr void SendEmote(Unit* source, uint32 emote); //if sent, returns the 'duration' of the text else 0 if error - uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = NULL, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, TeamId teamId = TEAM_NEUTRAL, bool gmOnly = false, Player* srcPlr = NULL); + uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = NULL, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, TeamId teamId = TEAM_NEUTRAL, bool gmOnly = false, Player* srcPlr = nullptr); bool TextExist(uint32 sourceEntry, uint8 textGroup); std::string GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const; @@ -112,7 +112,7 @@ class CreatureTextLocalizer public: CreatureTextLocalizer(Builder const& builder, ChatMsg msgType) : _builder(builder), _msgType(msgType) { - _packetCache.resize(TOTAL_LOCALES, NULL); + _packetCache.resize(TOTAL_LOCALES, nullptr); } ~CreatureTextLocalizer() diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index e87357e31..5c02404ff 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -16,7 +16,7 @@ #include "Player.h" #include "Opcodes.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 @@ -24,7 +24,7 @@ GmTicket::GmTicket() : _id(0), _playerGuid(0), _type(TICKET_TYPE_OPEN), _posX(0) _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { } -GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needMoreHelp(false) +GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _createTime(time(nullptr)), _lastModifiedTime(time(nullptr)), _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needMoreHelp(false) { _id = sTicketMgr->GenerateTicketId(); _playerName = player->GetName(); @@ -147,7 +147,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); @@ -235,7 +235,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)) { } +TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(nullptr)) { } TicketMgr::~TicketMgr() { @@ -336,7 +336,7 @@ void TicketMgr::AddTicket(GmTicket* ticket) _ticketList[ticket->GetId()] = ticket; if (!ticket->IsClosed()) ++_openTicketCount; - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SaveToDB(trans); } @@ -344,7 +344,7 @@ void TicketMgr::CloseTicket(uint32 ticketId, int64 source) { if (GmTicket* ticket = GetTicket(ticketId)) { - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetClosedBy(source); if (source) --_openTicketCount; @@ -366,7 +366,7 @@ void TicketMgr::ResolveAndCloseTicket(uint32 ticketId, int64 source) { if (GmTicket* ticket = GetTicket(ticketId)) { - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetClosedBy(source); ticket->SetResolvedBy(source); if (source) diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index b0fd8cff7..91a55b687 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -119,7 +119,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; } @@ -188,7 +188,7 @@ public: if (itr != _ticketList.end()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetTicketByPlayer(uint64 playerGuid) @@ -197,7 +197,7 @@ public: if (itr->second && itr->second->IsFromPlayer(playerGuid) && !itr->second->IsClosed()) return itr->second; - return NULL; + return nullptr; } GmTicket* GetOldestOpenTicket() @@ -206,7 +206,7 @@ public: if (itr->second && !itr->second->IsClosed() && !itr->second->IsCompleted()) return itr->second; - return NULL; + return nullptr; } void AddTicket(GmTicket* ticket); @@ -218,7 +218,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 GenerateTicketId() { return ++_lastTicketId; } uint32 GetOpenTicketCount() const { return _openTicketCount; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index a58ad7aba..e33c6d7e8 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -253,8 +253,8 @@ void StoreGUID(QueryResult result, uint32 data, uint32 field, std::set& // Writing - High-level functions bool PlayerDumpWriter::DumpTable(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) { diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 941304fe5..14386ec2d 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -19,8 +19,8 @@ #include "AccountMgr.h" #include "BanManager.h" -Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), - _dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false) +Warden::Warden() : _session(nullptr), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), + _dataSent(false), _previousTimestamp(0), _module(nullptr), _initialized(false) { memset(_inputKey, 0, sizeof(_inputKey)); memset(_outputKey, 0, sizeof(_outputKey)); @@ -31,7 +31,7 @@ Warden::~Warden() { delete[] _module->CompressedData; delete _module; - _module = NULL; + _module = nullptr; _initialized = false; } diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 682938185..b22c60cbe 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -197,7 +197,7 @@ WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) if (Id < CheckStore.size()) return CheckStore[Id]; - return NULL; + return nullptr; } WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 Id) @@ -205,5 +205,5 @@ WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 Id) CheckResultContainer::const_iterator itr = CheckResultStore.find(Id); if (itr != CheckResultStore.end()) return itr->second; - return NULL; + return nullptr; } diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 0e685b008..f4ebb73bb 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -31,7 +31,7 @@ namespace WeatherData const* GetWeatherData(uint32 zone_id) { WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id); - return (itr != mWeatherZoneMap.end()) ? &itr->second : NULL; + return (itr != mWeatherZoneMap.end()) ? &itr->second : nullptr; } } @@ -59,7 +59,7 @@ Weather* AddWeather(uint32 zone_id) // zone does not have weather, ignore if (!weatherChances) - return NULL; + return nullptr; Weather* w = new Weather(zone_id, weatherChances); m_weathers[w->GetZone()].reset(w); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 7960a51d1..adde6d044 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -100,7 +100,7 @@ World::World() m_allowMovement = true; m_ShutdownMask = 0; m_ShutdownTimer = 0; - m_gameTime = time(NULL); + m_gameTime = time(nullptr); m_gameMSTime = getMSTime(); m_startTime = m_gameTime; m_maxActiveSessionCount = 0; @@ -147,7 +147,7 @@ World::~World() m_offlineSessions.erase(m_offlineSessions.begin()); } - CliCommandHolder* command = NULL; + CliCommandHolder* command = nullptr; while (cliCmdQueue.next(command)) delete command; @@ -180,7 +180,7 @@ Player* World::FindPlayerInZone(uint32 zone) if (player->IsInWorld() && player->GetZoneId() == zone) return player; } - return NULL; + return nullptr; } bool World::IsClosed() const @@ -204,7 +204,7 @@ WorldSession* World::FindSession(uint32 id) const if (itr != m_sessions.end()) return itr->second; // also can return NULL for kicked session else - return NULL; + return nullptr; } WorldSession* World::FindOfflineSession(uint32 id) const @@ -213,17 +213,17 @@ WorldSession* World::FindOfflineSession(uint32 id) const if (itr != m_offlineSessions.end()) return itr->second; else - return NULL; + return nullptr; } WorldSession* World::FindOfflineSessionForCharacterGUID(uint32 guidLow) const { if (m_offlineSessions.empty()) - return NULL; + return nullptr; for (SessionMap::const_iterator itr = m_offlineSessions.begin(); itr != m_offlineSessions.end(); ++itr) if (itr->second->GetGuidLow() == guidLow) return itr->second; - return NULL; + return nullptr; } /// Remove a given session @@ -267,7 +267,7 @@ void World::AddSession_(WorldSession* s) WorldSession* oldSession = old->second; if (!RemoveQueuedPlayer(oldSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) - m_disconnects[s->GetAccountId()] = time(NULL); + m_disconnects[s->GetAccountId()] = time(nullptr); // pussywizard: if (oldSession->HandleSocketClosed()) @@ -281,7 +281,7 @@ void World::AddSession_(WorldSession* s) tmp->SetShouldSetOfflineInDB(false); delete tmp; } - oldSession->SetOfflineTime(time(NULL)); + oldSession->SetOfflineTime(time(nullptr)); m_offlineSessions[oldSession->GetAccountId()] = oldSession; } else @@ -323,7 +323,7 @@ bool World::HasRecentlyDisconnected(WorldSession* session) { for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();) { - if ((time(NULL) - i->second) < tolerance) + if ((time(nullptr) - i->second) < tolerance) { if (i->first == session->GetAccountId()) return true; @@ -1392,7 +1392,7 @@ void World::SetInitialWorldSettings() uint32 startupBegin = getMSTime(); ///- Initialize the random number generator - srand((unsigned int)time(NULL)); + srand((unsigned int)time(nullptr)); ///- Initialize detour memory management dtAllocSetCustom(dtCustomAlloc, dtCustomFree); @@ -1897,7 +1897,7 @@ void World::SetInitialWorldSettings() ///- Initialize game time and timers sLog->outString("Initialize game time and timers"); - m_gameTime = time(NULL); + m_gameTime = time(nullptr); m_startTime = m_gameTime; LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')", @@ -1922,7 +1922,7 @@ void World::SetInitialWorldSettings() // our speed up m_timers[WUPDATE_5_SECS].SetInterval(5*IN_MILLISECONDS); - mail_expire_check_timer = time(NULL) + 6*3600; + mail_expire_check_timer = time(nullptr) + 6*3600; ///- Initilize static helper structures AIRegistry::Initialize(); @@ -2376,7 +2376,7 @@ namespace acore { public: typedef std::vector WorldPacketList; - explicit WorldWorldTextBuilder(uint32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) {} + explicit WorldWorldTextBuilder(uint32 textId, va_list* args = nullptr) : i_textId(textId), i_args(args) {} void operator()(WorldPacketList& data_list, LocaleConstant loc_idx) { char const* text = sObjectMgr->GetAcoreString(i_textId, loc_idx); @@ -2397,14 +2397,14 @@ namespace acore do_helper(data_list, (char*)text); } private: - char* lineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; } + char* lineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; } void do_helper(WorldPacketList& data_list, char* text) { char* pos = text; while (char* line = lineFromMessage(pos)) { WorldPacket* data = new WorldPacket(); - ChatHandler::BuildChatPacket(*data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line); + ChatHandler::BuildChatPacket(*data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line); data_list.push_back(data); } } @@ -2467,7 +2467,7 @@ void World::SendGlobalText(const char* text, WorldSession* self) while (char* line = ChatHandler::LineFromMessage(pos)) { - ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line); + ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line); SendGlobalMessage(&data, self); } @@ -2501,7 +2501,7 @@ bool World::SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self void World::SendZoneText(uint32 zone, const char* text, WorldSession* self, TeamId teamId) { WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, text); + ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text); SendZoneMessage(zone, &data, self, teamId); } @@ -2532,7 +2532,7 @@ void World::KickAllLess(AccountTypes sec) void World::_UpdateGameTime() { ///- update the time - time_t thisTime = time(NULL); + time_t thisTime = time(nullptr); uint32 elapsed = uint32(thisTime - m_gameTime); m_gameTime = thisTime; m_gameMSTime = getMSTime(); @@ -2650,7 +2650,7 @@ void World::SendServerMessage(ServerMessageType type, const char *text, Player* void World::UpdateSessions(uint32 diff) { ///- Add new sessions - WorldSession* sess = NULL; + WorldSession* sess = nullptr; while (addSessQueue.next(sess)) AddSession_ (sess); @@ -2668,7 +2668,7 @@ void World::UpdateSessions(uint32 diff) if (pSession->HandleSocketClosed()) { if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) - m_disconnects[pSession->GetAccountId()] = time(NULL); + m_disconnects[pSession->GetAccountId()] = time(nullptr); m_sessions.erase(itr); // there should be no offline session if current one is logged onto a character SessionMap::iterator iter; @@ -2679,7 +2679,7 @@ void World::UpdateSessions(uint32 diff) tmp->SetShouldSetOfflineInDB(false); delete tmp; } - pSession->SetOfflineTime(time(NULL)); + pSession->SetOfflineTime(time(nullptr)); m_offlineSessions[pSession->GetAccountId()] = pSession; continue; } @@ -2687,7 +2687,7 @@ void World::UpdateSessions(uint32 diff) if (!pSession->Update(diff, updater)) { if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) - m_disconnects[pSession->GetAccountId()] = time(NULL); + m_disconnects[pSession->GetAccountId()] = time(nullptr); m_sessions.erase(itr); if (m_offlineSessions.find(pSession->GetAccountId()) != m_offlineSessions.end()) // pussywizard: don't set offline in db because offline session for that acc is present (character is in world) pSession->SetShouldSetOfflineInDB(false); @@ -2698,7 +2698,7 @@ void World::UpdateSessions(uint32 diff) // pussywizard: if (m_offlineSessions.empty()) return; - uint32 currTime = time(NULL); + uint32 currTime = time(nullptr); for (SessionMap::iterator itr = m_offlineSessions.begin(), next; itr != m_offlineSessions.end(); itr = next) { next = itr; @@ -2717,9 +2717,9 @@ void World::UpdateSessions(uint32 diff) // This handles the issued and queued CLI commands void World::ProcessCliCommands() { - CliCommandHolder::Print* zprint = NULL; - void* callbackArg = NULL; - CliCommandHolder* command = NULL; + CliCommandHolder::Print* zprint = nullptr; + void* callbackArg = nullptr; + CliCommandHolder* command = nullptr; while (cliCmdQueue.next(command)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -2836,7 +2836,7 @@ time_t World::GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour) { if (hour < 0 || hour > 23) hour = 0; - time_t curr = time(NULL); + time_t curr = time(nullptr); tm localTm; ACE_OS::localtime_r(&curr, &localTm); localTm.tm_hour = hour; @@ -2857,7 +2857,7 @@ time_t World::GetNextTimeWithMonthAndHour(int8 month, int8 hour) { if (hour < 0 || hour > 23) hour = 0; - time_t curr = time(NULL); + time_t curr = time(nullptr); tm localTm; ACE_OS::localtime_r(&curr, &localTm); localTm.tm_mday = 1; @@ -3362,7 +3362,7 @@ GlobalPlayerData const* World::GetGlobalPlayerData(uint32 guid) const } // Player not found - return NULL; + return nullptr; } uint32 World::GetGlobalPlayerGUID(std::string const& name) const diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 7c20db50e..cad13d9b8 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -713,14 +713,14 @@ class World void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); void SendZoneText(uint32 zone, const char *text, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); - void 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 IsShuttingDown() const { return m_ShutdownTimer > 0; } uint32 GetShutDownTimeLeft() const { return m_ShutdownTimer; } 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.value(); } diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index 77ac925da..e39a7fec0 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -64,10 +64,10 @@ public: if (!entryStr || !atoi(entryStr)) return false; - char* flagsStr = strtok(NULL, " "); + char* flagsStr = strtok(nullptr, " "); uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0; - char* commentStr = strtok(NULL, ""); + char* commentStr = strtok(nullptr, ""); if (!commentStr) return false; @@ -148,7 +148,7 @@ public: break; } - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); stmt->setUInt8(1, disableType); @@ -263,7 +263,7 @@ public: break; } - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = nullptr; stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES); stmt->setUInt32(0, entry); stmt->setUInt8(1, disableType); diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 5368fec2c..9302779cc 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -156,7 +156,7 @@ public: // navmesh poly -> navmesh tile location dtQueryFilter filter = dtQueryFilter(); dtPolyRef polyRef = INVALID_POLYREF; - if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL))) + if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, nullptr))) { handler->PSendSysMessage("Dt [??,??] (invalid poly, probably no tile loaded)"); return true; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index f6b9d7fd5..dd6779c0d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -407,7 +407,7 @@ public: boss->CombatStop(true); boss->LoadCreaturesAddon(true); boss->GetMotionMaster()->MoveTargetedHome(); - boss->SetLootRecipient(NULL); + boss->SetLootRecipient(nullptr); } boss->setFaction(FACTION_FRIEND); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index 18151303b..fe03c3744 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -143,7 +143,7 @@ public: switch (go->GetEntry()) { case GO_WHELP_SPAWNER: - go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP); + go->CastSpell(nullptr, SPELL_SUMMON_ROOKERY_WHELP); break; case GO_EMBERSEER_IN: go_emberseerin = go->GetGUID(); @@ -443,8 +443,8 @@ public: void Dragonspireroomcheck() { - Creature* mob = NULL; - GameObject* rune = NULL; + Creature* mob = nullptr; + GameObject* rune = nullptr; for (uint8 i = 0; i < 7; ++i) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index 65786d093..95ced2f65 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -171,7 +171,7 @@ public: break; case EVENT_BURNINGADRENALINE_CASTER: { - Unit* target = NULL; + Unit* target = nullptr; uint8 i = 0; while (i < 3) // max 3 tries to get a random target with power_mana diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 174c3421e..1e5269ba2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -81,7 +81,7 @@ class boss_curator : public CreatureScript void JustSummoned(Creature* summon) { summons.Summon(summon); - if (Unit* target = summon->SelectNearbyTarget(NULL, 40.0f)) + if (Unit* target = summon->SelectNearbyTarget(nullptr, 40.0f)) { summon->AI()->AttackStart(target); summon->AddThreat(target, 1000.0f); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 2bdde2279..1c8ce4ed2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -89,7 +89,7 @@ public: struct netherspite_infernalAI : public ScriptedAI { netherspite_infernalAI(Creature* creature) : ScriptedAI(creature), - HellfireTimer(0), CleanupTimer(0), malchezaar(0), point(NULL) { } + HellfireTimer(0), CleanupTimer(0), malchezaar(0), point(nullptr) { } uint32 HellfireTimer; uint32 CleanupTimer; @@ -365,7 +365,7 @@ public: { if (SWPainTimer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; if (phase == 1) target = me->GetVictim(); // Target the Tank else // anyone but the tank @@ -416,7 +416,7 @@ public: { if (AmplifyDamageTimer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (target) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 9bce401ff..2a4df43fc 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -391,10 +391,10 @@ public: { ElementalsSpawned = true; - Creature* ElementalOne = NULL; - Creature* ElementalTwo = NULL; - Creature* ElementalThree = NULL; - Creature* ElementalFour = NULL; + Creature* ElementalOne = nullptr; + Creature* ElementalTwo = nullptr; + Creature* ElementalThree = nullptr; + Creature* ElementalFour = nullptr; ElementalOne = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11168.1f, -1939.29f, 232.092f, 1.46f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); ElementalTwo = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11138.2f, -1915.38f, 232.092f, 3.00f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 1285f9070..c94dab2af 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -171,9 +171,9 @@ public: if (action == ACTION_TELEPORT_PLAYERS) me->CastSpell(player, SPELL_GRAVITY_LAPSE_PLAYER+counter, true); else if (action == ACTION_KNOCKUP) - player->CastSpell(player, SPELL_GRAVITY_LAPSE_DOT, true, NULL, NULL, me->GetGUID()); + player->CastSpell(player, SPELL_GRAVITY_LAPSE_DOT, true, nullptr, nullptr, me->GetGUID()); else if (action == ACTION_ALLOW_FLY) - player->CastSpell(player, SPELL_GRAVITY_LAPSE_FLY, true, NULL, NULL, me->GetGUID()); + player->CastSpell(player, SPELL_GRAVITY_LAPSE_FLY, true, nullptr, nullptr, me->GetGUID()); else if (action == ACTION_REMOVE_FLY) { player->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 98f7550cb..05167e1f5 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -206,7 +206,7 @@ public: } case EVENT_SPELL_DISPEL: { - Unit* target = NULL; + Unit* target = nullptr; switch (urand(0, 2)) { case 0: target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true); break; @@ -273,7 +273,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI const float dist_factor = (aiType == AI_TYPE_MELEE ? 15.0f : 25.0f); float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 float mod_health = health > 20000 ? 2.0f : (40000-health)/10000.0f; // 2.0 .. 4.0 - float mod_armor = aiType == AI_TYPE_MELEE ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; + float mod_armor = aiType == AI_TYPE_MELEE ? Unit::CalcArmorReducedDamage(me, target, 10000, nullptr)/10000.0f : 1.0f; return mod_dist * mod_health * mod_armor; } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index d13241d4a..bc4569e08 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -131,7 +131,7 @@ public: return; CrystalGUID = 0; - Unit* crystal = NULL; + Unit* crystal = nullptr; for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ) if (Creature* summon = ObjectAccessor::GetCreature(*me, *i++)) if (!crystal || me->GetDistanceOrder(summon, crystal, false)) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 577639ff7..310173113 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -235,7 +235,7 @@ public: { me->DeleteThreatList(); me->CombatStop(false); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); if (HasEscortState(STATE_ESCORT_ESCORTING)) { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index a967bd2a3..d497ac46f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -582,7 +582,7 @@ public: //If we are <75% hp cast healing spells at self or Mograine if (Heal_Timer <= diff) { - Creature* target = NULL; + Creature* target = nullptr; if (!HealthAbovePct(75)) target = me; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 77efc4074..a5ba5056e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -636,7 +636,7 @@ public: orb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (Creature* trigger = me->SummonTrigger(orb->GetPositionX(), orb->GetPositionY(), orb->GetPositionZ(), 0, 10*MINUTE*IN_MILLISECONDS)) { - trigger->CastSpell(trigger, SPELL_RING_OF_BLUE_FLAMES, true, NULL, NULL, trigger->GetGUID()); + trigger->CastSpell(trigger, SPELL_RING_OF_BLUE_FLAMES, true, nullptr, nullptr, trigger->GetGUID()); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KILJAEDEN_CONTROLLER))) controller->AI()->JustSummoned(trigger); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index fc35e78cf..73dfc0c0e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -71,7 +71,7 @@ class instance_sunwell_plateau : public InstanceMapScript //else // TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - return NULL; + return nullptr; } void OnCreatureCreate(Creature* creature) diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index b1fc73dde..0e3fa4d45 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -72,8 +72,8 @@ class instance_uldaman : public InstanceMapScript break; case DATA_ARCHAEDAS: _encounters[type] = data; - HandleGameObject(ancientVaultDoorGUID, data == DONE, NULL); - HandleGameObject(archaedasTempleDoorGUID, data != IN_PROGRESS, NULL); + HandleGameObject(ancientVaultDoorGUID, data == DONE, nullptr); + HandleGameObject(archaedasTempleDoorGUID, data != IN_PROGRESS, nullptr); break; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 75fc68d5f..c25dac1db 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -170,7 +170,7 @@ class boss_akilzon : public CreatureScript if (Unit* target = (*i)) { if (Cloud && !Cloud->IsWithinDist(target, 6, false)) - Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); + Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, me->GetGUID()); } } @@ -188,7 +188,7 @@ class boss_akilzon : public CreatureScript trigger->SetHealth(100000); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Cloud) - Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, Cloud->GetGUID()); + Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, Cloud->GetGUID()); } } } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 5f4e9de0a..80688dd01 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -453,7 +453,7 @@ class boss_hexlord_malacrass : public CreatureScript void UseAbility() { uint8 random = urand(0, 2); - Unit* target = NULL; + Unit* target = nullptr; switch (PlayerAbility[PlayerClass][random].target) { case ABILITY_TARGET_SELF: diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 26d131eca..456ed3f30 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -184,7 +184,7 @@ class boss_janalai : public CreatureScript void FireWall() { uint8 WallNum; - Creature* wall = NULL; + Creature* wall = nullptr; for (uint8 i = 0; i < 4; ++i) { if (i == 0 || i == 2) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index f52912393..a380e25f0 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -252,7 +252,7 @@ class boss_zuljin : public CreatureScript void SpawnAdds() { - Creature* creature = NULL; + Creature* creature = nullptr; for (uint8 i = 0; i < 4; ++i) { creature = me->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 21f591ca4..1d6786bd5 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -99,7 +99,7 @@ class boss_marli : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { Talk(SAY_SPIDER_SPAWN); - Creature* Spider = NULL; + Creature* Spider = nullptr; Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); @@ -158,7 +158,7 @@ class boss_marli : public CreatureScript } case EVENT_CHARGE_PLAYER: { - Unit* target = NULL; + Unit* target = nullptr; int i = 0; while (i++ < 3) // max 3 tries to get a random target with power_mana { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 71f21455e..4ab500700 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -89,7 +89,7 @@ class boss_renataki : public CreatureScript { if (Ambush_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { @@ -123,7 +123,7 @@ class boss_renataki : public CreatureScript { if (Aggro_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (DoGetThreat(me->GetVictim())) diff --git a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp index 7066b6daa..4ac5ae510 100644 --- a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp @@ -48,7 +48,7 @@ class spell_razelikh_teleport_group : public SpellScriptLoader { if (Group* group = player->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) if (Player* member = itr->GetSource()) if (member->IsWithinDistInMap(player, 20.0f) && !member->isDead()) member->CastSpell(member, SPELL_TELEPORT_SINGLE_IN_GROUP, true); diff --git a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp index 1e2400614..71eea9a85 100644 --- a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp @@ -287,7 +287,7 @@ public: timer += diff; if (timer >= 4000) { - Unit* target = _targetGUID ? ObjectAccessor::GetUnit(*me, _targetGUID) : NULL; + Unit* target = _targetGUID ? ObjectAccessor::GetUnit(*me, _targetGUID) : nullptr; if (!target) target = me->FindNearestCreature(NPC_INJURED_PEASANT, 60.0f); diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 86c44baac..fcec72d69 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -220,7 +220,7 @@ public: { if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) { - Unit* target = NULL; + Unit* target = nullptr; if (PlayerGUID) if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) if (player->IsAlive() && RAND(0, 1)) diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp index 149c4bf99..e4f26d9ea 100644 --- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp @@ -64,7 +64,7 @@ public: { case 0: { - GameObject* cage = NULL; + GameObject* cage = nullptr; if (galensCageGUID) cage = me->GetMap()->GetGameObject(galensCageGUID); else diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index fe5d6bab7..64506defe 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -1010,7 +1010,7 @@ public: { me->DeleteThreatList(); me->CombatStop(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); if (HasEscortState(STATE_ESCORT_ESCORTING)) { @@ -2356,7 +2356,7 @@ public: me->RemoveAura(SPELL_HEROIC_VANGUARD); me->DeleteThreatList(); me->CombatStop(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); if (HasEscortState(STATE_ESCORT_ESCORTING)) { diff --git a/src/server/scripts/Events/brewfest.cpp b/src/server/scripts/Events/brewfest.cpp index b29d6a5cc..5b4c0a876 100644 --- a/src/server/scripts/Events/brewfest.cpp +++ b/src/server/scripts/Events/brewfest.cpp @@ -141,7 +141,7 @@ public: { if (param == ACTION_START_FIGHT) { - Creature* cr = NULL; + Creature* cr = nullptr; for (int i = 0; i < 3; ++i) { @@ -285,7 +285,7 @@ public: if (Unit* coren = me->ToTempSummon()->GetSummoner()) return coren->ToCreature(); - return NULL; + return nullptr; } void JustDied(Unit*) @@ -436,7 +436,7 @@ public: { if (Aura* aur = player->GetAura(SPELL_RAM_AURA)) { - int32 diff = aur->GetApplyTime() - (time(NULL)-(HOUR*18)+spellCooldown); + int32 diff = aur->GetApplyTime() - (time(nullptr)-(HOUR*18)+spellCooldown); if (diff > 10) // aura applied later return; @@ -844,7 +844,7 @@ public: bool AllowStart() { - time_t curtime = time(NULL); + time_t curtime = time(nullptr); tm strDate; ACE_OS::localtime_r(&curtime, &strDate); @@ -1113,7 +1113,7 @@ public: if (timer >= 500) { timer = 0; - Player* player = NULL; + Player* player = nullptr; acore::AnyPlayerInObjectRangeCheck checker(me, 2.0f); acore::PlayerSearcher searcher(me, player, checker); me->VisitNearbyWorldObject(2.0f, searcher); @@ -1471,7 +1471,7 @@ public: if (item && player->AddItem(item, 1)) // ensure filled keg is stored { player->DestroyItemCount(itemCaster->GetEntry(), 1, true); - GetSpell()->m_CastItem = NULL; + GetSpell()->m_CastItem = nullptr; GetSpell()->m_castItemGUID = 0; } } @@ -1538,7 +1538,7 @@ public: if (item && player->AddItem(item, 1)) // ensure filled keg is stored { player->DestroyItemCount(itemCaster->GetEntry(), 1, true); - GetSpell()->m_CastItem = NULL; + GetSpell()->m_CastItem = nullptr; GetSpell()->m_castItemGUID = 0; } } @@ -1584,7 +1584,7 @@ public: if (!caster) return; - WorldObject* target = NULL; + WorldObject* target = nullptr; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if (caster->HasInLine((*itr), 2.0f)) { @@ -1613,7 +1613,7 @@ public: void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - Creature* cr = NULL; + Creature* cr = nullptr; Unit* caster = GetCaster(); if (!caster) return; diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp index 451ad75cc..285e5636f 100644 --- a/src/server/scripts/Events/hallows_end.cpp +++ b/src/server/scripts/Events/hallows_end.cpp @@ -148,8 +148,8 @@ class spell_hallows_end_trick_or_treat : public SpellScriptLoader { if (Player* target = GetHitPlayer()) { - GetCaster()->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL); - GetCaster()->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL); + GetCaster()->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, nullptr); + GetCaster()->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, nullptr); } } @@ -187,7 +187,7 @@ class spell_hallows_end_candy : public SpellScriptLoader if (Player* target = GetHitPlayer()) { uint32 spellId = SPELL_HALLOWS_END_CANDY_1+urand(0,3); - GetCaster()->CastSpell(target, spellId, true, NULL); + GetCaster()->CastSpell(target, spellId, true, nullptr); } } @@ -709,7 +709,7 @@ class npc_hallows_end_soh : public CreatureScript tmpList.push_back(c); if (tmpList.empty()) - return NULL; + return nullptr; std::list::const_iterator it2 = tmpList.begin(); std::advance(it2, urand(0, tmpList.size() - 1)); @@ -989,7 +989,7 @@ class boss_headless_horseman : public CreatureScript } } - Player* GetRhymePlayer() { return playerGUID ? ObjectAccessor::GetPlayer(*me, playerGUID) : NULL; } + Player* GetRhymePlayer() { return playerGUID ? ObjectAccessor::GetPlayer(*me, playerGUID) : nullptr; } void EnterCombat(Unit*) { me->SetInCombatWithZone(); } void MoveInLineOfSight(Unit* /*who*/) {} @@ -1229,7 +1229,7 @@ class boss_headless_horseman_head : public CreatureScript if (me->ToTempSummon()) return me->ToTempSummon()->GetSummoner(); - return NULL; + return nullptr; } void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) diff --git a/src/server/scripts/Events/love_in_air.cpp b/src/server/scripts/Events/love_in_air.cpp index 64d1615d0..191ff390c 100644 --- a/src/server/scripts/Events/love_in_air.cpp +++ b/src/server/scripts/Events/love_in_air.cpp @@ -462,7 +462,7 @@ class npc_love_in_air_hummel_helper : public CreatureScript { Position pos(*me); me->Relocate(target); - me->CastSpell(me, RAND(SPELL_THROW_COLOGNE, SPELL_THROW_PERFUME), true, NULL, NULL, me->GetGUID()); + me->CastSpell(me, RAND(SPELL_THROW_COLOGNE, SPELL_THROW_PERFUME), true, nullptr, nullptr, me->GetGUID()); me->Relocate(pos); } events.RepeatEvent(10000); @@ -553,7 +553,7 @@ class spell_love_in_air_periodic_perfumes : public SpellScriptLoader if (target->IsImmunedToSpell(sSpellMgr->GetSpellInfo(spellId))) return; - target->CastSpell(target, spellId, true, NULL, NULL, guid); + target->CastSpell(target, spellId, true, nullptr, nullptr, guid); } } diff --git a/src/server/scripts/Events/midsummer.cpp b/src/server/scripts/Events/midsummer.cpp index 963c7a670..a8b7151da 100644 --- a/src/server/scripts/Events/midsummer.cpp +++ b/src/server/scripts/Events/midsummer.cpp @@ -300,7 +300,7 @@ public: } // Achievement - if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER) + if ((time(nullptr) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER) target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target); } } diff --git a/src/server/scripts/Events/pilgrims_bounty.cpp b/src/server/scripts/Events/pilgrims_bounty.cpp index 691760b83..a36981094 100644 --- a/src/server/scripts/Events/pilgrims_bounty.cpp +++ b/src/server/scripts/Events/pilgrims_bounty.cpp @@ -115,7 +115,7 @@ class npc_pilgrims_bounty_chair : public CreatureScript uint32 timerSpawnPlate; uint32 timerRotateChair; - Creature* GetPlate() { return plateGUID ? ObjectAccessor::GetCreature(*me, plateGUID) : NULL; } + Creature* GetPlate() { return plateGUID ? ObjectAccessor::GetCreature(*me, plateGUID) : nullptr; } void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) { diff --git a/src/server/scripts/Events/winter_veil.cpp b/src/server/scripts/Events/winter_veil.cpp index 3d9c38cb1..931bc2858 100644 --- a/src/server/scripts/Events/winter_veil.cpp +++ b/src/server/scripts/Events/winter_veil.cpp @@ -139,7 +139,7 @@ class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader PreventHitEffect(EFFECT_1); std::list unitList; - Unit* target = NULL; + Unit* target = nullptr; caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_BLUE_RACER); if (!unitList.empty()) for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) @@ -257,17 +257,17 @@ class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader if (GetSpellInfo()->Id == SPELL_AIR_RIFLE_HIT_TRIGGER) { if (!caster->IsFriendlyTo(target)) - caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, nullptr, nullptr, caster->GetGUID()); } else { uint8 rand = urand(0, 99); if (rand < 15) - caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, nullptr, nullptr, caster->GetGUID()); else if (rand < 35) - caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, nullptr, nullptr, caster->GetGUID()); else - caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, NULL, NULL, caster->GetGUID()); + caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, nullptr, nullptr, caster->GetGUID()); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 8c2d992d1..18e64e270 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -91,7 +91,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { if (!creature->GetInstanceScript()) - return NULL; + return nullptr; hyjalAI* ai = new hyjalAI(creature); @@ -176,7 +176,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { if (!creature->GetInstanceScript()) - return NULL; + return nullptr; hyjalAI* ai = new hyjalAI(creature); @@ -204,7 +204,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { if (!creature->GetInstanceScript()) - return NULL; + return nullptr; hyjalAI* ai = new hyjalAI(creature); ai->Reset(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 57fb1cefc..5ca2de6ee 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -409,7 +409,7 @@ void hyjalAI::EnterEvadeMode() if (me->IsAlive()) me->GetMotionMaster()->MoveTargetedHome(); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); } void hyjalAI::EnterCombat(Unit* /*who*/) @@ -439,7 +439,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) { SpawnLoc[i] = Base[random][i]; } - Creature* creature = NULL; + Creature* creature = nullptr; switch (entry) { case 17906: //GARGOYLE @@ -828,7 +828,7 @@ void hyjalAI::UpdateAI(uint32 diff) if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(false); - Unit* target = NULL; + Unit* target = nullptr; switch (Spells[i].TargetType) { @@ -918,7 +918,7 @@ void hyjalAI::WaypointReached(uint32 waypointId) { if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL)) { - me->MonsterYell(YELL_HURRY, LANG_UNIVERSAL, NULL); + me->MonsterYell(YELL_HURRY, LANG_UNIVERSAL, nullptr); WaitForTeleport = true; TeleportTimer = 20000; if (me->GetEntry() == JAINA) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 25cf91172..008c8e8f8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -435,7 +435,7 @@ public: SetEscortPaused(false); SetRun(false); - Creature* cr = NULL; + Creature* cr = nullptr; if ((cr = me->SummonCreature(NPC_CITY_MAN3, EventPos[EVENT_SRC_HALL_CITYMAN1]))) cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); if ((cr = me->SummonCreature(NPC_CITY_MAN4, EventPos[EVENT_SRC_HALL_CITYMAN2]))) @@ -1197,7 +1197,7 @@ Creature* npc_arthas::npc_arthasAI::GetEventNpc(uint32 entry) ++i; } - return NULL; + return nullptr; } void npc_arthas::npc_arthasAI::ScheduleNextEvent(uint32 currentEvent, uint32 time) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index 3516ce529..4614f6797 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -228,7 +228,7 @@ public: void SummonPortalKeeper() { - Creature* rift = NULL; + Creature* rift = nullptr; for (std::set::const_iterator itr = encounterNPCs.begin(); itr != encounterNPCs.end(); ++itr) if (Creature* summon = instance->GetCreature(*itr)) if (summon->GetEntry() == NPC_TIME_RIFT) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index ee551b5e2..164bc6696 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -177,7 +177,7 @@ public: //Charge_Timer if (Charge_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 74f1af0ac..e8a6e771c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -266,7 +266,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - Creature* Spawned = NULL; + Creature* Spawned = nullptr; //Spawn claw tentacle on the random target Spawned = me->SummonCreature(NPC_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500); @@ -529,7 +529,7 @@ public: Unit* SelectRandomNotStomach() { if (Stomach_Map.empty()) - return NULL; + return nullptr; std::unordered_map::const_iterator i = Stomach_Map.begin(); @@ -550,7 +550,7 @@ public: } if (temp.empty()) - return NULL; + return nullptr; j = temp.begin(); @@ -749,7 +749,7 @@ public: //Set target in stomach Stomach_Map[target->GetGUID()] = true; target->InterruptNonMeleeSpells(false); - target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); + target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, nullptr, nullptr, me->GetGUID()); StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 690776efd..ce4b0babd 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -102,7 +102,7 @@ public: //ChangeTarget_Timer if (Submerged && ChangeTarget_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 12fe530e7..d5bd660cc 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -297,9 +297,9 @@ struct boss_twinemperorsAI : public ScriptedAI me->GetCreatureListWithEntryInGrid(lUnitList, 15317, 150.0f); if (lUnitList.empty()) - return NULL; + return nullptr; - Creature* nearb = NULL; + Creature* nearb = nullptr; for (std::list::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter) { @@ -522,7 +522,7 @@ public: //Blizzard_Timer if (Blizzard_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true); if (target) DoCast(target, SPELL_BLIZZARD); @@ -532,7 +532,7 @@ public: if (ArcaneBurst_Timer <= diff) { Unit* mvic; - if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL) + if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != nullptr) { DoCast(mvic, SPELL_ARCANEBURST); ArcaneBurst_Timer = 5000; diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 51400f540..5b73917ae 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -188,7 +188,7 @@ class npc_cork_gizelton : public CreatureScript RemoveSummons(); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - Creature* cr = NULL; + Creature* cr = nullptr; if ((cr = me->SummonCreature(NPC_RIGGER_GIZELTON, *me))) { cr->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); @@ -328,7 +328,7 @@ class npc_cork_gizelton : public CreatureScript if (!_playerGUID) return; ImmuneFlagSet(true, _faction); - Creature* cr = NULL; + Creature* cr = nullptr; for (uint8 i = 0; i < 4; ++i) { float o = (i*M_PI/2)+(M_PI/4); @@ -353,7 +353,7 @@ class npc_cork_gizelton : public CreatureScript if (!_playerGUID) return; ImmuneFlagSet(true, _faction); - Creature* cr = NULL; + Creature* cr = nullptr; for (uint8 i = 0; i < 3; ++i) { float o = i*2*M_PI/3; diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 734938988..d73846313 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -638,7 +638,7 @@ public: case 51: { uint32 entries[4] = { 15423, 15424, 15414, 15422 }; - Unit* mob = NULL; + Unit* mob = nullptr; for (uint8 i = 0; i < 4; ++i) { mob = player->FindNearestCreature(entries[i], 50, me); @@ -806,7 +806,7 @@ public: } if (!hasTarget) { - Unit* target = NULL; + Unit* target = nullptr; if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) target = me->FindNearestCreature(15423, 20, true); if (me->GetEntry() == 15423) @@ -926,7 +926,7 @@ public: if (Group* EventGroup = player->GetGroup()) { - Player* groupMember = NULL; + Player* groupMember = nullptr; uint8 GroupMemberCount = 0; uint8 DeadMemberCount = 0; diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index 0169f1167..32d307b1f 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -82,7 +82,7 @@ public: !player->HasItemCount(11522, 1, true)) { ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL); + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, nullptr); if (msg == EQUIP_ERR_OK) player->StoreNewItem(dest, 11522, true); } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 272bfd642..9fa686391 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -323,7 +323,7 @@ public: // The array MUST be terminated by {0, 0, 0} DialogueHelper(DialogueEntry const* dialogueArray) : _dialogueArray(dialogueArray), - _currentEntry(NULL), + _currentEntry(nullptr), _actionTimer(0) { } // The array MUST be terminated by {0, 0, 0, 0, 0} @@ -367,7 +367,7 @@ protected: /// Will be called when a dialogue step was done virtual void JustDidDialogueStep(int32 /*entry*/) { } /// Will be called to get a speaker, MUST be implemented if not used in instances - virtual Creature* GetSpeakerByEntry(int32 /*entry*/) { return NULL; } + virtual Creature* GetSpeakerByEntry(int32 /*entry*/) { return nullptr; } private: void DoNextDialogueStep() @@ -724,7 +724,7 @@ public: case NPC_PRIESTESS_DATA_2: return me->GetMap()->GetCreature(_secondPriestessGUID); default: - return NULL; + return nullptr; } } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 52d4e355d..047e4a993 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -244,7 +244,7 @@ public: void SendLavaWaves(bool start) { - Unit* cr = NULL; + Unit* cr = nullptr; for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { cr = ObjectAccessor::GetUnit(*me, *itr); @@ -262,7 +262,7 @@ public: { if (pInstance) { - Unit* cr = NULL; + Unit* cr = nullptr; for (uint8 i = 0; i < 3; ++i) if ((cr = ObjectAccessor::GetUnit(*me, pInstance->GetData64(DATA_TENEBRON+i)))) { @@ -301,7 +301,7 @@ public: { if (pInstance) { - Creature* cr = NULL; + Creature* cr = nullptr; for (uint8 i = 0; i < 3; ++i) if (dragons[i]) if ((cr = ObjectAccessor::GetCreature(*me, dragons[i]))) @@ -482,7 +482,7 @@ void boss_sartharion::boss_sartharionAI::HandleSartharionAbilities() if (!urand(0,2)) Talk(SAY_SARTHARION_SPECIAL_4); - Creature* cr = NULL; + Creature* cr = nullptr; summons.RemoveNotExisting(); uint8 rand = urand(0,4); // 5 - numer of cyclones uint8 iter = 0; @@ -514,7 +514,7 @@ void boss_sartharion::boss_sartharionAI::HandleSartharionAbilities() if (me->HealthBelowPct(11)) { - Creature* cr = NULL; + Creature* cr = nullptr; summons.RemoveNotExisting(); for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) { @@ -765,7 +765,7 @@ public: case EVENT_MINIBOSS_SPAWN_HELPERS: { Talk(WHISPER_HATCH_EGGS); - Creature* cr = NULL; + Creature* cr = nullptr; for (uint8 i = 0; i < 6; ++i) { if ((cr = me->SummonCreature(NPC_TWILIGHT_EGG, EggsPos[isSartharion ? i+6 : i].GetPositionX(), EggsPos[isSartharion ? i+6 : i].GetPositionY(), EggsPos[isSartharion ? i+6 : i].GetPositionZ(), EggsPos[isSartharion ? i+6 : i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000))) @@ -781,7 +781,7 @@ public: } case EVENT_MINIBOSS_HATCH_EGGS: { - Creature* cr = NULL; + Creature* cr = nullptr; summons.RemoveNotExisting(); summons.DespawnEntry(NPC_TWILIGHT_WHELP); for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index f3f6a96e5..bf7db0845 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -374,8 +374,8 @@ class boss_halion : public CreatureScript events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); break; case EVENT_ACTIVATE_FIREWALL: - instance->HandleGameObject(instance->GetData64(GO_FLAME_RING), false, NULL); - instance->HandleGameObject(instance->GetData64(GO_TWILIGHT_FLAME_RING), false, NULL); + instance->HandleGameObject(instance->GetData64(GO_FLAME_RING), false, nullptr); + instance->HandleGameObject(instance->GetData64(GO_TWILIGHT_FLAME_RING), false, nullptr); break; case EVENT_METEOR_STRIKE: _livingEmberCount = summons.GetEntryCount(NPC_LIVING_EMBER); @@ -988,7 +988,7 @@ class spell_halion_marks : public SpellScriptLoader if (!GetTarget()->GetInstanceScript() || !GetTarget()->GetInstanceScript()->IsEncounterInProgress() || GetTarget()->GetMapId() != 724) return; - GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, GetAura()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, GetAura()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); } void Register() diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index b3eeba8fe..26793fc28 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -813,7 +813,7 @@ class spell_reflective_shield : public SpellScriptLoader if( GetOwner() && attacker->GetGUID() != GetOwner()->GetGUID() ) { int32 damage = (int32)(absorbAmount*0.25f); - GetOwner()->ToUnit()->CastCustomSpell(attacker, 33619, &damage, NULL, NULL, true); + GetOwner()->ToUnit()->CastCustomSpell(attacker, 33619, &damage, nullptr, nullptr, true); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index c05591dec..18cbd880b 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -522,7 +522,7 @@ public: return; } - Start(false, true, 0, NULL); + Start(false, true, 0, nullptr); } void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) @@ -809,7 +809,7 @@ public: break; case EVENT_SHAMAN_SPELL_HEALING_WAVE: { - Unit* target = NULL; + Unit* target = nullptr; if( urand(0,1) ) { target = DoSelectLowestHpFriendly(40.0f); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 55a409aa6..8f935bde2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -376,7 +376,7 @@ public: pInstance->SetData(TYPE_ANUBARAK, DONE); - Player* plr = NULL; + Player* plr = nullptr; if( !pInstance->instance->GetPlayers().isEmpty() ) plr = pInstance->instance->GetPlayers().begin()->GetSource(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 87501c7e1..9d0966064 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -82,7 +82,7 @@ struct boss_faction_championsAI : public ScriptedAI const float dist_factor = (mAIType == AI_MELEE || mAIType == AI_PET ? 15.0f : 25.0f); float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 float mod_health = health > 40000 ? 2.0f : (60000-health)/10000.0f; // 2.0 .. 6.0 - float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; + float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? Unit::CalcArmorReducedDamage(me, target, 10000, nullptr)/10000.0f : 1.0f; return mod_dist * mod_health * mod_armor; } @@ -149,7 +149,7 @@ struct boss_faction_championsAI : public ScriptedAI { std::list lst = DoFindFriendlyMissingBuff(range, spell); if( lst.empty() ) - return NULL; + return nullptr; std::list::const_iterator iter = lst.begin(); uint32 lowestHP = (*iter)->GetMaxHealth() - (*iter)->GetHealth(); for( std::list::const_iterator itr = lst.begin(); itr != lst.end(); ++itr ) @@ -185,7 +185,7 @@ struct boss_faction_championsAI : public ScriptedAI if( target && target->getPowerType() == POWER_MANA && (!casting || target->HasUnitState(UNIT_STATE_CASTING)) && me->GetExactDist(target) <= range ) return target; } - return NULL; + return nullptr; } void UpdateAI(uint32 diff) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 1a245122a..0498084d2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -1007,7 +1007,7 @@ public: pInstance->SetData(TYPE_ICEHOWL, DONE); - Player* plr = NULL; + Player* plr = nullptr; if( !pInstance->instance->GetPlayers().isEmpty() ) plr = pInstance->instance->GetPlayers().begin()->GetSource(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 61f05b5aa..707db97e0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -358,7 +358,7 @@ public: c->DespawnOrUnsummon(10000); if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) c->DespawnOrUnsummon(10000); - if( AchievementTimer+10 >= time(NULL) ) + if( AchievementTimer+10 >= time(nullptr) ) DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV); AchievementTimer = 0; @@ -375,7 +375,7 @@ public: } else // first one died, start timer for achievement { - AchievementTimer = time(NULL); + AchievementTimer = time(nullptr); } } else @@ -464,14 +464,14 @@ public: HandleGameObject(GO_EnterGateGUID, true); - if( AchievementTimer+60 >= time(NULL) ) + if( AchievementTimer+60 >= time(nullptr) ) DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT); AchievementTimer = 0; SaveToDB(); } else if( Counter == 1 ) - AchievementTimer = time(NULL); + AchievementTimer = time(nullptr); } break; case TYPE_FACTION_CHAMPIONS_START: diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 7796c3f0d..d4ea288e2 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -174,17 +174,17 @@ class boss_novos : public CreatureScript { case EVENT_SUMMON_FETID_TROLL: if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_FETID_TROLL_CORPSE, true, NULL, NULL, me->GetGUID()); + trigger->CastSpell(trigger, SPELL_SUMMON_FETID_TROLL_CORPSE, true, nullptr, nullptr, me->GetGUID()); events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000); break; case EVENT_SUMMON_HULKING_CORPSE: if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_HULKING_CORPSE, true, NULL, NULL, me->GetGUID()); + trigger->CastSpell(trigger, SPELL_SUMMON_HULKING_CORPSE, true, nullptr, nullptr, me->GetGUID()); events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000); break; case EVENT_SUMMON_SHADOWCASTER: if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_RISEN_SHADOWCASTER, true, NULL, NULL, me->GetGUID()); + trigger->CastSpell(trigger, SPELL_SUMMON_RISEN_SHADOWCASTER, true, nullptr, nullptr, me->GetGUID()); events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 10000); break; case EVENT_SUMMON_CRYSTAL_HANDLER: @@ -193,7 +193,7 @@ class boss_novos : public CreatureScript Talk(SAY_SUMMONING_ADDS); Talk(EMOTE_SUMMONING_ADDS); if (Creature* target = ObjectAccessor::GetCreature(*me, _stage ? _summonTargetLeftGUID : _summonTargetRightGUID)) - target->CastSpell(target, SPELL_SUMMON_CRYSTAL_HANDLER, true, NULL, NULL, me->GetGUID()); + target->CastSpell(target, SPELL_SUMMON_CRYSTAL_HANDLER, true, nullptr, nullptr, me->GetGUID()); _stage = _stage ? 0 : 1; events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 6862fa889..f1ce3fa9e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -203,7 +203,7 @@ public: outroTimer = 0; outroStep = 0; - T1 = NULL; + T1 = nullptr; } bool IsEncounterInProgress() const diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index ddf7ae055..4474e2abc 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -1115,7 +1115,7 @@ public: me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); me->ResetPlayerDamageReq(); me->SetLastDamagedTime(0); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index b399bfb25..33b6b3d4b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -864,7 +864,7 @@ class boss_prince_valanar_icc : public CreatureScript { case NPC_KINETIC_BOMB_TARGET: summon->SetReactState(REACT_PASSIVE); - summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, NULL, NULL, me->GetGUID()); + summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, nullptr, nullptr, me->GetGUID()); break; case NPC_SHOCK_VORTEX: summon->m_Events.AddEvent(new ShockVortexExplodeEvent(*summon), summon->m_Events.CalculateTime(4500)); @@ -1259,7 +1259,7 @@ class npc_ball_of_flame : public CreatureScript { if (action != ACTION_FLAME_BALL_CHASE || me->IsInCombat()) return; - Player* target = NULL; + Player* target = nullptr; if (_chaseGUID) target = ObjectAccessor::GetPlayer(*me, _chaseGUID); if (!target) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 2e154ca54..fa6065853 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -319,7 +319,7 @@ class boss_blood_queen_lana_thel : public CreatureScript break; case EVENT_VAMPIRIC_BITE: { - Player* target = NULL; + Player* target = nullptr; float maxThreat = 0.0f; const Map::PlayerList &pl = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) @@ -396,7 +396,7 @@ class boss_blood_queen_lana_thel : public CreatureScript case EVENT_DELIRIOUS_SLASH: if (!me->HasReactState(REACT_PASSIVE)) { - Unit* target = NULL; + Unit* target = nullptr; if (_offtankGUID) if (Unit* t = ObjectAccessor::GetUnit(*me, _offtankGUID)) if (t->IsAlive() && t->GetDistance(me) < 10.0f) @@ -964,7 +964,7 @@ class spell_blood_queen_presence_of_the_darkfallen : public SpellScriptLoader return; if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)); + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 08ec76fe6..ea6e76022 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1231,7 +1231,7 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader bool Load() { // initialize variable - target = NULL; + target = nullptr; return true; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 553560bda..9307952f5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -206,7 +206,7 @@ class boss_festergut : public CreatureScript // just cast and dont bother with target, conditions will handle it ++_inhaleCounter; if (_inhaleCounter < 3) - me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID()); + me->CastSpell(me, gaseousBlight[_inhaleCounter], true, nullptr, nullptr, me->GetGUID()); } events.ScheduleEvent(EVENT_INHALE_BLIGHT, 34000); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 25d0c4376..3265397af 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -387,7 +387,7 @@ class PassengerController public: PassengerController() { - ResetSlots(TEAM_HORDE, NULL); + ResetSlots(TEAM_HORDE, nullptr); } void ResetSlots(TeamId teamId, MotionTransport* t) @@ -405,7 +405,7 @@ public: return false; bool summoned = false; - time_t now = time(NULL); + time_t now = time(nullptr); for (int32 i = first; i <= last; ++i) { if (_respawnCooldowns[i] > now) @@ -441,7 +441,7 @@ public: void ClearSlot(PassengerSlots slot) { _controlledSlots[slot] = 0; - _respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown; + _respawnCooldowns[slot] = time(nullptr) + _slotInfo[slot].Cooldown; } private: @@ -534,7 +534,7 @@ class npc_gunship : public CreatureScript if (damage >= me->GetHealth()) { - JustDied(NULL); + JustDied(nullptr); damage = me->GetHealth() - 1; return; } @@ -574,7 +574,7 @@ class npc_gunship : public CreatureScript a->SetDuration(0); uint32 explosionSpell = isVictory ? SPELL_EXPLOSION_VICTORY : SPELL_EXPLOSION_WIPE; - if (MotionTransport* t = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + if (MotionTransport* t = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : nullptr)) { Transport::PassengerSet const& passengers = t->GetStaticPassengers(); for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) @@ -711,7 +711,7 @@ class npc_gunship : public CreatureScript CreatureAI* GetAI(Creature* creature) const { if (!creature->GetTransport()) - return NULL; + return nullptr; return GetIcecrownCitadelAI(creature); } @@ -730,7 +730,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript _controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport()); me->SetRegeneratingHealth(false); me->m_CombatDistance = 70.0f; - _firstMageCooldown = time(NULL) + 45; + _firstMageCooldown = time(nullptr) + 45; _axethrowersYellCooldown = time_t(0); _rocketeersYellCooldown = time_t(0); checkTimer = 1000; @@ -795,7 +795,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript } else if (action == ACTION_SPAWN_MAGE) { - time_t now = time(NULL); + time_t now = time(nullptr); if (_firstMageCooldown > now) _events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS); else @@ -943,7 +943,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript _controller.SummonCreatures(me, SLOT_MAGE_1, SLOT_MAGE_2); _controller.SummonCreatures(me, SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2); _controller.SummonCreatures(me, SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1); - if (MotionTransport* orgrimsHammer = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + if (MotionTransport* orgrimsHammer = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : nullptr)) { float x,y,z,o; OrgrimsHammerTeleportPortal.GetPosition(x,y,z,o); @@ -970,10 +970,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript case EVENT_CHECK_RIFLEMAN: if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4)) { - if (_axethrowersYellCooldown < time(NULL)) + if (_axethrowersYellCooldown < time(nullptr)) { Talk(SAY_SAURFANG_AXETHROWERS); - _axethrowersYellCooldown = time(NULL) + 5; + _axethrowersYellCooldown = time(nullptr) + 5; } } _events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500); @@ -981,10 +981,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript case EVENT_CHECK_MORTAR: if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2)) { - if (_rocketeersYellCooldown < time(NULL)) + if (_rocketeersYellCooldown < time(nullptr)) { Talk(SAY_SAURFANG_ROCKETEERS); - _rocketeersYellCooldown = time(NULL) + 5; + _rocketeersYellCooldown = time(nullptr) + 5; } } _events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500); @@ -1065,7 +1065,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript _controller.ResetSlots(TEAM_ALLIANCE, creature->GetTransport()->ToMotionTransport()); me->SetRegeneratingHealth(false); me->m_CombatDistance = 70.0f; - _firstMageCooldown = time(NULL) + 45; + _firstMageCooldown = time(nullptr) + 45; _riflemanYellCooldown = time_t(0); _mortarYellCooldown = time_t(0); checkTimer = 1000; @@ -1131,7 +1131,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript } else if (action == ACTION_SPAWN_MAGE) { - time_t now = time(NULL); + time_t now = time(nullptr); if (_firstMageCooldown > now) _events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS); else @@ -1282,7 +1282,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript _controller.SummonCreatures(me, SLOT_MAGE_1, SLOT_MAGE_2); _controller.SummonCreatures(me, SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2); _controller.SummonCreatures(me, SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1); - if (MotionTransport* skybreaker = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + if (MotionTransport* skybreaker = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : nullptr)) { float x,y,z,o; SkybreakerTeleportPortal.GetPosition(x,y,z,o); @@ -1309,10 +1309,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript case EVENT_CHECK_RIFLEMAN: if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4)) { - if (_riflemanYellCooldown < time(NULL)) + if (_riflemanYellCooldown < time(nullptr)) { Talk(SAY_MURADIN_RIFLEMAN); - _riflemanYellCooldown = time(NULL) + 5; + _riflemanYellCooldown = time(nullptr) + 5; } } _events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500); @@ -1320,10 +1320,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript case EVENT_CHECK_MORTAR: if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2)) { - if (_mortarYellCooldown < time(NULL)) + if (_mortarYellCooldown < time(nullptr)) { Talk(SAY_MURADIN_MORTAR); - _mortarYellCooldown = time(NULL) + 5; + _mortarYellCooldown = time(nullptr) + 5; } } _events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500); @@ -1452,7 +1452,7 @@ void TriggerBurningPitch(Creature* c) struct gunship_npc_AI : public ScriptedAI { - gunship_npc_AI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), Slot(NULL), Index(uint32(-1)) + gunship_npc_AI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), Slot(nullptr), Index(uint32(-1)) { me->SetRegeneratingHealth(false); } @@ -1514,7 +1514,7 @@ protected: struct npc_gunship_boarding_addAI : public ScriptedAI { - npc_gunship_boarding_addAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), Slot(NULL), Index(uint32(-1)) + npc_gunship_boarding_addAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), Slot(nullptr), Index(uint32(-1)) { anyValid = true; checkTimer = 1000; @@ -2077,7 +2077,7 @@ class spell_igb_check_for_players : public SpellScriptLoader void TriggerWipe() { if (!_playerCount) - GetCaster()->ToCreature()->AI()->JustDied(NULL); + GetCaster()->ToCreature()->AI()->JustDied(nullptr); } void TeleportPlayer(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index edeac5bdf..0e3b3b488 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -417,7 +417,7 @@ class boss_professor_putricide : public CreatureScript instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); me->SetFacingTo(festergutWatchPos.GetOrientation()); DoAction(ACTION_FESTERGUT_GAS); - c->CastSpell(c, SPELL_GASEOUS_BLIGHT_LARGE, true, NULL, NULL, c->GetGUID()); + c->CastSpell(c, SPELL_GASEOUS_BLIGHT_LARGE, true, nullptr, nullptr, c->GetGUID()); } else { @@ -982,7 +982,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader uint8 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE); creature->AI()->SetData(DATA_EXPERIMENT_STAGE, stage ? 0 : 1); - Creature* target = NULL; + Creature* target = nullptr; std::list creList; GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); for (std::list::iterator itr = creList.begin(); itr != creList.end(); ++itr) @@ -996,7 +996,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader if (aura->GetOwner() == target) // avoid assert(false) at any cost aura->UpdateOwner(5000, target); // update whole aura so previous periodic ticks before refreshed by new one - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, nullptr, nullptr, GetCaster()->GetGUID()); } void Register() @@ -1094,7 +1094,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader // this will let use safely use ToCreature() casts in entire script bool Load() { - _target = NULL; + _target = nullptr; return GetCaster()->GetTypeId() == TYPEID_UNIT; } @@ -1218,7 +1218,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, GetTarget()); int32 healAmount = spell->Effects[EFFECT_0].CalcValue(); healAmount *= GetStackAmount(); - GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, healAmount, GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, healAmount, GetTarget(), TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); } void Register() @@ -1361,7 +1361,7 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader continue; uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); - GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(GetCaster(), spellId, true, nullptr, nullptr, GetCaster()->GetGUID()); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 016e19811..636d55a20 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -494,7 +494,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader bool Load() { - _target = NULL; + _target = nullptr; return true; } @@ -656,7 +656,7 @@ class spell_rotface_large_ooze_combine : public SpellScriptLoader if (Creature* cre = GetCaster()->ToCreature()) cre->AI()->DoAction(EVENT_STICKY_OOZE); - GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID()); if (InstanceScript* instance = GetCaster()->GetInstanceScript()) instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); } @@ -719,7 +719,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader if (Creature* cre = GetCaster()->ToCreature()) cre->AI()->DoAction(EVENT_STICKY_OOZE); - GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID()); if (InstanceScript* instance = GetCaster()->GetInstanceScript()) instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); } @@ -803,7 +803,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetCaster()->GetInstanceScript()) if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) - rotface->CastSpell(x, y, z, triggered_spell_id, true/*, NULL, NULL, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case + rotface->CastSpell(x, y, z, triggered_spell_id, true/*, nullptr, nullptr, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 935482be4..86018f9bb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -178,7 +178,7 @@ class FrostBombExplosion : public BasicEvent bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { - _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID); + _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, nullptr, nullptr, _sindragosaGUID); _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); return true; } @@ -440,7 +440,7 @@ class boss_sindragosa : public CreatureScript events.ScheduleEvent(EVENT_AIR_MOVEMENT, 0); break; case POINT_AIR_PHASE: - me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 6), NULL); + me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 6), nullptr); me->SetFacingTo(float(M_PI)); events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 0); // won't be processed during cast time anyway, so 0 events.ScheduleEvent(EVENT_FROST_BOMB, 7000); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 8fdae9633..aec579db7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -686,9 +686,9 @@ class boss_the_lich_king : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(NULL)) + if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(nullptr)) { - _lastTalkTimeKill = time(NULL); + _lastTalkTimeKill = time(nullptr); Talk(SAY_LK_KILL); } } @@ -717,7 +717,7 @@ class boss_the_lich_king : public CreatureScript events.RescheduleEvent(EVENT_START_ATTACK, 1000); EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); summons.DoAction(ACTION_TELEPORT_BACK, pred); - if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(NULL)) + if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(nullptr)) Talk(SAY_LK_FROSTMOURNE_ESCAPE); } break; @@ -874,9 +874,9 @@ class boss_the_lich_king : public CreatureScript void SpellHit(Unit* /*caster*/, SpellInfo const* spell) { - if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(NULL)) + if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(nullptr)) { - _lastTalkTimeBuff = time(NULL); + _lastTalkTimeBuff = time(nullptr); Talk(SAY_LK_FROSTMOURNE_KILL); } } @@ -1648,7 +1648,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader bool Load() { - return GetCaster()->GetInstanceScript() != NULL; + return GetCaster()->GetInstanceScript() != nullptr; } void FilterTargets(std::list& targets) @@ -1914,7 +1914,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader CustomSpellValues values; if (dispel) values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); @@ -2021,7 +2021,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader CustomSpellValues values; values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); } @@ -2040,7 +2040,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader CustomSpellValues values; values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); if (Unit* caster = GetCaster()) caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); @@ -2365,7 +2365,7 @@ class npc_raging_spirit : public CreatureScript if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) AttackStart(plr); } - DoZoneInCombat(NULL, 150.0f); + DoZoneInCombat(nullptr, 150.0f); } break; case EVENT_SOUL_SHRIEK: @@ -2594,7 +2594,7 @@ class npc_valkyr_shadowguard : public CreatureScript } dropped = true; _events.Reset(); - /*Player* p = NULL; + /*Player* p = nullptr; if (Vehicle* v = me->GetVehicleKit()) if (Unit* passenger = v->GetPassenger(0)) p = passenger->ToPlayer();*/ @@ -2652,7 +2652,7 @@ class npc_valkyr_shadowguard : public CreatureScript break; case EVENT_MOVE_TO_SIPHON_POS: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // just in case if passenger disappears so quickly that EVENT_MOVE_TO_DROP_POS is never executed - { int32 bp0 = 80; me->CastCustomSpell(me, 1557, &bp0, NULL, NULL, true); } + { int32 bp0 = 80; me->CastCustomSpell(me, 1557, &bp0, nullptr, nullptr, true); } me->SetDisableGravity(true); me->SetHover(true); me->SetCanFly(true); @@ -2661,7 +2661,7 @@ class npc_valkyr_shadowguard : public CreatureScript break; case EVENT_LIFE_SIPHON: { - Unit* target = NULL; + Unit* target = nullptr; Unit::AuraEffectList const& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); if (!tauntAuras.empty()) for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) @@ -2771,7 +2771,7 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader bool Load() { - _target = NULL; + _target = nullptr; return true; } @@ -2967,7 +2967,7 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa bool Load() { - _target = NULL; + _target = nullptr; return GetCaster()->GetTypeId() == TYPEID_UNIT; } @@ -3057,14 +3057,14 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader bool Load() { - return GetOwner()->GetInstanceScript() != NULL; + return GetOwner()->GetInstanceScript() != nullptr; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { // m_originalCaster to allow stacking from different casters, meh if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); } void Register() @@ -3142,17 +3142,17 @@ class npc_strangulate_vehicle : public CreatureScript if (summoner->GetTypeId() == TYPEID_PLAYER && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) { if (buff) - summoner->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + summoner->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, nullptr, nullptr, _instance->GetData64(DATA_THE_LICH_KING)); me->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK, false); } else if (buff) - me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, nullptr, nullptr, _instance->GetData64(DATA_THE_LICH_KING)); summoner->RemoveAurasDueToSpell(IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); } else - me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, nullptr, nullptr, _instance->GetData64(DATA_THE_LICH_KING)); } _events.Reset(); @@ -3400,7 +3400,7 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader bool Load() { _instance = GetCaster()->GetInstanceScript(); - return _instance != NULL; + return _instance != nullptr; } void FilterTargets(std::list& unitList) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 27ef52d6f..1426e223f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -165,7 +165,7 @@ class DelayedCastEvent : public BasicEvent bool Execute(uint64 /*time*/, uint32 /*diff*/) { - _trigger->CastSpell(_trigger, _spellId, false, NULL, NULL, _originalCaster); + _trigger->CastSpell(_trigger, _spellId, false, nullptr, nullptr, _originalCaster); if (_despawnTime) _trigger->DespawnOrUnsummon(_despawnTime); return true; @@ -861,7 +861,7 @@ class npc_valithria_cloud : public CreatureScript me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); // must use originalCaster the same for all clouds to allow stacking - me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + me->CastSpell(me, EMERALD_VIGOR, false, nullptr, nullptr, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); me->DespawnOrUnsummon(1000); break; default: @@ -1169,7 +1169,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader return; if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); } void Register() @@ -1196,7 +1196,7 @@ class spell_dreamwalker_nightmare_cloud : public SpellScriptLoader bool Load() { _instance = GetOwner()->GetInstanceScript(); - return _instance != NULL; + return _instance != nullptr; } void PeriodicTick(AuraEffect const* /*aurEff*/) @@ -1326,7 +1326,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); } void Register() @@ -1410,7 +1410,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, nullptr, nullptr, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1288a6824..39454b256 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -874,7 +874,7 @@ class npc_crok_scourgebane : public CreatureScript { _wipeCheckTimer = 3000; - Player* player = NULL; + Player* player = nullptr; acore::AnyPlayerInObjectRangeCheck check(me, 140.0f); acore::PlayerSearcher searcher(me, player, check); me->VisitNearbyWorldObject(140.0f, searcher); @@ -1105,7 +1105,7 @@ class boss_sister_svalna : public CreatureScript me->SetDisableGravity(false); me->SetHover(false); me->SetReactState(REACT_AGGRESSIVE); - DoZoneInCombat(NULL, 150.0f); + DoZoneInCombat(nullptr, 150.0f); } void SpellHitTarget(Unit* target, SpellInfo const* spell) @@ -1353,7 +1353,7 @@ class npc_captain_arnath : public CreatureScript private: Creature* FindFriendlyCreature() const { - Creature* target = NULL; + Creature* target = nullptr; acore::MostHPMissingInRange u_check(me, 60.0f, 0); acore::CreatureLastSearcher searcher(me, target, u_check); me->VisitNearbyGridObject(60.0f, searcher); @@ -1882,7 +1882,7 @@ class npc_arthas_teleport_visual : public CreatureScript return GetIcecrownCitadelAI(creature); // Default to no script - return NULL; + return nullptr; } }; @@ -2003,7 +2003,7 @@ class spell_icc_geist_alarm : public SpellScriptLoader if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p)) { bool hasTarget = false; - Unit* target = NULL; + Unit* target = nullptr; if ((target = l->SelectNearestTarget(20.0f))) hasTarget = true; else @@ -2999,7 +2999,7 @@ public: if (uint32 e = events.GetEvent()) { - Unit* target = NULL; + Unit* target = nullptr; if (sesi_spells[e-1].targetType == 1) target = me->GetVictim(); else diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 11c389611..2813e01ba 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -615,7 +615,7 @@ CreatureAI* GetIcecrownCitadelAI(Creature* creature) if (instance->GetInstanceScript()) if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName)) return new AI(creature); - return NULL; + return nullptr; } #endif // ICECROWN_CITADEL_H_ diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index b65222588..be9ae629b 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -196,7 +196,7 @@ public: me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); me->ResetPlayerDamageReq(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp index 54445d30a..2acbba7c4 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp @@ -254,7 +254,7 @@ public: if (!pInstance) return; - GameObject *go = NULL; + GameObject *go = nullptr; if (headMask & 0x1) // Kaddrak if ((go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_KADDRAK)))) activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); @@ -545,7 +545,7 @@ public: SpeechPause += diff; if (SpeechPause >= Conversation[SpeechCount].timer) { - Creature* cs = NULL; + Creature* cs = nullptr; switch (Conversation[SpeechCount].creature) { case NPC_BRANN: cs = me; break; @@ -602,7 +602,7 @@ public: void brann_bronzebeard::brann_bronzebeardAI::InitializeEvent() { - Creature* cr = NULL; + Creature* cr = nullptr; if ((cr = me->SummonCreature(NPC_KADDRAK, 923.7f, 326.9f, 219.5f, 2.1f, TEMPSUMMON_TIMED_DESPAWN, 580000))) { cr->SetInCombatWithZone(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index a6658b045..c7a796990 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -497,7 +497,7 @@ public: m_pInstance->SetData(TYPE_FREYA, IN_PROGRESS); // HARD MODE CHECKS - Creature* elder = NULL; + Creature* elder = nullptr; elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_STONEBARK)); if (elder && elder->IsAlive()) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 29f92b8ff..43e662beb 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -270,7 +270,7 @@ public: inside.push_back(tmp); } - Player* t = NULL; + Player* t = nullptr; if( outside.size() >= uint8(me->GetMap()->Is25ManRaid() ? 9 : 4) ) t = outside.at(urand(0, outside.size()-1)); else if( !inside.empty() ) @@ -598,7 +598,7 @@ public: if (Unit* caster = GetCaster()) { int32 damage = 100*pow(2.0f, (float)GetStackAmount()); - caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, NULL, NULL, true); + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, nullptr, nullptr, true); } } @@ -630,7 +630,7 @@ public: { int32 mana = GetHitDamage()/2; if (Unit* t = GetHitUnit()) - caster->CastCustomSpell(t, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); + caster->CastCustomSpell(t, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, nullptr, nullptr, true); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 73995370f..f04912be4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -449,7 +449,7 @@ public: Creature* GetHelper(uint8 index) { - return (Helpers[index] ? ObjectAccessor::GetCreature(*me, Helpers[index]) : NULL); + return (Helpers[index] ? ObjectAccessor::GetCreature(*me, Helpers[index]) : nullptr); } void SpawnHelpers() diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index 739236580..31db10b2c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -387,7 +387,7 @@ public: std::vector playerGUIDs; Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - Player* temp = NULL; + Player* temp = nullptr; for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index bbe490892..3af3a4700 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -432,7 +432,7 @@ public: case EVENT_FOCUSED_EYEBEAM: { events.ScheduleEvent(EVENT_FOCUSED_EYEBEAM, 13000+rand()%5000); - Unit* target = NULL; + Unit* target = nullptr; Map::PlayerList const& pList = me->GetMap()->GetPlayers(); for(auto itr = pList.begin(); itr != pList.end(); ++itr) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 0ecc79e4e..d6d092a06 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -453,7 +453,7 @@ public: case EVENT_SPAWN_FLAMES_INITIAL: { if (changeAllowedFlameSpreadTime) - allowedFlameSpreadTime = time(NULL); + allowedFlameSpreadTime = time(nullptr); std::vector pg; Map::PlayerList const &pl = me->GetMap()->GetPlayers(); @@ -489,9 +489,9 @@ public: break; case EVENT_BERSERK_2: { - Creature* VX001 = NULL; - Creature* LMK2 = NULL; - Creature* ACU = NULL; + Creature* VX001 = nullptr; + Creature* LMK2 = nullptr; + Creature* ACU = nullptr; if ((VX001 = GetVX001())) VX001->CastSpell(VX001, SPELL_BERSERK, true); if ((LMK2 = GetLMK2())) @@ -1158,7 +1158,7 @@ public: break; case EVENT_SPELL_NAPALM_SHELL: { - Player* pTarget = NULL; + Player* pTarget = nullptr; std::vector pList; Map::PlayerList const &pl = me->GetMap()->GetPlayers(); for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) @@ -1793,7 +1793,7 @@ public: float y = victim->GetPositionY() + 15.0f*sin(angle); // check if there's magnetic core in line of movement - Creature* mc = NULL; + Creature* mc = nullptr; std::list cl; me->GetCreaturesWithEntryInRange(cl, me->GetExactDist2d(victim), NPC_MAGNETIC_CORE); for( std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr ) @@ -2316,7 +2316,7 @@ public: { npc_ulduar_flames_initialAI(Creature *pCreature) : NullCreatureAI(pCreature) { - CreateTime = time(NULL); + CreateTime = time(nullptr); events.Reset(); events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750); if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) ) @@ -2397,7 +2397,7 @@ public: if( last ) { float prevdist = 100.0f; - Player* target = NULL; + Player* target = nullptr; Map::PlayerList const &pl = me->GetMap()->GetPlayers(); for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index a41e85eab..107f44b79 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -841,7 +841,7 @@ public: if (!fixingGUID) { - Creature* razorscale = NULL; + Creature* razorscale = nullptr; if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) razorscale = ObjectAccessor::GetCreature(*me, rsGUID); @@ -890,7 +890,7 @@ public: if( !pInstance ) return true; - Creature* rs = NULL; + Creature* rs = nullptr; if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) rs = ObjectAccessor::GetCreature(*go, rsGUID); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 05191d33d..a8278032d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -357,7 +357,7 @@ public: { if (m_pInstance) return ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(entry)); - return NULL; + return nullptr; } void JustSummoned(Creature* cr) { summons.Summon(cr); } @@ -571,7 +571,7 @@ public: events.SetPhase(EVENT_PHASE_OUTRO); events.ScheduleEvent(EVENT_THORIM_OUTRO1, 2000, 0, EVENT_PHASE_OUTRO); - GameObject* go = NULL; + GameObject* go = nullptr; if ((go = GetThorimObject(DATA_THORIM_FENCE))) go->SetGoState(GO_STATE_ACTIVE); @@ -656,7 +656,7 @@ public: if (Player *p = itr->GetSource()) if (p->GetPositionX() > 2085 && p->GetPositionX() < 2185 && p->GetPositionY() < -214 && p->GetPositionY() > -305 && p->IsAlive() && p->GetPositionZ() < 425) return p; - return NULL; + return nullptr; } void UpdateAI(uint32 diff) @@ -1009,7 +1009,7 @@ public: _checkTimer += diff; if ((_checkTimer >= 1000 && _checkTimer < 10000) || _checkTimer >= 60000) { - if (me->SelectNearbyTarget(NULL, 12.0f)) + if (me->SelectNearbyTarget(nullptr, 12.0f)) { me->CastSpell(me, SPELL_LIGHTNING_FIELD, true); me->CastSpell(me, (me->GetEntry() == 33054 /*NPC_THORIM_TRAP_BUNNY*/ ? SPELL_PARALYTIC_FIELD_FIRST : SPELL_PARALYTIC_FIELD_SECOND), true); @@ -1654,7 +1654,7 @@ public: bool SelectT() { - Player* target = NULL; + Player* target = nullptr; Map::PlayerList const& pList = me->GetMap()->GetPlayers(); uint8 num = urand(0, pList.getSize()-1); uint8 count = 0; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 1c8d7483f..2f6b94011 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -172,7 +172,7 @@ public: void AttachHeart() { - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : nullptr) heart->SetHealth(heart->GetMaxHealth()); else if (Creature* accessory = me->SummonCreature(NPC_XT002_HEART, *me, TEMPSUMMON_MANUAL_DESPAWN)) { @@ -364,7 +364,7 @@ public: case EVENT_START_SECOND_PHASE: me->MonsterTextEmote("XT-002 Deconstructor's heart is exposed and leaking energy.", 0, true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : nullptr) heart->GetAI()->DoAction(ACTION_AWAKEN_HEART); events.ScheduleEvent(EVENT_RESTORE, 30000); @@ -383,7 +383,7 @@ public: me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge // Hide heart - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : nullptr) heart->GetAI()->DoAction(ACTION_HIDE_HEART); events.ScheduleEvent(EVENT_REMOVE_EMOTE, 4000); @@ -481,7 +481,7 @@ public: void SendEnergyToCorner() { - Unit* pile = NULL; + Unit* pile = nullptr; uint8 num = urand(1,4); for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index 848c030ed..c919915bb 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -477,7 +477,7 @@ public: void InformCloud() { - Creature* cloud = NULL; + Creature* cloud = nullptr; for (SummonList::const_iterator itr = summons.begin(); itr != summons.end();) { Creature* summon = ObjectAccessor::GetCreature(*me, *itr); @@ -520,7 +520,7 @@ public: void AddPortals() { _summonSpeed -= 0.1f; - Creature* cr = NULL; + Creature* cr = nullptr; // Spawn Portals for (uint8 i = 0; i < RAID_MODE(4, 10); ++i) @@ -935,7 +935,7 @@ public: _checkTimer += diff; if (_checkTimer >= 500 && !_isSummoning) { - Unit* who = me->SelectNearbyTarget(NULL, 6.0f); + Unit* who = me->SelectNearbyTarget(nullptr, 6.0f); if (who && who->GetTypeId() == TYPEID_PLAYER && !me->HasAura(SPELL_SUMMON_GUARDIAN_OF_YS) && !who->HasAura(SPELL_HODIR_FLASH_FREEZE)) { _isSummoning = true; @@ -1533,7 +1533,7 @@ public: Unit* SelectCorruptionTarget() { - Player* target = NULL; + Player* target = nullptr; Map::PlayerList const& pList = me->GetMap()->GetPlayers(); uint8 num = urand(0, pList.getSize()-1); uint8 count = 0; @@ -1589,7 +1589,7 @@ public: Unit* SelectConstrictTarget() { - Player *target = NULL; + Player *target = nullptr; Map::PlayerList const& pList = me->GetMap()->GetPlayers(); uint8 num = urand(0, pList.getSize()-1); uint8 count = 0; @@ -2288,7 +2288,7 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { PreventDefaultAction(); - Player* target = NULL; + Player* target = nullptr; Map::PlayerList const& pList = GetUnitOwner()->GetMap()->GetPlayers(); uint8 _offset = urand(0, pList.getSize()-1); uint8 _counter = 0; @@ -2395,7 +2395,7 @@ class spell_yogg_saron_destabilization_matrix : public SpellScriptLoader void FilterTargets(std::list& targets) { - WorldObject* target = NULL; + WorldObject* target = nullptr; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if (!(*itr)->ToUnit()->HasAura(SPELL_DESTABILIZATION_MATRIX_ATTACK)) { @@ -2439,7 +2439,7 @@ class spell_yogg_saron_titanic_storm : public SpellScriptLoader void FilterTargets(std::list& targets) { - WorldObject* target = NULL; + WorldObject* target = nullptr; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if ((*itr)->ToUnit()->HasAura(SPELL_WEAKENED)) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index e23aef7eb..e391f90c7 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -624,7 +624,7 @@ public: { instance->LoadGrid(364.0f, -16.0f); //make sure leviathan is loaded m_leviathanTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED] = data; - GameObject* gobj = NULL; + GameObject* gobj = nullptr; if ((gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][0]))) gobj->SetGoState(GO_STATE_ACTIVE); if ((gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][1]))) @@ -896,10 +896,10 @@ public: } else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/) { - if (time(NULL) > (m_conspeedatoryAttempt + DAY)) + if (time(nullptr) > (m_conspeedatoryAttempt + DAY)) { DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/); - m_conspeedatoryAttempt = time(NULL); + m_conspeedatoryAttempt = time(nullptr); SaveToDB(); } } @@ -1127,7 +1127,7 @@ void instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounter if (mode < VEHICLE_POS_NONE) { - TempSummon* veh = NULL; + TempSummon* veh = nullptr; for (uint8 i = 0; i < (instance->Is25ManRaid() ? 5 : 2); ++i) { if ((veh = instance->SummonCreature(NPC_SALVAGED_SIEGE_ENGINE, vehiclePositions[15*mode+i]))) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 09f244b85..e814668f5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -190,7 +190,7 @@ public: if (victim->GetEntry() == NPC_SCOURGE_HULK && instance) { instance->SetData(DATA_SVALA_ACHIEVEMENT, true); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 26555, 1, NULL); + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 26555, 1, nullptr); } if (victim->GetTypeId() == TYPEID_PLAYER) diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index d6dbc63a2..7cb7b4738 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -179,13 +179,13 @@ class instance_vault_of_archavon : public InstanceMapScript switch (type) { case EVENT_ARCHAVON: - ArchavonDeath = time(NULL); + ArchavonDeath = time(nullptr); break; case EVENT_EMALON: - EmalonDeath = time(NULL); + EmalonDeath = time(nullptr); break; case EVENT_KORALON: - KoralonDeath = time(NULL); + KoralonDeath = time(nullptr); break; default: return; diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 985d535ae..16c61b915 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -336,7 +336,7 @@ public: void StartBossEncounter(uint8 uiBoss) { - Creature* pBoss = NULL; + Creature* pBoss = nullptr; switch(uiBoss) { diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 4448dba5e..a309d4acc 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -581,7 +581,7 @@ public: { EnterEvadeMode(); //We make sure that the npc is not attacking the player! me->SetReactState(REACT_PASSIVE); - StartFollow(pCaster->ToPlayer(), 0, NULL); + StartFollow(pCaster->ToPlayer(), 0, nullptr); me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER, NULL, false); DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true); me->DespawnOrUnsummon(45000); diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index dfb5802fc..8f17bcfb8 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -545,7 +545,7 @@ class npc_minigob_manabonk : public CreatureScript PlayerInDalaranList.push_back(player); if (PlayerInDalaranList.empty()) - return NULL; + return nullptr; return acore::Containers::SelectRandomContainerElement(PlayerInDalaranList); } diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 6c31e48a3..1288be360 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -366,7 +366,7 @@ public: if (phase) randomWhisper(); - Creature* cr = NULL; + Creature* cr = nullptr; float x, y, z; if (phase < 3) { diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 244d4fd38..5ec167d64 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -101,7 +101,7 @@ public: void setphase(short phase) { - Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummoner() : NULL; + Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummoner() : nullptr; if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER) return; diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 44ae26cc8..ee3298749 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -271,7 +271,7 @@ public: me->MonsterTextEmote("Thane Banahogg appears upon the overlook to the southeast!", NULL, true); break; case QUEST_BFV_FINAL: - me->MonsterYell("Warriors of Jotunheim, I present to you, Blood Prince Sandoval!", LANG_UNIVERSAL, NULL); + me->MonsterYell("Warriors of Jotunheim, I present to you, Blood Prince Sandoval!", LANG_UNIVERSAL, nullptr); me->MonsterTextEmote("Without warning, Prince Sandoval magically appears within Valhalas!", NULL, true); break; } @@ -374,7 +374,7 @@ public: if (attackTimer >= 1500) { if (!me->IsInCombat()) - if (Unit* target = me->SelectNearbyTarget(NULL, 20.0f)) + if (Unit* target = me->SelectNearbyTarget(nullptr, 20.0f)) AttackStart(target); attackTimer = 0; } @@ -1266,7 +1266,7 @@ class npc_infra_green_bomber_generic : public CreatureScript { if (TempSummon* tempSummon = me->ToTempSummon()) return tempSummon->GetSummoner(); - return NULL; + return nullptr; } void IsSummonedBy(Unit* summoner) diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 7401f17a6..d4bc6c5da 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -447,7 +447,7 @@ public: Player* charmer = ObjectAccessor::GetPlayer(*me, playerGUID); if (charmer && charmer->IsAlive() && me->GetDistance(charmer) < 20.0f) return charmer; - return NULL; + return nullptr; } void UpdateAI(uint32 diff) diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index 56a836f53..5ce74db2e 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -294,7 +294,7 @@ class npc_wg_queue : public CreatureScript else { uint32 timer = wintergrasp->GetTimer() / 1000; - player->SendUpdateWorldState(4354, time(NULL) + timer); + player->SendUpdateWorldState(4354, time(nullptr) + timer); if (timer < 15 * MINUTE) { AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Queue for Wintergrasp.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -769,7 +769,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript if (Creature* teleportTrigger = passenger->SummonTrigger(go->GetPositionX()-60.0f, go->GetPositionY(), go->GetPositionZ()+1.0f, cVeh->GetOrientation(), 1000)) return teleportTrigger; - return NULL; + return nullptr; } void UpdateAI(uint32 diff) @@ -822,7 +822,7 @@ class spell_wintergrasp_force_building : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->CastSpell(target, GetEffectValue(), false, NULL, NULL, target->GetGUID()); + target->CastSpell(target, GetEffectValue(), false, nullptr, nullptr, target->GetGUID()); } void Register() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 48988b326..c6bee17da 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -141,7 +141,7 @@ void OPvPCapturePointEP_EWT::SummonSupportUnitAtNorthpassTower(TeamId teamId) if (m_UnitsSummonedSideId != teamId) { m_UnitsSummonedSideId = teamId; - const creature_type * ct = NULL; + const creature_type * ct = nullptr; if (teamId == TEAM_ALLIANCE) ct=EP_EWT_Summons_A; else diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 845c1f1c4..3775b60d4 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -17,7 +17,7 @@ OutdoorPvPNA::OutdoorPvPNA() { m_TypeId = OUTDOOR_PVP_NA; - m_obj = NULL; + m_obj = nullptr; } void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) @@ -69,7 +69,7 @@ TeamId OPvPCapturePointNA::GetControllingFaction() const void OPvPCapturePointNA::SpawnNPCsForTeam(TeamId teamId) { - const creature_type * creatures = NULL; + const creature_type * creatures = nullptr; if (teamId == TEAM_ALLIANCE) creatures=AllianceControlNPCs; else if (teamId == TEAM_HORDE) @@ -88,7 +88,7 @@ void OPvPCapturePointNA::DeSpawnNPCs() void OPvPCapturePointNA::SpawnGOsForTeam(TeamId teamId) { - const go_type * gos = NULL; + const go_type * gos = nullptr; if (teamId == TEAM_ALLIANCE) gos=AllianceControlGOs; else if (teamId == TEAM_HORDE) @@ -398,7 +398,7 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player* player, uint64 guid) int32 retval = OPvPCapturePoint::HandleOpenGo(player, guid); if (retval >= 0) { - const go_type * gos = NULL; + const go_type * gos = nullptr; if (m_ControllingFaction == TEAM_ALLIANCE) gos=AllianceControlGOs; else if (m_ControllingFaction == TEAM_HORDE) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 2b5e339b1..d72d87907 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -97,7 +97,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) if (player->getLevel() < 70) player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); // add 19 honor - player->RewardHonor(NULL, 1, 19); + player->RewardHonor(nullptr, 1, 19); // add 20 cenarion circle repu player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20); // complete quest @@ -123,7 +123,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) if (player->getLevel() < 70) player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); // add 19 honor - player->RewardHonor(NULL, 1, 19); + player->RewardHonor(nullptr, 1, 19); // add 20 cenarion circle repu player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20); // complete quest diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 76ce924ff..be6e1036d 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -163,7 +163,7 @@ void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, uint32 zone) OutdoorPvPZM::OutdoorPvPZM() { m_TypeId = OUTDOOR_PVP_ZM; - m_GraveYard = NULL; + m_GraveYard = nullptr; m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 4a71734c2..657431cc8 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -445,7 +445,7 @@ class boss_illidan_stormrage : public CreatureScript events2.ScheduleEvent(EVENT_OUTRO_3, 17000); break; case EVENT_OUTRO_3: - Unit::Kill(NULL, me); + Unit::Kill(nullptr, me); break; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 7cb43137c..0631a0b97 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -112,7 +112,7 @@ class boss_supremus : public CreatureScript Unit* FindHatefulStrikeTarget() { - Unit* target = NULL; + Unit* target = nullptr; ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) { diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 064630476..0ff126549 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -263,7 +263,7 @@ class spell_teron_gorefiend_spiritual_vengeance : public SpellScriptLoader void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit::Kill(NULL, GetTarget()); + Unit::Kill(nullptr, GetTarget()); } void Register() diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index fc8842403..c225f670d 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -141,7 +141,7 @@ public: void Reset() { BossAI::Reset(); - Creature* member = NULL; + Creature* member = nullptr; for (uint8 i = 0; i < 4; ++i) if ((member = ObjectAccessor::GetCreature(*me, councilGUIDs[i]))) member->AI()->EnterEvadeMode(); @@ -177,7 +177,7 @@ public: } else if (param == ACTION_ENRAGE) { - Creature* member = NULL; + Creature* member = nullptr; for (uint8 i = 0; i < 4; ++i) if ((member = ObjectAccessor::GetCreature(*me, councilGUIDs[i]))) member->AI()->DoAction(ACTION_ENRAGE); @@ -185,7 +185,7 @@ public: else if (param == ACTION_END_ENCOUNTER) { me->setActive(false); - Creature* member = NULL; + Creature* member = nullptr; for (uint8 i = 0; i < 4; ++i) if ((member = ObjectAccessor::GetCreature(*me, councilGUIDs[i]))) if (member->IsAlive()) @@ -657,7 +657,7 @@ class spell_illidari_council_reflective_shield : public SpellScriptLoader return; int32 bp = absorbAmount / 2; - target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, NULL, NULL, true, NULL, aurEff); + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, nullptr, nullptr, true, NULL, aurEff); } void Register() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index bd39fa9da..9b6aae37d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -476,7 +476,7 @@ class spell_lady_vashj_spore_drop_effect : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_TOXIC_SPORES, true, NULL, NULL, GetCaster()->GetGUID()); + target->CastSpell(target, SPELL_TOXIC_SPORES, true, nullptr, nullptr, GetCaster()->GetGUID()); } void Register() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 5a05d38a3..f7a4e716c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -169,7 +169,7 @@ class boss_the_lurker_below : public CreatureScript if (me->getStandState() != UNIT_STAND_STATE_STAND || !me->isAttackReady() || me->GetReactState() != REACT_AGGRESSIVE) return; - Unit* target = NULL; + Unit* target = nullptr; if (me->IsWithinMeleeRange(me->GetVictim())) target = me->GetVictim(); else diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index d05eda789..c32192265 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -313,7 +313,7 @@ class spell_serpentshrine_cavern_infection : public SpellScriptLoader values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()+500); values.AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount()+500); - GetTarget()->CastCustomSpell(SPELL_RAMPART_INFECTION, values, GetTarget(), TRIGGERED_FULL_MASK, NULL); + GetTarget()->CastCustomSpell(SPELL_RAMPART_INFECTION, values, GetTarget(), TRIGGERED_FULL_MASK, nullptr); } } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp index 7d4638777..19340d6d9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp @@ -215,7 +215,7 @@ public: if (target->GetPositionZ() < me->GetPositionZ()+6.0f) { int32 dmg = urand(5500,6000); - me->CastCustomSpell(target, SPELL_COLD_SLAP, &dmg, NULL, NULL, false); + me->CastCustomSpell(target, SPELL_COLD_SLAP, &dmg, nullptr, nullptr, false); float x, y, z; target->GetNearPoint(target, x, y, z, target->GetObjectSize(), 30.0f, target->GetAngle(me->GetPositionX(), me->GetPositionY()) + M_PI); target->GetMotionMaster()->MoveJump(x, y, z+20.0f, 10.0f, 20.0f); diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 14f7395cb..5cc693539 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -168,7 +168,7 @@ class boss_kelidan_the_breaker : public CreatureScript if (channeler && channeler->isDead()) { channeler->DespawnOrUnsummon(1); - channeler = NULL; + channeler = nullptr; } if (!channeler) channeler = me->SummonCreature(NPC_CHANNELER, ShadowmoonChannelers[i][0], ShadowmoonChannelers[i][1], ShadowmoonChannelers[i][2], ShadowmoonChannelers[i][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); @@ -293,7 +293,7 @@ class npc_shadowmoon_channeler : public CreatureScript { if (me->GetInstanceScript()) return ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_KELIDAN)); - return NULL; + return nullptr; } void EnterCombat(Unit* /*who*/) diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index a604ec44f..eb2816ea1 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -74,7 +74,7 @@ public: bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) - target->CastSpell(target, SPELL_DEBRIS_DAMAGE, true, NULL, NULL, _owner.GetGUID()); + target->CastSpell(target, SPELL_DEBRIS_DAMAGE, true, nullptr, nullptr, _owner.GetGUID()); return true; } @@ -236,7 +236,7 @@ class boss_magtheridon : public CreatureScript case EVENT_DEBRIS: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) { - target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, NULL, NULL, me->GetGUID()); + target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, nullptr, nullptr, me->GetGUID()); me->m_Events.AddEvent(new DealDebrisDamage(*me, target->GetGUID()), me->m_Events.CalculateTime(5000)); } events.ScheduleEvent(EVENT_DEBRIS, 20000); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index d7eafac9f..edf3f01cc 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -106,7 +106,7 @@ class boss_warbringer_omrogg : public CreatureScript void KilledUnit(Unit* /*victim*/) { - Creature* head = NULL; + Creature* head = nullptr; uint32 eventId = EVENT_KILL_YELL_LEFT; if (urand(0, 1)) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 373e6338b..413557582 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -726,7 +726,7 @@ class spell_kaelthas_kael_phase_two : public SpellScriptLoader if (GetCaster()->GetTypeId() == TYPEID_UNIT) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* kael = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_KAELTHAS))) - kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), NULL); + kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), nullptr); return true; } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 5a4d85abe..a3353ea6a 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -201,7 +201,7 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, GetCaster()->GetGUID()); + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, nullptr, nullptr, GetCaster()->GetGUID()); } void Register() diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 23b2d22e3..e2f84b19e 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -81,7 +81,7 @@ class instance_mechanar : public InstanceMapScript if (Player* player = itr->GetSource()) if (player->GetPositionX() < x && player->GetPositionZ() > 24.0f && player->GetPositionY() > -30.0f) return player; - return NULL; + return nullptr; } void DoSummonAction(Creature* summon, Player* player) diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index b60794cc5..206524559 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -168,7 +168,7 @@ class npc_millhouse_manastorm : public CreatureScript break; case EVENT_SEARCH_FIGHT: if (!me->IsInCombat() && !me->IsInEvadeMode()) - if (Unit* target = me->SelectNearbyTarget(NULL, 30.0f)) + if (Unit* target = me->SelectNearbyTarget(nullptr, 30.0f)) AttackStart(target); events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); break; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp index b6b3e445f..bfda3068b 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp @@ -150,7 +150,7 @@ class spell_botanica_shift_form : public SpellScriptLoader { if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo()) { - if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(NULL)) + if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(nullptr)) return false; uint32 form = 0; @@ -166,7 +166,7 @@ class spell_botanica_shift_form : public SpellScriptLoader if (form) { - _swapTime = time(NULL) + 6; + _swapTime = time(nullptr) + 6; _lastSchool = spellInfo->GetSchoolMask(); GetUnitOwner()->RemoveAurasDueToSpell(_lastForm); _lastForm = form; diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index a2eed8602..8949c8204 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -963,7 +963,7 @@ class npc_simon_bunny : public CreatureScript if (spell->Id == SPELL_BAD_PRESS_TRIGGER) { int32 bp = (int32)((float)(fails)*0.33f*target->GetMaxHealth()); - target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, NULL, NULL, true); + target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true); } } diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index d8844cc94..3090600d8 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -179,7 +179,7 @@ public: void Reset() { - ryga = NULL; + ryga = nullptr; me->CastSpell(me, SPELL_ANCESTRAL_WOLF_BUFF, false); me->SetReactState(REACT_PASSIVE); } diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 1e8e63b3a..2210aa433 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -1168,7 +1168,7 @@ class npc_captain_saeed : public CreatureScript if (fight) SetEscortPaused(false); - SummonsAction(NULL); + SummonsAction(nullptr); npc_escortAI::EnterEvadeMode(); } @@ -1178,7 +1178,7 @@ class npc_captain_saeed : public CreatureScript for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr, i += 1.0f) if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) { - if (who == NULL) + if (who == nullptr) { cr->GetMotionMaster()->Clear(false); cr->GetMotionMaster()->MoveFollow(me, 2.0f, M_PI/2.0f + (i / summons.size() * M_PI)); @@ -1249,7 +1249,7 @@ class npc_captain_saeed : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_START_WALK: - SummonsAction(NULL); + SummonsAction(nullptr); SetEscortPaused(false); break; case EVENT_START_FIGHT1: diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 951b07059..07dcb9882 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -740,7 +740,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+1) { ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, NULL); + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, nullptr); if (msg == EQUIP_ERR_OK) { player->StoreNewItem(dest, 30658, true); @@ -750,7 +750,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+2) { ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, NULL); + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, nullptr); if (msg == EQUIP_ERR_OK) { player->StoreNewItem(dest, 30659, true); @@ -1494,7 +1494,7 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() for (uint8 i = 0; i < count; ++i) { - Creature* Spawn = NULL; + Creature* Spawn = nullptr; float X = SpawnLocation[locIndex + i].x; float Y = SpawnLocation[locIndex + i].y; float Z = SpawnLocation[locIndex + i].z; @@ -1676,8 +1676,8 @@ public: } // Spawn Soul on Kill ALWAYS! - Creature* Summoned = NULL; - Unit* totemOspirits = NULL; + Creature* Summoned = nullptr; + Unit* totemOspirits = nullptr; if (entry != 0) Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index 88e13e8ac..40f651453 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -381,7 +381,7 @@ public: { if (Group* group = player->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupie = itr->GetSource(); if (groupie && groupie->IsInMap(player) && diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index 52e95a66c..6df09e4a4 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -351,13 +351,13 @@ public: { ItemPosCountVec dest; uint32 itemId = 24573; - InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, nullptr); if (msg == EQUIP_ERR_OK) { player->StoreNewItem(dest, itemId, true); } else - player->SendEquipError(msg, NULL, NULL, itemId); + player->SendEquipError(msg, nullptr, nullptr, itemId); } SendGossipMenuFor(player, 9231, creature->GetGUID()); break; diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index df4b06eab..90ea8e22f 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -54,7 +54,7 @@ class npc_pet_hunter_snake_trap : public CreatureScript me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); + me->SetLootRecipient(nullptr); me->ResetPlayerDamageReq(); me->SetLastDamagedTime(0); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 3544477bc..39dd64d2e 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -364,7 +364,7 @@ class spell_dk_death_and_decay : public SpellScriptLoader if (GetCaster() && GetTarget()) { int32 basePoints0 = aurEff->GetAmount(); - GetCaster()->CastCustomSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_TRIGGER, &basePoints0, NULL, NULL, true, 0, aurEff); + GetCaster()->CastCustomSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_TRIGGER, &basePoints0, nullptr, nullptr, true, 0, aurEff); } } @@ -713,7 +713,7 @@ class spell_dk_blood_caked_blade : public SpellScriptLoader { if (soulFragments->GetStackAmount() >= 10) { - eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr); soulFragments->Remove(); } } @@ -780,7 +780,7 @@ class spell_dk_dancing_rune_weapon : public SpellScriptLoader Unit* player = eventInfo.GetActor(); Unit* target = eventInfo.GetActionTarget(); - Unit* dancingRuneWeapon = NULL; + Unit* dancingRuneWeapon = nullptr; for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue) { @@ -1267,7 +1267,7 @@ class spell_dk_blood_gorged : public SpellScriptLoader bool Load() { - _procTarget = NULL; + _procTarget = nullptr; return true; } @@ -1345,14 +1345,14 @@ class spell_dk_corpse_explosion : public SpellScriptLoader bool Load() { - _target = NULL; + _target = nullptr; return true; } void CheckTarget(WorldObject*& target) { if (CorpseExplosionCheck(GetCaster()->GetGUID(), true)(target)) - target = NULL; + target = nullptr; _target = target; } @@ -1381,7 +1381,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader if (effIndex == EFFECT_0) GetCaster()->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue(), SPELLVALUE_BASE_POINT0, GetEffectValue(), target, true); else if (effIndex == EFFECT_1) - GetCaster()->CastCustomSpell(GetEffectValue(), SPELLVALUE_BASE_POINT0, GetSpell()->CalculateSpellDamage(EFFECT_0, NULL), target, true); + GetCaster()->CastCustomSpell(GetEffectValue(), SPELLVALUE_BASE_POINT0, GetSpell()->CalculateSpellDamage(EFFECT_0, nullptr), target, true); } void HandleCorpseExplosion(SpellEffIndex effIndex) @@ -1453,13 +1453,13 @@ class spell_dk_death_coil : public SpellScriptLoader if (caster->IsFriendlyTo(target)) { int32 bp = int32(damage * 1.5f); - caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, NULL, NULL, true); + caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, nullptr, nullptr, true); } else { if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART, EFFECT_1)) damage += auraEffect->GetBaseAmount(); - caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true); + caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, nullptr, nullptr, true); } } } @@ -1693,7 +1693,7 @@ class spell_dk_death_pact : public SpellScriptLoader void FilterTargets(std::list& targetList) { - Unit* target = NULL; + Unit* target = nullptr; for (std::list::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) { if (Unit* unit = (*itr)->ToUnit()) @@ -1753,7 +1753,7 @@ class spell_dk_death_strike : public SpellScriptLoader // Improved Death Strike if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, DK_ICON_ID_IMPROVED_DEATH_STRIKE, 0)) AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); - caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); + caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, nullptr, nullptr, false); } } @@ -2265,7 +2265,7 @@ class spell_dk_raise_dead : public SpellScriptLoader { // Don't add caster to target map, if we found a corpse to raise dead if (_corpse) - target = NULL; + target = nullptr; } void ConsumeReagents() @@ -2292,7 +2292,7 @@ class spell_dk_raise_dead : public SpellScriptLoader SpellCastTargets targets; targets.SetDst(*GetHitUnit()); - GetCaster()->CastSpell(targets, spellInfo, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(targets, spellInfo, NULL, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCaster()->GetGUID()); GetCaster()->ToPlayer()->RemoveSpellCooldown(GetSpellInfo()->Id, true); } @@ -2429,7 +2429,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader if (Unit *unitTarget = ObjectAccessor::GetUnit(*caster, guid)) { int32 bp = GetHitDamage() * multiplier; - caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); + caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, nullptr, nullptr, true); // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...) if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) @@ -2441,7 +2441,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader { if (soulFragments->GetStackAmount() >= 10) { - caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); + caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr); soulFragments->Remove(); } } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 7a081c3a6..12eebfee7 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -615,9 +615,9 @@ class spell_dru_lifebloom : public SpellScriptLoader healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack); // restore mana int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2; - caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, nullptr, nullptr, true, NULL, aurEff, GetCasterGUID()); } - GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, NULL, aurEff, GetCasterGUID()); } void HandleDispel(DispelInfo* dispelInfo) @@ -637,9 +637,9 @@ class spell_dru_lifebloom : public SpellScriptLoader // mana amount int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; - caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID()); } - target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID()); } } } @@ -1141,7 +1141,7 @@ class spell_dru_survival_instincts : public SpellScriptLoader { Unit* target = GetTarget(); int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount()); - target->CastCustomSpell(target, SPELL_DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true); + target->CastCustomSpell(target, SPELL_DRUID_SURVIVAL_INSTINCTS, &bp0, nullptr, nullptr, true); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 1866ad837..634423779 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -880,7 +880,7 @@ class spell_gen_proc_once_per_cast : public SpellScriptLoader bool Load() { - _spellPointer = NULL; + _spellPointer = nullptr; return true; } @@ -1360,7 +1360,7 @@ class spell_gen_flurry_of_claws : public SpellScriptLoader void OnPeriodic(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->SelectNearbyTarget(NULL, 7.0f)) + if (Unit* target = GetUnitOwner()->SelectNearbyTarget(nullptr, 7.0f)) if (target->GetEntry() == NPC_FRENZYHEART_RAVAGER || target->GetEntry() == NPC_FRENZYHEART_HUNTER) { int32 basePoints = irand(1400, 2200); @@ -1718,7 +1718,7 @@ class spell_gen_cannibalize : public SpellScriptLoader { Unit* caster = GetCaster(); float max_range = GetSpellInfo()->GetMaxRange(false); - WorldObject* result = NULL; + WorldObject* result = nullptr; // search for nearby enemy corpse in range acore::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_CORPSE); acore::WorldObjectSearcher searcher(caster, result, check); @@ -2193,7 +2193,7 @@ class spell_gen_elune_candle : public SpellScriptLoader else spellId = SPELL_ELUNE_CANDLE_NORMAL; - GetCaster()->CastSpell(GetHitUnit(), spellId, true, NULL); + GetCaster()->CastSpell(GetHitUnit(), spellId, true, nullptr); } void Register() @@ -3101,7 +3101,7 @@ class spell_gen_dummy_trigger : public SpellScriptLoader if (Unit* target = GetHitUnit()) if (SpellInfo const* triggeredByAuraSpell = GetTriggeringSpell()) if (triggeredByAuraSpell->Id == SPELL_PERSISTANT_SHIELD_TRIGGERED) - caster->CastCustomSpell(target, SPELL_PERSISTANT_SHIELD_TRIGGERED, &damage, NULL, NULL, true); + caster->CastCustomSpell(target, SPELL_PERSISTANT_SHIELD_TRIGGERED, &damage, nullptr, nullptr, true); } void Register() @@ -4387,7 +4387,7 @@ class spell_gen_summon_elemental : public SpellScriptLoader if (GetCaster()) if (Unit* owner = GetCaster()->GetOwner()) if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + owner->ToPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true); } void Register() @@ -4944,7 +4944,7 @@ class spell_gen_eject_all_passengers : public SpellScriptLoader void RemoveVehicleAuras() { - Unit* u = NULL; + Unit* u = nullptr; if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit()) { u = vehicle->GetPassenger(0); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 5b051f2bc..d9a521e0e 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -674,7 +674,7 @@ class spell_hun_last_stand_pet : public SpellScriptLoader { Unit* caster = GetCaster(); int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); - caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, nullptr, nullptr, true, nullptr); } void Register() @@ -971,7 +971,7 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader { Unit* caster = GetCaster(); float max_range = GetSpellInfo()->GetMaxRange(false); - WorldObject* result = NULL; + WorldObject* result = nullptr; // search for nearby enemy corpse in range acore::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); acore::WorldObjectSearcher searcher(caster, result, check); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 4b594c2b1..83f5896c6 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -406,7 +406,7 @@ class spell_item_sleepy_willy : public SpellScriptLoader void SelectTarget(std::list& targets) { - Creature* target = NULL; + Creature* target = nullptr; for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) if (Creature* creature = (*itr)->ToCreature()) if (creature->IsCritter()) @@ -919,9 +919,9 @@ class spell_item_gnomish_shrink_ray : public SpellScriptLoader if (Unit* target = GetHitUnit()) { if (urand(0, 99) < 15) - caster->CastSpell(caster, SPELL_GNOMISH_SHRINK_RAY_SELF, true, NULL); + caster->CastSpell(caster, SPELL_GNOMISH_SHRINK_RAY_SELF, true, nullptr); else - caster->CastSpell(target, SPELL_GNOMISH_SHRINK_RAY_TARGET, true, NULL); + caster->CastSpell(target, SPELL_GNOMISH_SHRINK_RAY_TARGET, true, nullptr); } } @@ -1038,7 +1038,7 @@ class spell_item_fetch_ball : public SpellScriptLoader void SelectTarget(std::list& targets) { - Creature* target = NULL; + Creature* target = nullptr; for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) if (Creature* creature = (*itr)->ToCreature()) { @@ -1880,7 +1880,7 @@ class spell_item_deviate_fish : public SpellScriptLoader { Unit* caster = GetCaster(); uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT); - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() @@ -2023,7 +2023,7 @@ class spell_item_flask_of_the_north : public SpellScriptLoader break; } - caster->CastSpell(caster, possibleSpells[irand(0, (possibleSpells.size() - 1))], true, NULL); + caster->CastSpell(caster, possibleSpells[irand(0, (possibleSpells.size() - 1))], true, nullptr); } void Register() @@ -2068,9 +2068,9 @@ class spell_item_gnomish_death_ray : public SpellScriptLoader if (Unit* target = GetHitUnit()) { if (urand(0, 99) < 15) - caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure + caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, nullptr); // failure else - caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL); + caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, nullptr); } } @@ -2129,7 +2129,7 @@ class spell_item_make_a_wish : public SpellScriptLoader case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break; case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break; } - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() @@ -2283,7 +2283,7 @@ class spell_item_net_o_matic : public SpellScriptLoader else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) spellId = SPELL_NET_O_MATIC_TRIGGERED2; - GetCaster()->CastSpell(target, spellId, true, NULL); + GetCaster()->CastSpell(target, spellId, true, nullptr); } } @@ -2339,7 +2339,7 @@ class spell_item_noggenfogger_elixir : public SpellScriptLoader case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; } - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() @@ -2426,7 +2426,7 @@ class spell_item_savory_deviate_delight : public SpellScriptLoader // Yaaarrrr - pirate case 2: spellId = (caster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break; } - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() @@ -3210,7 +3210,7 @@ class spell_item_purify_helboar_meat : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { Unit* caster = GetCaster(); - caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, NULL); + caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, nullptr); } void Register() @@ -3251,7 +3251,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader if (Creature* target = GetHitCreature()) if (target->isDead() && !target->IsPet()) { - GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime()-time(NULL))); + GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime()-time(nullptr))); target->DespawnOrUnsummon(); } } @@ -3564,7 +3564,7 @@ class spell_item_complete_raptor_capture : public SpellScriptLoader GetHitCreature()->DespawnOrUnsummon(); //cast spell Raptor Capture Credit - caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, NULL); + caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, nullptr); } } @@ -3820,7 +3820,7 @@ class spell_item_rocket_boots : public SpellScriptLoader bg->EventPlayerDroppedFlag(caster); caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC); - caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); + caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, nullptr); } SpellCastResult CheckCast() diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index a8f53556d..db03a310e 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -97,7 +97,7 @@ class spell_mage_deep_freeze : public SpellScriptLoader void HandleOnHit() { if (Unit* caster = GetCaster()) - if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : NULL)) + if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : nullptr)) if (Creature* cTarget = target->ToCreature()) if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1))) caster->CastSpell(cTarget, 71757, true); @@ -525,7 +525,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript currentAura->GetBase()->RefreshDuration(); } else - target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, nullptr, nullptr, true, NULL, aurEff); } } }; @@ -657,7 +657,7 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader if (roll_chance_i(chance)) { int32 bp = dmgInfo.GetDamage(); - target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, nullptr, nullptr, true, NULL, aurEff); absorbAmount = 0; // Xinef: trigger Incanters Absorbtion @@ -706,7 +706,7 @@ class spell_mage_focus_magic : public SpellScriptLoader bool Load() { - _procTarget = NULL; + _procTarget = nullptr; return true; } @@ -794,7 +794,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) { - int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); + int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, nullptr); newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); if (aurEff->GetAmount() > newAmount) diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 985ebed7b..33c340416 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -249,7 +249,7 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0)) AddPct(basepoints, aurEffect->GetAmount()); - caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, NULL, NULL, true, 0, aurEff, caster->GetGUID()); + caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, nullptr, nullptr, true, 0, aurEff, caster->GetGUID()); return; } @@ -269,7 +269,7 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader cooldown = aurEffect->GetAmount()*IN_MILLISECONDS; eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown); - eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, NULL, NULL, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID()); + eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, nullptr, nullptr, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID()); } void Register() @@ -672,7 +672,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader return; int32 heal = GetEffectValue() / _targetCount; - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, &heal, NULL, NULL, true); + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, &heal, nullptr, nullptr, true); } private: uint32 _targetCount; @@ -1084,7 +1084,7 @@ class spell_pal_judgement_of_command : public SpellScriptLoader { if (Unit* unitTarget = GetHitUnit()) if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue())) - GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL); + GetCaster()->CastSpell(unitTarget, spell_proto, true, nullptr); } void Register() diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index f5424881a..a0988c439 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -341,7 +341,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader int32 healAmount = int32(target->CountPctFromMaxHealth(healPct)); // remove the aura now, we don't want 40% healing bonus Remove(AURA_REMOVE_BY_ENEMY_SPELL); - target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true); + target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, nullptr, nullptr, true); absorbAmount = dmgInfo.GetDamage(); } @@ -518,7 +518,7 @@ class spell_pri_mana_leech : public SpellScriptLoader bool Load() { - _procTarget = NULL; + _procTarget = nullptr; return true; } @@ -767,7 +767,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); // xinef: prevents infinite loop! if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->Id != SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED) - target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, nullptr, nullptr, true, NULL, aurEff); } } @@ -796,7 +796,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) { - int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); + int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, nullptr); newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); if (aurEff->GetAmount() > newAmount) @@ -879,7 +879,7 @@ class spell_pri_renew : public SpellScriptLoader heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT); int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100; - caster->CastCustomSpell(GetTarget(), SPELL_PRIEST_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff); + caster->CastCustomSpell(GetTarget(), SPELL_PRIEST_EMPOWERED_RENEW, &basepoints0, nullptr, nullptr, true, NULL, aurEff); } } } @@ -953,9 +953,9 @@ class spell_pri_vampiric_touch : public SpellScriptLoader if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { int32 damage = aurEff->GetBaseAmount(); - damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, NULL) * 8; + damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, nullptr) * 8; // backfire damage - caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, nullptr, nullptr, true, NULL, aurEff); } } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index dcc1276fc..b1e748a3c 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1140,7 +1140,7 @@ class spell_q5206_test_fetid_skull : public SpellScriptLoader { Unit* caster = GetCaster(); uint32 spellId = roll_chance_i(50) ? SPELL_CREATE_RESONATING_SKULL : SPELL_CREATE_BONE_DUST; - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() @@ -1570,7 +1570,7 @@ class spell_q12634_despawn_fruit_tosser : public SpellScriptLoader // sometimes, if you're lucky, you get a dwarf if (roll_chance_i(5)) spellId = SPELL_SUMMON_ADVENTUROUS_DWARF; - GetCaster()->CastSpell(GetCaster(), spellId, true, NULL); + GetCaster()->CastSpell(GetCaster(), spellId, true, nullptr); } void Register() @@ -1604,7 +1604,7 @@ class spell_q12683_take_sputum_sample : public SpellScriptLoader if (caster->HasAuraEffect(reqAuraId, 0)) { uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } } @@ -1716,7 +1716,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScriptLoader Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL); + caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, nullptr); caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0); target->DespawnOrUnsummon(); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 153c646fb..704e7a8b1 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -730,7 +730,7 @@ class spell_rog_tricks_of_the_trade : public SpellScriptLoader bool Load() { - _redirectTarget = NULL; + _redirectTarget = nullptr; return true; } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 3fa2855f2..5950f9bf5 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -437,7 +437,7 @@ class spell_sha_ancestral_awakening_proc : public SpellScriptLoader { int32 damage = GetEffectValue(); if (GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true); + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC, &damage, nullptr, nullptr, true); } void Register() @@ -612,7 +612,7 @@ class spell_sha_cleansing_totem_pulse : public SpellScriptLoader { int32 bp = 1; if (GetCaster() && GetHitUnit() && GetOriginalCaster()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, nullptr, nullptr, GetOriginalCaster()->GetGUID()); } void Register() @@ -1270,7 +1270,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader effValue += dummy->GetAmount(); // Regenerate 6% of Total Mana Every 3 secs int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue)); - caster->CastCustomSpell(unitTarget, SPELL_SHAMAN_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + caster->CastCustomSpell(unitTarget, SPELL_SHAMAN_MANA_TIDE_TOTEM, &effBasePoints0, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID()); } } } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 8ab556d7c..c47d213d0 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -626,7 +626,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER); int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0))); - targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true); + targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, nullptr, nullptr, true); //unitTarget->CastSpell(unitTarget, 54441, true); break; } @@ -681,7 +681,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader { uint8 spellRank = GetSpellInfo()->GetRank(); ItemPosCountVec dest; - InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL); + InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, nullptr); if (msg != EQUIP_ERR_OK) return SPELL_FAILED_TOO_MANY_OF_ITEM; } @@ -954,7 +954,7 @@ class spell_warl_life_tap : public SpellScriptLoader if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0)) AddPct(mana, aurEff->GetAmount()); - caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false); + caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, nullptr, nullptr, false); // Mana Feed int32 manaFeedVal = 0; @@ -964,7 +964,7 @@ class spell_warl_life_tap : public SpellScriptLoader if (manaFeedVal > 0) { ApplyPct(manaFeedVal, mana); - caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL); + caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, nullptr, nullptr, true, nullptr); } } } @@ -1158,7 +1158,7 @@ class spell_warl_haunt : public SpellScriptLoader if (Unit* caster = GetCaster()) { int32 amount = aurEff->GetAmount(); - GetTarget()->CastCustomSpell(caster, SPELL_WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + GetTarget()->CastCustomSpell(caster, SPELL_WARLOCK_HAUNT_HEAL, &amount, nullptr, nullptr, true, NULL, aurEff, GetCasterGUID()); } } @@ -1202,9 +1202,9 @@ class spell_warl_unstable_affliction : public SpellScriptLoader if (AuraEffect const* aurEff = GetEffect(EFFECT_0)) { int32 damage = aurEff->GetBaseAmount(); - damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, NULL) * 9; + damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, nullptr) * 9; // backfire damage and silence - caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, nullptr, nullptr, true, NULL, aurEff); } } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 0f11329f5..af3d1ee80 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -140,7 +140,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader CustomSpellValues values; values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount()); values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f - eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL); + eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, nullptr); } void Register() @@ -243,7 +243,7 @@ class spell_warr_last_stand : public SpellScriptLoader { Unit* caster = GetCaster(); int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(GetEffectValue())); - caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, nullptr, nullptr, true, nullptr); } void Register() @@ -287,7 +287,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader ApplyPct(damage, 16.0f * GetSpellInfo()->GetRank() / 6.0f); target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0); - //caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); + //caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, nullptr, nullptr, true); } } @@ -324,7 +324,7 @@ class spell_warr_charge : public SpellScriptLoader { int32 chargeBasePoints0 = GetEffectValue(); Unit* caster = GetCaster(); - caster->CastCustomSpell(caster, SPELL_WARRIOR_CHARGE, &chargeBasePoints0, NULL, NULL, true); + caster->CastCustomSpell(caster, SPELL_WARRIOR_CHARGE, &chargeBasePoints0, nullptr, nullptr, true); // Juggernaut crit bonus if (caster->HasAura(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT)) @@ -456,7 +456,7 @@ class spell_warr_execute : public SpellScriptLoader int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); - caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID()); } } @@ -525,7 +525,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_BLOODTHIRST, &damage, NULL, NULL, true, NULL); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_BLOODTHIRST, &damage, nullptr, nullptr, true, nullptr); } void Register() @@ -731,7 +731,7 @@ class spell_warr_sweeping_strikes : public SpellScriptLoader bool Load() { - _procTarget = NULL; + _procTarget = nullptr; return true; } @@ -789,7 +789,7 @@ class spell_warr_vigilance : public SpellScriptLoader bool Load() { - _procTarget = NULL; + _procTarget = nullptr; return true; } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 865cf1b07..0029b6587 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -108,7 +108,7 @@ class go_witherbark_totem_bundle : public GameObjectScript _timer += diff; if (_timer > 5000) { - go->CastSpell(NULL, 9056); + go->CastSpell(nullptr, 9056); go->DestroyForNearbyPlayers(); _timer = 0; } @@ -931,7 +931,7 @@ class go_inconspicuous_landmark : public GameObjectScript public: go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark") { - _lastUsedTime = time(NULL); + _lastUsedTime = time(nullptr); } bool OnGossipHello(Player* player, GameObject* /*go*/) override @@ -939,10 +939,10 @@ class go_inconspicuous_landmark : public GameObjectScript if (player->HasItemCount(ITEM_CUERGOS_KEY)) return true; - if (_lastUsedTime > time(NULL)) + if (_lastUsedTime > time(nullptr)) return true; - _lastUsedTime = time(NULL) + MINUTE; + _lastUsedTime = time(nullptr) + MINUTE; player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true); return true; } diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 3498d205d..ba1809f3d 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -64,7 +64,7 @@ public: return false; // error - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); return true; } }; @@ -107,7 +107,7 @@ public: targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578)) return false; - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); return true; } }; @@ -127,7 +127,7 @@ public: return false; else { - player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL); + player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, nullptr); return true; } } @@ -196,7 +196,7 @@ public: if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS) { - player->SendEquipError(EQUIP_ERR_NONE, item, NULL); + player->SendEquipError(EQUIP_ERR_NONE, item, nullptr); if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB)) Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE); @@ -226,10 +226,10 @@ public: if (player->FindNearestCreature(NPC_VANIRAS_SENTRY_TOTEM, 10.0f)) return false; else - player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL); + player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, nullptr); } else - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); return true; } }; diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index c9538c887..afd1ad822 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -84,7 +84,7 @@ public: if (me->isAttackReady() && !me->IsNonMeleeSpellCast(false)) { bool Healing = false; - SpellInfo const* info = NULL; + SpellInfo const* info = nullptr; //Select a healing spell if less than 30% hp if (HealthBelowPct(30)) @@ -115,7 +115,7 @@ public: if (!me->IsNonMeleeSpellCast(false)) { bool Healing = false; - SpellInfo const* info = NULL; + SpellInfo const* info = nullptr; //Select a healing spell if less than 30% hp ONLY 33% of the time if (HealthBelowPct(30) && rand() % 3 == 0) @@ -166,7 +166,7 @@ public: { trigger_periodicAI(Creature* creature) : NullCreatureAI(creature) { - spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : NULL; + spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : nullptr; interval = me->GetAttackTime(BASE_ATTACK); timer = interval; } diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index c64142788..eb0c9a629 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -268,7 +268,7 @@ bool EquippedOk(Player* player, uint32 spellId) if (!reqSpell) continue; - Item* item = NULL; + Item* item = nullptr; for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j) { item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j); @@ -416,7 +416,7 @@ void ProcessUnlearnAction(Player* player, Creature* creature, uint32 spellId, ui player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, 0, 0); } else - player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, NULL, NULL); + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, NULL, nullptr); CloseGossipMenuFor(player); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 77b1d4360..f7e88a61f 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -108,7 +108,7 @@ public: { case EVENT_CLEARWATER_ANNOUNCE: { - time_t curtime = time(NULL); + time_t curtime = time(nullptr); tm strdate; ACE_OS::localtime_r(&curtime, &strdate); @@ -253,7 +253,7 @@ public: { case EVENT_RIGGLE_ANNOUNCE: { - time_t curtime = time(NULL); + time_t curtime = time(nullptr); tm strdate; ACE_OS::localtime_r(&curtime, &strdate); if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0) @@ -495,7 +495,7 @@ public: { npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature) { - SpawnAssoc = NULL; + SpawnAssoc = nullptr; SpawnedGUID = 0; // find the correct spawnhandling @@ -519,7 +519,7 @@ public: if (!spawnedTemplate) { sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); - SpawnAssoc = NULL; + SpawnAssoc = nullptr; return; } } @@ -539,7 +539,7 @@ public: else { sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); - SpawnAssoc = NULL; + SpawnAssoc = nullptr; } return summoned; @@ -552,7 +552,7 @@ public: if (creature && creature->IsAlive()) return creature; - return NULL; + return nullptr; } void MoveInLineOfSight(Unit* who) @@ -1093,7 +1093,7 @@ public: void Reset() { DoctorGUID = 0; - Coord = NULL; + Coord = nullptr; //no select me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -2164,7 +2164,7 @@ public: GameObject* FindNearestLauncher() { - GameObject* launcher = NULL; + GameObject* launcher = nullptr; if (isCluster()) { diff --git a/src/server/shared/Network/RealmSocket.cpp b/src/server/shared/Network/RealmSocket.cpp index fb01165fe..3b9f48af1 100644 --- a/src/server/shared/Network/RealmSocket.cpp +++ b/src/server/shared/Network/RealmSocket.cpp @@ -16,7 +16,7 @@ RealmSocket::Session::Session(void) { } RealmSocket::Session::~Session(void) { } RealmSocket::RealmSocket(void) : - input_buffer_(4096), session_(NULL), + input_buffer_(4096), session_(nullptr), _remoteAddress(), _remotePort(0) { reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); @@ -261,7 +261,7 @@ int RealmSocket::handle_input(ACE_HANDLE) input_buffer_.wr_ptr((size_t)n); - if (session_ != NULL) + if (session_ != nullptr) { session_->OnRead(); input_buffer_.crunch(); diff --git a/src/server/shared/Realms/RealmList.cpp b/src/server/shared/Realms/RealmList.cpp index 890423cfa..85eb14a47 100644 --- a/src/server/shared/Realms/RealmList.cpp +++ b/src/server/shared/Realms/RealmList.cpp @@ -48,10 +48,10 @@ void RealmList::UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr co 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/server/worldserver/ACSoap/ACSoap.cpp b/src/server/worldserver/ACSoap/ACSoap.cpp index 6d2f4389c..16577e619 100644 --- a/src/server/worldserver/ACSoap/ACSoap.cpp +++ b/src/server/worldserver/ACSoap/ACSoap.cpp @@ -151,10 +151,10 @@ void SOAPCommand::commandFinished(void* soapconnection, bool success) //////////////////////////////////////////////////////////////////////////////// struct Namespace namespaces[] = -{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", NULL, NULL }, // must be first - { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL }, // must be second +{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", nullptr, nullptr }, // must be first + { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", nullptr, nullptr }, // must be second { "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL }, { "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL }, - { "ns1", "urn:AC", NULL, NULL }, // "ns1" namespace prefix - { NULL, NULL, NULL, NULL } + { "ns1", "urn:AC", nullptr, nullptr }, // "ns1" namespace prefix + { nullptr, nullptr, nullptr, nullptr } }; diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index c7d51959e..a356e558b 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -59,7 +59,7 @@ char* command_finder(const char* text, int state) char** cli_completion(const char* text, int start, int /*end*/) { - char** matches = NULL; + char** matches = nullptr; if (start) rl_bind_key('\t', rl_abort); @@ -112,7 +112,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 @@ -149,7 +149,7 @@ void CliRunnable::run() rl_bind_key('\t', rl_complete); #endif - 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') @@ -180,7 +180,7 @@ void CliRunnable::run() } fflush(stdout); - sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); + sWorld->QueueCliCommand(new CliCommandHolder(nullptr, command.c_str(), &utf8print, &commandFinished)); #if AC_PLATFORM != AC_PLATFORM_WINDOWS add_history(command.c_str()); free(command_str); diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 6bb69e3e6..8aa236668 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -183,7 +183,7 @@ int Master::Run() acore::Thread worldThread(new WorldRunnable); worldThread.setPriority(acore::Priority_Highest); - acore::Thread* cliThread = NULL; + acore::Thread* cliThread = nullptr; #ifdef _WIN32 if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) @@ -271,7 +271,7 @@ int Master::Run() #endif // Start soap serving thread - acore::Thread* soapThread = NULL; + acore::Thread* soapThread = nullptr; if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) { ACSoapRunnable* runnable = new ACSoapRunnable(); @@ -280,7 +280,7 @@ int Master::Run() } // Start up freeze catcher thread - acore::Thread* freezeThread = NULL; + acore::Thread* freezeThread = nullptr; if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable* runnable = new FreezeDetectorRunnable(freezeDelay*1000);