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:
@@ -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
|
||||
|
||||
@@ -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<Creature>, 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<Creature>, 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<Creature>, 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<Creature>, 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<Creature>, 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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -47,7 +47,7 @@ class CreatureGroup
|
||||
typedef std::map<Creature*, FormationInfo*> 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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user