mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
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:
@@ -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<TempSummon*>* 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<acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck> 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<acore::NearestGameObjectEntryInObjectRangeCheck> 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<acore::NearestGameObjectTypeInObjectRangeCheck> 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<acore::NearestPlayerInObjectRangeCheck> 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();
|
||||
|
||||
Reference in New Issue
Block a user