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:
@@ -60,19 +60,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
||||
if (!entry)
|
||||
{
|
||||
sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (instanceId == 0)
|
||||
{
|
||||
sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
|
||||
{
|
||||
sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
time_t resetTime, extendedResetTime;
|
||||
@@ -83,7 +83,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
||||
}
|
||||
else
|
||||
{
|
||||
resetTime = time(NULL) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup
|
||||
resetTime = time(nullptr) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup
|
||||
extendedResetTime = 0;
|
||||
}
|
||||
InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, extendedResetTime);
|
||||
@@ -97,7 +97,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
||||
InstanceSave* InstanceSaveManager::GetInstanceSave(uint32 InstanceId)
|
||||
{
|
||||
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(InstanceId);
|
||||
return itr != m_instanceSaveById.end() ? itr->second : NULL;
|
||||
return itr != m_instanceSaveById.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(uint32 InstanceId, bool skipMapCheck)
|
||||
@@ -245,7 +245,7 @@ void InstanceSaveManager::LoadInstances()
|
||||
|
||||
void InstanceSaveManager::LoadResetTimes()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
time_t today = (now / DAY) * DAY;
|
||||
|
||||
// load the global respawn times for raid/heroic instances
|
||||
@@ -410,7 +410,7 @@ void InstanceSaveManager::ScheduleReset(time_t time, InstResetEvent event)
|
||||
|
||||
void InstanceSaveManager::Update()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
time_t t;
|
||||
bool resetOccurred = false;
|
||||
|
||||
@@ -509,7 +509,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
||||
if (!mapEntry->Instanceable())
|
||||
return;
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
|
||||
if (!warn)
|
||||
{
|
||||
@@ -573,7 +573,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
||||
else
|
||||
{
|
||||
InstanceSave* save = GetInstanceSave(map2->GetInstanceId());
|
||||
map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : NULL));
|
||||
map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : nullptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -696,20 +696,20 @@ InstancePlayerBind* InstanceSaveManager::PlayerGetBoundInstance(uint32 guidLow,
|
||||
|
||||
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty_fixed);
|
||||
if (!mapDiff)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
BoundInstancesMapWrapper* w = NULL;
|
||||
BoundInstancesMapWrapper* w = nullptr;
|
||||
PlayerBindStorage::const_iterator itr = playerBindStorage.find(guidLow);
|
||||
if (itr != playerBindStorage.end())
|
||||
w = itr->second;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
BoundInstancesMap::iterator itr2 = w->m[difficulty_fixed].find(mapid);
|
||||
if (itr2 != w->m[difficulty_fixed].end())
|
||||
return &itr2->second;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool InstanceSaveManager::PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty)
|
||||
@@ -737,7 +737,7 @@ void InstanceSaveManager::PlayerCreateBoundInstancesMaps(uint32 guidLow)
|
||||
InstanceSave* InstanceSaveManager::PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty)
|
||||
{
|
||||
InstancePlayerBind* pBind = PlayerGetBoundInstance(guidLow, mapid, difficulty);
|
||||
return (pBind ? pBind->save : NULL);
|
||||
return (pBind ? pBind->save : nullptr);
|
||||
}
|
||||
|
||||
uint32 InstanceSaveManager::PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty)
|
||||
|
||||
@@ -30,7 +30,7 @@ struct InstancePlayerBind
|
||||
InstanceSave* save;
|
||||
bool perm : 1;
|
||||
bool extended : 1;
|
||||
InstancePlayerBind() : save(NULL), perm(false), extended(false) {}
|
||||
InstancePlayerBind() : save(nullptr), perm(false), extended(false) {}
|
||||
};
|
||||
|
||||
typedef std::unordered_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap;
|
||||
@@ -163,16 +163,16 @@ class InstanceSaveManager
|
||||
|
||||
InstanceSave* GetInstanceSave(uint32 InstanceId);
|
||||
|
||||
InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = NULL);
|
||||
void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = NULL);
|
||||
void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = NULL);
|
||||
InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = nullptr);
|
||||
void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = nullptr);
|
||||
void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = nullptr);
|
||||
InstancePlayerBind* PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty);
|
||||
bool PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty);
|
||||
BoundInstancesMap const& PlayerGetBoundInstances(uint32 guidLow, Difficulty difficulty);
|
||||
void PlayerCreateBoundInstancesMaps(uint32 guidLow);
|
||||
InstanceSave* PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty);
|
||||
uint32 PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty);
|
||||
void CopyBinds(uint32 from, uint32 to, Player* toPlr = NULL);
|
||||
void CopyBinds(uint32 from, uint32 to, Player* toPlr = nullptr);
|
||||
void UnbindAllFor(InstanceSave* save);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -100,7 +100,7 @@ void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state)
|
||||
if (!minion->IsAlive())
|
||||
minion->Respawn();
|
||||
else if (!minion->GetVictim())
|
||||
minion->AI()->DoZoneInCombat(NULL, 100.0f);
|
||||
minion->AI()->DoZoneInCombat(nullptr, 100.0f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -233,7 +233,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
|
||||
std::string InstanceScript::LoadBossState(const char * data)
|
||||
{
|
||||
if (!data)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
std::istringstream loadStream(data);
|
||||
uint32 buff;
|
||||
uint32 bossId = 0;
|
||||
|
||||
@@ -155,8 +155,8 @@ class InstanceScript : public ZoneScript
|
||||
|
||||
//Handle open / close objects
|
||||
//use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts
|
||||
//use HandleGameObject(GUID, boolen, NULL); in any other script
|
||||
void HandleGameObject(uint64 guid, bool open, GameObject* go = NULL);
|
||||
//use HandleGameObject(GUID, boolen, nullptr); in any other script
|
||||
void HandleGameObject(uint64 guid, bool open, GameObject* go = nullptr);
|
||||
|
||||
//change active state of doors or buttons
|
||||
void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false);
|
||||
@@ -171,7 +171,7 @@ class InstanceScript : public ZoneScript
|
||||
void DoSendNotifyToInstance(char const* format, ...);
|
||||
|
||||
// Update Achievement Criteria for all players in instance
|
||||
void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL);
|
||||
void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = nullptr);
|
||||
|
||||
// Start/Stop Timed Achievement Criteria for all players in instance
|
||||
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
|
||||
@@ -189,7 +189,7 @@ class InstanceScript : public ZoneScript
|
||||
virtual bool SetBossState(uint32 id, EncounterState state);
|
||||
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
|
||||
static std::string GetBossStateName(uint8 state);
|
||||
BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }
|
||||
BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : nullptr; }
|
||||
BossInfo const* GetBossInfo(uint32 id) const { return &bosses[id]; }
|
||||
|
||||
// Achievement criteria additional requirements check
|
||||
@@ -197,7 +197,7 @@ class InstanceScript : public ZoneScript
|
||||
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
|
||||
|
||||
// Checks boss requirements (one boss required to kill other)
|
||||
virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = NULL) const { return true; }
|
||||
virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = nullptr) const { return true; }
|
||||
|
||||
void SetCompletedEncountersMask(uint32 newMask, bool save);
|
||||
|
||||
@@ -238,7 +238,7 @@ AI* GetInstanceAI(T* obj, char const* scriptName)
|
||||
if (instance->GetScriptId() == sObjectMgr->GetScriptId(scriptName))
|
||||
return new AI(obj);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
template<class AI, class T>
|
||||
@@ -248,7 +248,7 @@ AI* GetInstanceAI(T* obj)
|
||||
if (instance->GetInstanceScript())
|
||||
return new AI(obj);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user