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

@@ -89,7 +89,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
// Helpers for ScriptProcess method.
inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const
{
Player* player = NULL;
Player* player = nullptr;
if (!source && !target)
sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
@@ -111,7 +111,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse) const
{
Creature* creature = NULL;
Creature* creature = nullptr;
if (!source && !target)
sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
@@ -144,7 +144,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Unit* unit = NULL;
Unit* unit = nullptr;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else if (!obj->isType(TYPEMASK_UNIT))
@@ -162,7 +162,7 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Player* player = NULL;
Player* player = nullptr;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
@@ -177,7 +177,7 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Creature* creature = NULL;
Creature* creature = nullptr;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
@@ -192,7 +192,7 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
WorldObject* pWorldObject = NULL;
WorldObject* pWorldObject = nullptr;
if (!obj)
sLog->outError("%s %s object is NULL.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
@@ -257,7 +257,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
inline GameObject* Map::_FindGameObject(WorldObject* searchObject, uint32 guid) const
{
GameObject* gameobject = NULL;
GameObject* gameobject = nullptr;
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
Cell cell(p);
@@ -284,7 +284,7 @@ void Map::ScriptsProcess()
{
ScriptAction const& step = iter->second;
Object* source = NULL;
Object* source = nullptr;
if (step.sourceGUID)
{
switch (GUID_HIPART(step.sourceGUID))
@@ -313,7 +313,7 @@ void Map::ScriptsProcess()
case HIGHGUID_MO_TRANSPORT:
{
GameObject* go = GetGameObject(step.sourceGUID);
source = go ? go->ToTransport() : NULL;
source = go ? go->ToTransport() : nullptr;
break;
}
default:
@@ -323,7 +323,7 @@ void Map::ScriptsProcess()
}
}
WorldObject* target = NULL;
WorldObject* target = nullptr;
if (step.targetGUID)
{
switch (GUID_HIPART(step.targetGUID))
@@ -348,7 +348,7 @@ void Map::ScriptsProcess()
case HIGHGUID_MO_TRANSPORT:
{
GameObject* go = GetGameObject(step.targetGUID);
target = go ? go->ToTransport() : NULL;
target = go ? go->ToTransport() : nullptr;
break;
}
default:
@@ -705,30 +705,30 @@ void Map::ScriptsProcess()
break;
}
Unit* uSource = NULL;
Unit* uTarget = NULL;
Unit* uSource = nullptr;
Unit* uTarget = nullptr;
// source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s
switch (step.script->CastSpell.Flags)
{
case SF_CASTSPELL_SOURCE_TO_TARGET: // source -> target
uSource = source ? source->ToUnit() : NULL;
uTarget = target ? target->ToUnit() : NULL;
uSource = source ? source->ToUnit() : nullptr;
uTarget = target ? target->ToUnit() : nullptr;
break;
case SF_CASTSPELL_SOURCE_TO_SOURCE: // source -> source
uSource = source ? source->ToUnit() : NULL;
uSource = source ? source->ToUnit() : nullptr;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_TARGET: // target -> target
uSource = target ? target->ToUnit() : NULL;
uSource = target ? target->ToUnit() : nullptr;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_SOURCE: // target -> source
uSource = target ? target->ToUnit() : NULL;
uTarget = source ? source->ToUnit() : NULL;
uSource = target ? target->ToUnit() : nullptr;
uTarget = source ? source->ToUnit() : nullptr;
break;
case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
uSource = source ? source->ToUnit() : NULL;
uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL;
uSource = source ? source->ToUnit() : nullptr;
uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : nullptr;
break;
}
@@ -756,7 +756,7 @@ void Map::ScriptsProcess()
if (WorldObject* object = _GetScriptWorldObject(source, true, step.script))
{
// PlaySound.Flags bitmask: 0/1=anyone/target
Player* player = NULL;
Player* player = nullptr;
if (step.script->PlaySound.Flags & SF_PLAYSOUND_TARGET_PLAYER)
{
// Target must be Player.
@@ -785,7 +785,7 @@ void Map::ScriptsProcess()
pReceiver->SendNewItem(item, step.script->CreateItem.Amount, false, true);
}
else
pReceiver->SendEquipError(msg, NULL, NULL, step.script->CreateItem.ItemEntry);
pReceiver->SendEquipError(msg, nullptr, nullptr, step.script->CreateItem.ItemEntry);
}
break;
@@ -819,7 +819,7 @@ void Map::ScriptsProcess()
break;
}
Creature* cTarget = NULL;
Creature* cTarget = nullptr;
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
if (wSource) //using grid searcher
{
@@ -854,7 +854,7 @@ void Map::ScriptsProcess()
}
// Insert script into schedule but do not start it
ScriptsStart(*datamap, step.script->CallScript.ScriptID, cTarget, NULL);
ScriptsStart(*datamap, step.script->CallScript.ScriptID, cTarget, nullptr);
break;
}