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

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

View File

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

View File

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

View File

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

View File

@@ -387,7 +387,7 @@ public:
std::vector<uint64> 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 )
{

View File

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

View File

@@ -453,7 +453,7 @@ public:
case EVENT_SPAWN_FLAMES_INITIAL:
{
if (changeAllowedFlameSpreadTime)
allowedFlameSpreadTime = time(NULL);
allowedFlameSpreadTime = time(nullptr);
std::vector<Player*> 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<Player*> 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<Creature*> cl;
me->GetCreaturesWithEntryInRange(cl, me->GetExactDist2d(victim), NPC_MAGNETIC_CORE);
for( std::list<Creature*>::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 )

View File

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

View File

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

View File

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

View File

@@ -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<WorldObject*>& targets)
{
WorldObject* target = NULL;
WorldObject* target = nullptr;
for (std::list<WorldObject*>::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<WorldObject*>& targets)
{
WorldObject* target = NULL;
WorldObject* target = nullptr;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if ((*itr)->ToUnit()->HasAura(SPELL_WEAKENED))
{

View File

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