Core/Misc: minor typo and codestyle fixes

This commit is contained in:
Aokromes
2017-12-14 13:41:06 +01:00
parent f7fd109066
commit 4b48d0dfdc
5 changed files with 12 additions and 11 deletions

View File

@@ -91,6 +91,7 @@ void CalendarMgr::LoadFromDB()
TC_LOG_INFO("server.loading", ">> Loaded %u calendar events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
count = 0;
oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7
if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites"))

View File

@@ -294,7 +294,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
// Should get removed later, just keep "compatibility" with scripts
if (setSpawnTime)
m_respawnTime = std::max<time_t>(time(NULL) + respawnDelay, m_respawnTime);
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
// if corpse was removed during falling, the falling will continue and override relocation to respawn position
if (IsFalling())
@@ -2205,7 +2205,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool /*force*/) const
// if the mob is actively being damaged, do not reset due to distance unless it's a world boss
if (!isWorldBoss())
if (time(NULL) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
if (time(nullptr) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
return true;
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.

View File

@@ -42,7 +42,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
default:
case GAMEEVENT_NORMAL:
{
time_t currenttime = time(NULL);
time_t currenttime = time(nullptr);
// Get the event information
return mGameEvent[entry].start < currenttime
&& currenttime < mGameEvent[entry].end
@@ -59,7 +59,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
// if inactive world event, check the prerequisite events
case GAMEEVENT_WORLD_INACTIVE:
{
time_t currenttime = time(NULL);
time_t currenttime = time(nullptr);
for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr)
{
if ((mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
@@ -75,7 +75,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
uint32 GameEventMgr::NextCheck(uint16 entry) const
{
time_t currenttime = time(NULL);
time_t currenttime = time(nullptr);
// for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly
if ((mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE || mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) && mGameEvent[entry].nextstart >= currenttime)
@@ -135,7 +135,7 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite)
ApplyNewEvent(event_id);
if (overwrite)
{
mGameEvent[event_id].start = time(NULL);
mGameEvent[event_id].start = time(nullptr);
if (data.end <= data.start)
data.end = data.start + data.length;
}
@@ -1053,7 +1053,7 @@ void GameEventMgr::StartArenaSeason()
uint32 GameEventMgr::Update() // return the next event delay in ms
{
time_t currenttime = time(NULL);
time_t currenttime = time(nullptr);
uint32 nextEventDelay = max_ge_check_delay; // 1 day
uint32 calcDelay;
std::set<uint16> activate, deactivate;
@@ -1641,7 +1641,7 @@ bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
// set the followup events' start time
if (!mGameEvent[event_id].nextstart)
{
time_t currenttime = time(NULL);
time_t currenttime = time(nullptr);
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
}
return true;
@@ -1757,7 +1757,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event)
bool singleDate = ((holiday->Date[0] >> 24) & 0x1F) == 31; // Events with fixed date within year have - 1
time_t curTime = time(NULL);
time_t curTime = time(nullptr);
for (int i = 0; i < MAX_HOLIDAY_DATES && holiday->Date[i]; ++i)
{
uint32 date = holiday->Date[i];

View File

@@ -3144,7 +3144,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// increase current instances (hourly limit)
if (!group || !group->isLFGGroup())
player->AddInstanceEnterTime(GetInstanceId(), time(NULL));
player->AddInstanceEnterTime(GetInstanceId(), time(nullptr));
// get or create an instance save for the map
InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());

View File

@@ -447,7 +447,7 @@ class TC_GAME_API OnlyOnceAreaTriggerScript : public AreaTriggerScript
using AreaTriggerScript::AreaTriggerScript;
public:
bool OnTrigger(Player* /*player*/, AreaTriggerEntry const* /*trigger*/) override;
bool OnTrigger(Player* /*player*/, AreaTriggerEntry const* /*trigger*/) final override;
protected:
virtual bool _OnTrigger(Player* /*player*/, AreaTriggerEntry const* /*trigger*/) = 0;