refactor(Core): NULL -> nullptr (#3275)

* NULL to nullptr

* NULL to nullptr

* NULL to nullptr

* NULL to nullptr

* NULL to nullptr

Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
Kitzunu
2020-08-31 11:55:09 +02:00
committed by GitHub
parent 38903b5dfb
commit 1f89282b22
325 changed files with 2348 additions and 2348 deletions

View File

@@ -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<acore::MostHPMissingInRange> searcher(me, unit, u_check);
me->VisitNearbyObject(range, searcher);
@@ -405,7 +405,7 @@ std::list<Creature*> 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)
{
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);