mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Misc: minor typo and codestyle fixes
- Replace NULL uses in new code with nullptr
- Fix wrong (accumulated) load time log when loading calendar invites
- Make Creature::CanRegenerateHealth const as its just a getter
- Mark OnlyOnceAreaTriggerScript::OnTrigger as final in case someone wants to override that (you are supposed to use protected _OnTrigger hook)
(cherry picked from commit 78a1c687a2)
This commit is contained in:
@@ -94,6 +94,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 InviteID, EventID, Invitee, Sender, Status, ResponseTime, ModerationRank, Note FROM calendar_invites"))
|
||||
|
||||
@@ -456,7 +456,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
|
||||
if (setSpawnTime)
|
||||
{
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
m_respawnTime = std::max<time_t>(time(NULL) + respawnDelay, m_respawnTime);
|
||||
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
|
||||
|
||||
SaveRespawnTime(0, false);
|
||||
}
|
||||
@@ -2184,7 +2184,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds const& forceRespawn
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
if (uint32 scalingMode = sWorld->getIntConfig(CONFIG_RESPAWN_DYNAMICMODE))
|
||||
GetMap()->ApplyDynamicModeRespawnScaling(this, m_spawnId, respawnDelay, scalingMode);
|
||||
m_respawnTime = time(NULL) + respawnDelay;
|
||||
m_respawnTime = time(nullptr) + respawnDelay;
|
||||
SaveRespawnTime();
|
||||
}
|
||||
|
||||
@@ -2456,7 +2456,7 @@ void Creature::SaveRespawnTime(uint32 forceDelay, bool savetodb)
|
||||
return;
|
||||
}
|
||||
|
||||
time_t thisRespawnTime = forceDelay ? time(NULL) + forceDelay : m_respawnTime;
|
||||
time_t thisRespawnTime = forceDelay ? time(nullptr) + forceDelay : m_respawnTime;
|
||||
GetMap()->SaveRespawnTime(SPAWN_TYPE_CREATURE, m_spawnId, GetEntry(), thisRespawnTime, GetMap()->GetZoneId(GetPhaseShift(), GetHomePosition()), Trinity::ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId(), savetodb && m_creatureData && m_creatureData->dbData);
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
bool hasQuest(uint32 quest_id) const override;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
|
||||
bool CanRegenerateHealth() { return !_regenerateHealthLock && _regenerateHealth; }
|
||||
bool CanRegenerateHealth() const { return !_regenerateHealthLock && _regenerateHealth; }
|
||||
void SetRegenerateHealth(bool value) { _regenerateHealthLock = !value; }
|
||||
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
|
||||
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const;
|
||||
|
||||
@@ -1734,7 +1734,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];
|
||||
|
||||
@@ -148,7 +148,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
|
||||
// If script is blocking spawn, don't spawn but queue for a re-check in a little bit
|
||||
if (!(group->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE) && !sScriptMgr->CanSpawn(guid, cdata->id, cdata, map))
|
||||
{
|
||||
map->SaveRespawnTime(SPAWN_TYPE_CREATURE, guid, cdata->id, time(NULL) + urand(4,7), map->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), cdata->spawnPoint), Trinity::ComputeGridCoord(cdata->spawnPoint.GetPositionX(), cdata->spawnPoint.GetPositionY()).GetId(), false);
|
||||
map->SaveRespawnTime(SPAWN_TYPE_CREATURE, guid, cdata->id, time(nullptr) + urand(4,7), map->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), cdata->spawnPoint), Trinity::ComputeGridCoord(cdata->spawnPoint.GetPositionX(), cdata->spawnPoint.GetPositionY()).GetId(), false);
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3300,7 +3300,7 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
: ObjectGuid::Create<HighGuid::Creature>(GetId(), info->entry, info->spawnId);
|
||||
if (time_t linkedTime = GetLinkedRespawnTime(thisGUID))
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
time_t respawnTime;
|
||||
if (linkedTime == std::numeric_limits<time_t>::max())
|
||||
respawnTime = linkedTime;
|
||||
@@ -3331,7 +3331,7 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
{
|
||||
if (!sScriptMgr->CanSpawn(info->spawnId, info->entry, sObjectMgr->GetCreatureData(info->spawnId), this))
|
||||
{ // if a script blocks our respawn, schedule next check in a little bit
|
||||
info->respawnTime = time(NULL) + urand(4, 7);
|
||||
info->respawnTime = time(nullptr) + urand(4, 7);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3504,7 +3504,7 @@ void Map::RemoveRespawnTime(RespawnVector& respawnData, bool doRespawn, Characte
|
||||
|
||||
void Map::ProcessRespawns()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
while (!_respawnTimes.empty())
|
||||
{
|
||||
RespawnInfo* next = _respawnTimes.top();
|
||||
@@ -3601,7 +3601,7 @@ bool Map::SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn, bool force, std::v
|
||||
continue;
|
||||
|
||||
time_t respawnTime = GetRespawnTime(data->type, data->spawnId);
|
||||
if (respawnTime && respawnTime > time(NULL))
|
||||
if (respawnTime && respawnTime > time(nullptr))
|
||||
{
|
||||
if (!force && !ignoreRespawn)
|
||||
continue;
|
||||
|
||||
@@ -456,7 +456,7 @@ class TC_GAME_API OnlyOnceAreaTriggerScript : public AreaTriggerScript
|
||||
using AreaTriggerScript::AreaTriggerScript;
|
||||
|
||||
public:
|
||||
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger, bool entered) override;
|
||||
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger, bool entered) final override;
|
||||
|
||||
protected:
|
||||
virtual bool _OnTrigger(Player* player, AreaTriggerEntry const* trigger, bool entered) = 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ World::World()
|
||||
_guidWarn = false;
|
||||
_guidAlert = false;
|
||||
_warnDiff = 0;
|
||||
_warnShutdownTime = time(NULL);
|
||||
_warnShutdownTime = time(nullptr);
|
||||
}
|
||||
|
||||
/// World destructor
|
||||
|
||||
@@ -714,7 +714,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? secsToTimeString(uint64(ri->respawnTime - time(NULL)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
handler->PSendSysMessage(UI64FMTD " | %u | [%02u,%02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? secsToTimeString(uint64(ri->respawnTime - time(NULL)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
handler->PSendSysMessage(UI64FMTD " | %u | [% 02u, % 02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -231,7 +231,7 @@ bool HandleNpcSpawnGroup(ChatHandler* handler, char const* args)
|
||||
else
|
||||
groupId = atoi(thisArg.c_str());
|
||||
|
||||
arg = strtok(NULL, " ");
|
||||
arg = strtok(nullptr, " ");
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
Reference in New Issue
Block a user