Core/Spawn: Limit saved/stored respawn time.
- Limit to time_t maximum, for the compiled-for architecture. Closes #20834 (cherry picked from commit 3446424540c5692c9e0ff11803d70e8129a5adc4)
This commit is contained in:
@@ -2554,7 +2554,7 @@ void Creature::SaveRespawnTime(uint32 forceDelay, bool savetodb)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 thisRespawnTime = forceDelay ? time(NULL) + forceDelay : m_respawnTime;
|
||||
time_t thisRespawnTime = forceDelay ? time(NULL) + 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -3345,7 +3345,9 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t respawnTime;
|
||||
if (sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID) // never respawn, save "something" in DB
|
||||
if (linkedTime == std::numeric_limits<time_t>::max())
|
||||
respawnTime = linkedTime;
|
||||
else if (sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID) // never respawn, save "something" in DB
|
||||
respawnTime = now + WEEK;
|
||||
else // set us to check again shortly after linked unit
|
||||
respawnTime = std::max<time_t>(now, linkedTime) + urand(5, 15);
|
||||
|
||||
Reference in New Issue
Block a user