mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 01:53:47 +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:
@@ -229,7 +229,7 @@ _transportsUpdateIter(_transports.end()), i_scriptLock(false), _defaultLight(Get
|
||||
{
|
||||
//z code
|
||||
GridMaps[idx][j] =NULL;
|
||||
setNGrid(NULL, idx, j);
|
||||
setNGrid(nullptr, idx, j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
|
||||
sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
|
||||
#endif
|
||||
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||
ASSERT(ngrid != NULL);
|
||||
ASSERT(ngrid != nullptr);
|
||||
|
||||
GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||
|
||||
@@ -360,7 +360,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
|
||||
|
||||
//TC_LOG_DEBUG(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
|
||||
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
|
||||
ASSERT(ngrid != NULL);
|
||||
ASSERT(ngrid != nullptr);
|
||||
|
||||
GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
|
||||
|
||||
@@ -440,7 +440,7 @@ bool Map::EnsureGridLoaded(const Cell &cell)
|
||||
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
|
||||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
|
||||
ASSERT(grid != NULL);
|
||||
ASSERT(grid != nullptr);
|
||||
if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||
{
|
||||
//if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||
@@ -1184,7 +1184,7 @@ bool Map::UnloadGrid(NGridType& ngrid)
|
||||
ASSERT(i_objectsToRemove.empty());
|
||||
|
||||
delete &ngrid;
|
||||
setNGrid(NULL, x, y);
|
||||
setNGrid(nullptr, x, y);
|
||||
|
||||
int gx = (MAX_NUMBER_OF_GRIDS - 1) - x;
|
||||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - y;
|
||||
@@ -1201,7 +1201,7 @@ bool Map::UnloadGrid(NGridType& ngrid)
|
||||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId(), gx, gy);
|
||||
}
|
||||
|
||||
GridMaps[gx][gy] = NULL;
|
||||
GridMaps[gx][gy] = nullptr;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId());
|
||||
@@ -1941,7 +1941,7 @@ Transport* Map::GetTransportForPos(uint32 phase, float x, float y, float z, Worl
|
||||
return staticTrans->ToTransport();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
|
||||
@@ -2536,7 +2536,7 @@ template void Map::RemoveFromMap(DynamicObject*, bool);
|
||||
InstanceMap::InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent)
|
||||
: Map(id, InstanceId, SpawnMode, _parent),
|
||||
m_resetAfterUnload(false), m_unloadWhenEmpty(false),
|
||||
instance_script(NULL), i_script_id(0)
|
||||
instance_script(nullptr), i_script_id(0)
|
||||
{
|
||||
//lets initialize visibility distance for dungeons
|
||||
InstanceMap::InitVisibilityDistance();
|
||||
@@ -2555,7 +2555,7 @@ InstanceMap::InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _pa
|
||||
InstanceMap::~InstanceMap()
|
||||
{
|
||||
delete instance_script;
|
||||
instance_script = NULL;
|
||||
instance_script = nullptr;
|
||||
sInstanceSaveMgr->DeleteInstanceSaveIfNeeded(GetInstanceId(), true);
|
||||
}
|
||||
|
||||
@@ -2706,7 +2706,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
// increase current instances (hourly limit)
|
||||
// xinef: specific instances are still limited
|
||||
if (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())
|
||||
player->AddInstanceEnterTime(GetInstanceId(), time(NULL));
|
||||
player->AddInstanceEnterTime(GetInstanceId(), time(nullptr));
|
||||
|
||||
if (!playerBind->perm && !mapSave->CanReset() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance()))
|
||||
{
|
||||
@@ -2759,7 +2759,7 @@ void InstanceMap::AfterPlayerUnlinkFromMap()
|
||||
|
||||
void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask)
|
||||
{
|
||||
if (instance_script != NULL)
|
||||
if (instance_script != nullptr)
|
||||
return;
|
||||
#ifdef ELUNA
|
||||
bool isElunaAI = false;
|
||||
@@ -2921,7 +2921,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
|
||||
/* ******* Battleground Instance Maps ******* */
|
||||
|
||||
BattlegroundMap::BattlegroundMap(uint32 id, uint32 InstanceId, Map* _parent, uint8 spawnMode)
|
||||
: Map(id, InstanceId, spawnMode, _parent), m_bg(NULL)
|
||||
: Map(id, InstanceId, spawnMode, _parent), m_bg(nullptr)
|
||||
{
|
||||
//lets initialize visibility distance for BG/Arenas
|
||||
BattlegroundMap::InitVisibilityDistance();
|
||||
@@ -2932,8 +2932,8 @@ BattlegroundMap::~BattlegroundMap()
|
||||
if (m_bg)
|
||||
{
|
||||
//unlink to prevent crash, always unlink all pointer reference before destruction
|
||||
m_bg->SetBgMap(NULL);
|
||||
m_bg = NULL;
|
||||
m_bg->SetBgMap(nullptr);
|
||||
m_bg = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3016,10 +3016,10 @@ GameObject* Map::GetGameObject(uint64 guid)
|
||||
Transport* Map::GetTransport(uint64 guid)
|
||||
{
|
||||
if (GUID_HIPART(guid) != HIGHGUID_MO_TRANSPORT && GUID_HIPART(guid) != HIGHGUID_TRANSPORT)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
GameObject* go = GetGameObject(guid);
|
||||
return go ? go->ToTransport() : NULL;
|
||||
return go ? go->ToTransport() : nullptr;
|
||||
}
|
||||
|
||||
DynamicObject* Map::GetDynamicObject(uint64 guid)
|
||||
@@ -3052,7 +3052,7 @@ void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t& respawnTime)
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod())
|
||||
respawnTime = now+YEAR;
|
||||
|
||||
@@ -3086,7 +3086,7 @@ void Map::SaveGORespawnTime(uint32 dbGuid, time_t& respawnTime)
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod())
|
||||
respawnTime = now+YEAR;
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ class Map : public GridRefManager<NGridType>
|
||||
{
|
||||
friend class MapReference;
|
||||
public:
|
||||
Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = NULL);
|
||||
Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = nullptr);
|
||||
virtual ~Map();
|
||||
|
||||
MapEntry const* GetEntry() const { return i_mapEntry; }
|
||||
@@ -353,7 +353,7 @@ class Map : public GridRefManager<NGridType>
|
||||
// can return INVALID_HEIGHT if under z+2 z coord not found height
|
||||
float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
|
||||
float GetMinHeight(float x, float y) const;
|
||||
Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = NULL);
|
||||
Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr);
|
||||
|
||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const;
|
||||
|
||||
@@ -451,7 +451,7 @@ class Map : public GridRefManager<NGridType>
|
||||
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0);
|
||||
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true);
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL);
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
|
||||
Player* GetPlayer(uint64 guid);
|
||||
Creature* GetCreature(uint64 guid);
|
||||
GameObject* GetGameObject(uint64 guid);
|
||||
@@ -460,14 +460,14 @@ class Map : public GridRefManager<NGridType>
|
||||
Pet* GetPet(uint64 guid);
|
||||
Corpse* GetCorpse(uint64 guid);
|
||||
|
||||
MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return NULL; }
|
||||
const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return NULL; }
|
||||
MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return nullptr; }
|
||||
const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return nullptr; }
|
||||
|
||||
InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return NULL; }
|
||||
const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; }
|
||||
InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return nullptr; }
|
||||
const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return nullptr; }
|
||||
|
||||
BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return NULL; }
|
||||
const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return NULL; }
|
||||
BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return nullptr; }
|
||||
const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return nullptr; }
|
||||
|
||||
float GetWaterOrGroundLevel(uint32 phasemask,float x, float y, float z, float* ground = NULL, bool swim = false, float maxSearchDist = 50.0f) const;
|
||||
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
|
||||
@@ -680,7 +680,7 @@ class InstanceMap : public Map
|
||||
void AfterPlayerUnlinkFromMap();
|
||||
void Update(const uint32, const uint32, bool thread = true);
|
||||
void CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask);
|
||||
bool Reset(uint8 method, std::list<uint32>* globalSkipList = NULL);
|
||||
bool Reset(uint8 method, std::list<uint32>* globalSkipList = nullptr);
|
||||
uint32 GetScriptId() { return i_script_id; }
|
||||
InstanceScript* GetInstanceScript() { return instance_script; }
|
||||
void PermBindAllPlayers();
|
||||
|
||||
@@ -105,9 +105,9 @@ void MapInstanced::UnloadAll()
|
||||
Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
{
|
||||
if (GetId() != mapId || !player)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Map* map = NULL;
|
||||
Map* map = nullptr;
|
||||
|
||||
if (IsBattlegroundOrArena())
|
||||
{
|
||||
@@ -115,7 +115,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
// the instance id is set in battlegroundid
|
||||
uint32 newInstanceId = player->GetBattlegroundId();
|
||||
if (!newInstanceId)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
map = sMapMgr->FindMap(mapId, newInstanceId);
|
||||
if (!map)
|
||||
@@ -126,7 +126,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
else
|
||||
{
|
||||
player->TeleportToEntryPoint();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
else if (IsSharedDifficultyMap(mapId) && !map->HavePlayers() && map->GetDifficulty() != realdiff)
|
||||
{
|
||||
if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!map->AllTransportsEmpty())
|
||||
map->AllTransportsRemovePassengers(); // pussywizard: gameobjects / summons (assert(passengers.empty) fail in ~transport)
|
||||
|
||||
@@ -67,12 +67,12 @@ Map* MapManager::CreateBaseMap(uint32 id)
|
||||
{
|
||||
Map* map = FindBaseMap(id);
|
||||
|
||||
if (map == NULL)
|
||||
if (map == nullptr)
|
||||
{
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
|
||||
map = FindBaseMap(id);
|
||||
if (map == NULL) // pussywizard: check again after acquiring mutex
|
||||
if (map == nullptr) // pussywizard: check again after acquiring mutex
|
||||
{
|
||||
MapEntry const* entry = sMapStore.LookupEntry(id);
|
||||
ASSERT(entry);
|
||||
@@ -97,7 +97,7 @@ Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
|
||||
{
|
||||
Map* map = FindBaseMap(mapId);
|
||||
if (map && map->Instanceable())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
||||
{
|
||||
Map* map = FindBaseMap(mapid);
|
||||
if (!map)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!map->Instanceable())
|
||||
return instanceId == 0 ? map : NULL;
|
||||
return instanceId == 0 ? map : nullptr;
|
||||
|
||||
return ((MapInstanced*)map)->FindInstanceMap(instanceId);
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ class MapRefManager : public RefManager<Map, Player>
|
||||
MapReference const* getLast() const { return (MapReference const*)RefManager<Map, Player>::getLast(); }
|
||||
|
||||
iterator begin() { return iterator(getFirst()); }
|
||||
iterator end() { return iterator(NULL); }
|
||||
iterator end() { return iterator(nullptr); }
|
||||
iterator rbegin() { return iterator(getLast()); }
|
||||
iterator rend() { return iterator(NULL); }
|
||||
iterator rend() { return iterator(nullptr); }
|
||||
const_iterator begin() const { return const_iterator(getFirst()); }
|
||||
const_iterator end() const { return const_iterator(NULL); }
|
||||
const_iterator end() const { return const_iterator(nullptr); }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void TransportMgr::LoadTransportTemplates()
|
||||
Field* fields = result->Fetch();
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
if (goInfo == NULL)
|
||||
if (goInfo == nullptr)
|
||||
{
|
||||
sLog->outError("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
|
||||
continue;
|
||||
@@ -354,14 +354,14 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/
|
||||
entry = instance->GetGameObjectEntry(0, entry);
|
||||
|
||||
if (!entry)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TransportTemplate const* tInfo = GetTransportTemplate(entry);
|
||||
if (!tInfo)
|
||||
{
|
||||
sLog->outError("Transport %u will not be loaded, `transport_template` missing", entry);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// create transport...
|
||||
@@ -380,7 +380,7 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/
|
||||
if (!trans->CreateMoTrans(guidLow, entry, mapId, x, y, z, o, 255))
|
||||
{
|
||||
delete trans;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId))
|
||||
@@ -389,12 +389,12 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/
|
||||
{
|
||||
sLog->outError("Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId);
|
||||
delete trans;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// use preset map for instances (need to know which instance)
|
||||
trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, NULL));
|
||||
trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, nullptr));
|
||||
if (map && map->IsDungeon())
|
||||
trans->m_zoneScript = map->ToInstanceMap()->GetInstanceScript();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct KeyFrame
|
||||
{
|
||||
explicit KeyFrame(TaxiPathNodeEntry const* node) : Index(0), Node(node), InitialOrientation(0.0f),
|
||||
DistSinceStop(-1.0f), DistUntilStop(-1.0f), DistFromPrev(-1.0f), TimeFrom(0.0f), TimeTo(0.0f),
|
||||
Teleport(false), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0)
|
||||
Teleport(false), ArriveTime(0), DepartureTime(0), Spline(nullptr), NextDistFromPrev(0.0f), NextArriveTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
void LoadTransportTemplates();
|
||||
|
||||
// Creates a transport using given GameObject template entry
|
||||
MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = NULL);
|
||||
MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = nullptr);
|
||||
|
||||
// Spawns all continent transports, used at core startup
|
||||
void SpawnContinentTransports();
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
TransportTemplates::const_iterator itr = _transportTemplates.find(entry);
|
||||
if (itr != _transportTemplates.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TransportAnimation const* GetTransportAnimInfo(uint32 entry) const
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
if (itr != _transportAnimations.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Generates and precaches a path for transport to avoid generation each time transport instance is created
|
||||
|
||||
Reference in New Issue
Block a user