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

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

View File

@@ -720,7 +720,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, 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<GameObject>, 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<GameObject>, 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<GameObject>, 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<GameObject>, 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<GameObject>, 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<GameObject>, 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<Transport*>(this); else return NULL; }
Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return NULL; }
Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport*>(this); else return nullptr; }
Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport*>(this); else return NULL; }
StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return NULL; }
StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport*>(this); else return nullptr; }
StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport*>(this); else return NULL; }
MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return NULL; }
MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport*>(this); else return nullptr; }
MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(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(); }